[v6,07/15] tracing: Move hist trigger key printing into a separate function
diff mbox series

Message ID 7b9b456df5b0738f73aa6a688db82c345d0358e1.1539288364.git.tom.zanussi@linux.intel.com
State New
Headers show
Series
  • [v6,01/15] tracing: Refactor hist trigger action code
Related show

Commit Message

Tom Zanussi Oct. 11, 2018, 9:02 p.m. UTC
From: Tom Zanussi <tom.zanussi@linux.intel.com>

Future patches will want to print a histogram key outside a histogram
- add and use hist_trigger_print_key() for that purpose.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 kernel/trace/trace_events_hist.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

Comments

Masami Hiramatsu Oct. 23, 2018, 2:37 p.m. UTC | #1
Hi Tom,

On Thu, 11 Oct 2018 16:02:04 -0500
Tom Zanussi <zanussi@kernel.org> wrote:

> From: Tom Zanussi <tom.zanussi@linux.intel.com>
> 
> Future patches will want to print a histogram key outside a histogram
> - add and use hist_trigger_print_key() for that purpose.

Hmm, I think this change should be done with such user code, because without
the user code I can not decide it is good or not.

Thank you,

> 
> Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
> ---
>  kernel/trace/trace_events_hist.c | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> index 3712200dc670..5ec462cb7672 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -4849,10 +4849,10 @@ static void hist_trigger_stacktrace_print(struct seq_file *m,
>  	}
>  }
>  
> -static void
> -hist_trigger_entry_print(struct seq_file *m,
> -			 struct hist_trigger_data *hist_data, void *key,
> -			 struct tracing_map_elt *elt)
> +static void hist_trigger_print_key(struct seq_file *m,
> +				   struct hist_trigger_data *hist_data,
> +				   void *key,
> +				   struct tracing_map_elt *elt)
>  {
>  	struct hist_field *key_field;
>  	char str[KSYM_SYMBOL_LEN];
> @@ -4928,6 +4928,17 @@ hist_trigger_entry_print(struct seq_file *m,
>  		seq_puts(m, " ");
>  
>  	seq_puts(m, "}");
> +}
> +
> +static void hist_trigger_entry_print(struct seq_file *m,
> +				     struct hist_trigger_data *hist_data,
> +				     void *key,
> +				     struct tracing_map_elt *elt)
> +{
> +	const char *field_name;
> +	unsigned int i;
> +
> +	hist_trigger_print_key(m, hist_data, key, elt);
>  
>  	seq_printf(m, " hitcount: %10llu",
>  		   tracing_map_read_sum(elt, HITCOUNT_IDX));
> -- 
> 2.14.1
>
Tom Zanussi Oct. 23, 2018, 9:24 p.m. UTC | #2
Hi Masami,

On Tue, 2018-10-23 at 23:37 +0900, Masami Hiramatsu wrote:
> Hi Tom,
> 
> On Thu, 11 Oct 2018 16:02:04 -0500
> Tom Zanussi <zanussi@kernel.org> wrote:
> 
> > From: Tom Zanussi <tom.zanussi@linux.intel.com>
> > 
> > Future patches will want to print a histogram key outside a
> > histogram
> > - add and use hist_trigger_print_key() for that purpose.
> 
> Hmm, I think this change should be done with such user code, because
> without
> the user code I can not decide it is good or not.
> 

OK, will move it into the following patch, 'tracing: Add hist trigger
snapshot() action'.

Thanks,

Tom

Patch
diff mbox series

diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 3712200dc670..5ec462cb7672 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -4849,10 +4849,10 @@  static void hist_trigger_stacktrace_print(struct seq_file *m,
 	}
 }
 
-static void
-hist_trigger_entry_print(struct seq_file *m,
-			 struct hist_trigger_data *hist_data, void *key,
-			 struct tracing_map_elt *elt)
+static void hist_trigger_print_key(struct seq_file *m,
+				   struct hist_trigger_data *hist_data,
+				   void *key,
+				   struct tracing_map_elt *elt)
 {
 	struct hist_field *key_field;
 	char str[KSYM_SYMBOL_LEN];
@@ -4928,6 +4928,17 @@  hist_trigger_entry_print(struct seq_file *m,
 		seq_puts(m, " ");
 
 	seq_puts(m, "}");
+}
+
+static void hist_trigger_entry_print(struct seq_file *m,
+				     struct hist_trigger_data *hist_data,
+				     void *key,
+				     struct tracing_map_elt *elt)
+{
+	const char *field_name;
+	unsigned int i;
+
+	hist_trigger_print_key(m, hist_data, key, elt);
 
 	seq_printf(m, " hitcount: %10llu",
 		   tracing_map_read_sum(elt, HITCOUNT_IDX));