linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Zanussi <tom.zanussi@linux.intel.com>
To: Piotr Gregor <pgregor@quadrant-systems.co.uk>
Cc: "rostedt@goodmis.org" <rostedt@goodmis.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"mhiramat@kernel.org" <mhiramat@kernel.org>,
	"namhyung@kernel.org" <namhyung@kernel.org>,
	"vedang.patel@intel.com" <vedang.patel@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-rt-users@vger.kernel.org" <linux-rt-users@vger.kernel.org>
Subject: Re: [PATCH 01/32] tracing: Add hist_field_name() accessor
Date: Thu, 13 Jul 2017 09:41:37 -0500	[thread overview]
Message-ID: <1499956897.3995.32.camel@tzanussi-mobl.amr.corp.intel.com> (raw)
In-Reply-To: <AM3PR02MB1308DE5C55A9ED048022E7DC1AC0@AM3PR02MB130.eurprd02.prod.outlook.com>

Hi Piotr,

On Thu, 2017-07-13 at 06:49 +0000, Piotr Gregor wrote:
> Hi Tom,
> 
> Which repo and branch do you push these changes into?
> 

  https://github.com/tzanussi/linux-trace-inter-event.git tzanussi/inter-event-v01

Tom

> cheers,
> Piotr
> 
> -----Original Message-----
> From: linux-rt-users-owner@vger.kernel.org [mailto:linux-rt-users-owner@vger.kernel.org] On Behalf Of Tom Zanussi
> Sent: 26 June 2017 23:49
> To: rostedt@goodmis.org
> Cc: tglx@linutronix.de; mhiramat@kernel.org; namhyung@kernel.org; vedang.patel@intel.com; linux-kernel@vger.kernel.org; linux-rt-users@vger.kernel.org; Tom Zanussi <tom.zanussi@linux.intel.com>
> Subject: [PATCH 01/32] tracing: Add hist_field_name() accessor
> 
> In preparation for hist_fields that won't be strictly based on trace_event_fields, add a new hist_field_name() accessor to allow that flexibility and update associated users.
> 
> Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
> ---
>  kernel/trace/trace_events_hist.c | 68 +++++++++++++++++++++++++++-------------
>  1 file changed, 46 insertions(+), 22 deletions(-)
> 
> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> index 1c21d0e..91ffc39 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -146,6 +146,23 @@ struct hist_trigger_data {
>  	struct tracing_map		*map;
>  };
>  
> +static const char *hist_field_name(struct hist_field *field,
> +				   unsigned int level)
> +{
> +	const char *field_name = "";
> +
> +	if (level > 1)
> +		return field_name;
> +
> +	if (field->field)
> +		field_name = field->field->name;
> +
> +	if (field_name == NULL)
> +		field_name = "";
> +
> +	return field_name;
> +}
> +
>  static hist_field_fn_t select_value_fn(int field_size, int field_is_signed)  {
>  	hist_field_fn_t fn = NULL;
> @@ -653,7 +670,6 @@ static int is_descending(const char *str)  static int create_sort_keys(struct hist_trigger_data *hist_data)  {
>  	char *fields_str = hist_data->attrs->sort_key_str;
> -	struct ftrace_event_field *field = NULL;
>  	struct tracing_map_sort_key *sort_key;
>  	int descending, ret = 0;
>  	unsigned int i, j;
> @@ -670,7 +686,9 @@ static int create_sort_keys(struct hist_trigger_data *hist_data)
>  	}
>  
>  	for (i = 0; i < TRACING_MAP_SORT_KEYS_MAX; i++) {
> +		struct hist_field *hist_field;
>  		char *field_str, *field_name;
> +		const char *test_name;
>  
>  		sort_key = &hist_data->sort_keys[i];
>  
> @@ -703,8 +721,11 @@ static int create_sort_keys(struct hist_trigger_data *hist_data)
>  		}
>  
>  		for (j = 1; j < hist_data->n_fields; j++) {
> -			field = hist_data->fields[j]->field;
> -			if (field && (strcmp(field_name, field->name) == 0)) {
> +			hist_field = hist_data->fields[j];
> +			test_name = hist_field_name(hist_field, 0);
> +			if (test_name == NULL)
> +				continue;
> +			if (strcmp(field_name, test_name) == 0) {
>  				sort_key->field_idx = j;
>  				descending = is_descending(field_str);
>  				if (descending < 0) {
> @@ -952,6 +973,7 @@ static void hist_trigger_stacktrace_print(struct seq_file *m,
>  	struct hist_field *key_field;
>  	char str[KSYM_SYMBOL_LEN];
>  	bool multiline = false;
> +	const char *field_name;
>  	unsigned int i;
>  	u64 uval;
>  
> @@ -963,26 +985,27 @@ static void hist_trigger_stacktrace_print(struct seq_file *m,
>  		if (i > hist_data->n_vals)
>  			seq_puts(m, ", ");
>  
> +		field_name = hist_field_name(key_field, 0);
> +
>  		if (key_field->flags & HIST_FIELD_FL_HEX) {
>  			uval = *(u64 *)(key + key_field->offset);
> -			seq_printf(m, "%s: %llx",
> -				   key_field->field->name, uval);
> +			seq_printf(m, "%s: %llx", field_name, uval);
>  		} else if (key_field->flags & HIST_FIELD_FL_SYM) {
>  			uval = *(u64 *)(key + key_field->offset);
>  			sprint_symbol_no_offset(str, uval);
> -			seq_printf(m, "%s: [%llx] %-45s",
> -				   key_field->field->name, uval, str);
> +			seq_printf(m, "%s: [%llx] %-45s", field_name,
> +				   uval, str);
>  		} else if (key_field->flags & HIST_FIELD_FL_SYM_OFFSET) {
>  			uval = *(u64 *)(key + key_field->offset);
>  			sprint_symbol(str, uval);
> -			seq_printf(m, "%s: [%llx] %-55s",
> -				   key_field->field->name, uval, str);
> +			seq_printf(m, "%s: [%llx] %-55s", field_name,
> +				   uval, str);
>  		} else if (key_field->flags & HIST_FIELD_FL_EXECNAME) {
>  			char *comm = elt->private_data;
>  
>  			uval = *(u64 *)(key + key_field->offset);
> -			seq_printf(m, "%s: %-16s[%10llu]",
> -				   key_field->field->name, comm, uval);
> +			seq_printf(m, "%s: %-16s[%10llu]", field_name,
> +				   comm, uval);
>  		} else if (key_field->flags & HIST_FIELD_FL_SYSCALL) {
>  			const char *syscall_name;
>  
> @@ -991,8 +1014,8 @@ static void hist_trigger_stacktrace_print(struct seq_file *m,
>  			if (!syscall_name)
>  				syscall_name = "unknown_syscall";
>  
> -			seq_printf(m, "%s: %-30s[%3llu]",
> -				   key_field->field->name, syscall_name, uval);
> +			seq_printf(m, "%s: %-30s[%3llu]", field_name,
> +				   syscall_name, uval);
>  		} else if (key_field->flags & HIST_FIELD_FL_STACKTRACE) {
>  			seq_puts(m, "stacktrace:\n");
>  			hist_trigger_stacktrace_print(m,
> @@ -1000,15 +1023,14 @@ static void hist_trigger_stacktrace_print(struct seq_file *m,
>  						      HIST_STACKTRACE_DEPTH);
>  			multiline = true;
>  		} else if (key_field->flags & HIST_FIELD_FL_LOG2) {
> -			seq_printf(m, "%s: ~ 2^%-2llu", key_field->field->name,
> +			seq_printf(m, "%s: ~ 2^%-2llu", field_name,
>  				   *(u64 *)(key + key_field->offset));
>  		} else if (key_field->flags & HIST_FIELD_FL_STRING) {
> -			seq_printf(m, "%s: %-50s", key_field->field->name,
> +			seq_printf(m, "%s: %-50s", field_name,
>  				   (char *)(key + key_field->offset));
>  		} else {
>  			uval = *(u64 *)(key + key_field->offset);
> -			seq_printf(m, "%s: %10llu", key_field->field->name,
> -				   uval);
> +			seq_printf(m, "%s: %10llu", field_name, uval);
>  		}
>  	}
>  
> @@ -1021,13 +1043,13 @@ static void hist_trigger_stacktrace_print(struct seq_file *m,
>  		   tracing_map_read_sum(elt, HITCOUNT_IDX));
>  
>  	for (i = 1; i < hist_data->n_vals; i++) {
> +		field_name = hist_field_name(hist_data->fields[i], 0);
> +
>  		if (hist_data->fields[i]->flags & HIST_FIELD_FL_HEX) {
> -			seq_printf(m, "  %s: %10llx",
> -				   hist_data->fields[i]->field->name,
> +			seq_printf(m, "  %s: %10llx", field_name,
>  				   tracing_map_read_sum(elt, i));
>  		} else {
> -			seq_printf(m, "  %s: %10llu",
> -				   hist_data->fields[i]->field->name,
> +			seq_printf(m, "  %s: %10llu", field_name,
>  				   tracing_map_read_sum(elt, i));
>  		}
>  	}
> @@ -1142,7 +1164,9 @@ static const char *get_hist_field_flags(struct hist_field *hist_field)
>  
>  static void hist_field_print(struct seq_file *m, struct hist_field *hist_field)  {
> -	seq_printf(m, "%s", hist_field->field->name);
> +	const char *field_name = hist_field_name(hist_field, 0);
> +
> +	seq_printf(m, "%s", field_name);
>  	if (hist_field->flags) {
>  		const char *flags_str = get_hist_field_flags(hist_field);
>  
> --
> 1.9.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to majordomo@vger.kernel.org More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-07-13 14:41 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-26 22:49 [PATCH 00/32] tracing: Inter-event (e.g. latency) support Tom Zanussi
2017-06-26 22:49 ` [PATCH 01/32] tracing: Add hist_field_name() accessor Tom Zanussi
2017-07-13  6:49   ` Piotr Gregor
2017-07-13 14:41     ` Tom Zanussi [this message]
2017-07-14  2:19   ` Namhyung Kim
2017-06-26 22:49 ` [PATCH 02/32] tracing: Reimplement log2 Tom Zanussi
2017-07-14  2:33   ` Namhyung Kim
2017-07-14 16:13     ` Tom Zanussi
2017-06-26 22:49 ` [PATCH 03/32] ring-buffer: Add interface for setting absolute time stamps Tom Zanussi
2017-07-14  5:25   ` Namhyung Kim
2017-07-14 16:14     ` Tom Zanussi
2017-06-26 22:49 ` [PATCH 04/32] ring-buffer: Redefine the unimplemented RINGBUF_TIME_TIME_STAMP Tom Zanussi
2017-07-02  8:51   ` Joel Fernandes (Google)
2017-06-26 22:49 ` [PATCH 05/32] tracing: Give event triggers access to ring_buffer_event Tom Zanussi
2017-06-26 22:49 ` [PATCH 06/32] tracing: Add ring buffer event param to hist field functions Tom Zanussi
2017-06-26 22:49 ` [PATCH 07/32] tracing: Increase tracing map KEYS_MAX size Tom Zanussi
2017-06-26 22:49 ` [PATCH 08/32] tracing: Break out hist trigger assignment parsing Tom Zanussi
2017-06-26 22:49 ` [PATCH 09/32] tracing: Make traceprobe parsing code reusable Tom Zanussi
2017-06-26 22:49 ` [PATCH 10/32] tracing: Add NO_DISCARD event file flag Tom Zanussi
2017-06-26 22:49 ` [PATCH 11/32] tracing: Add post-trigger flag to hist trigger command Tom Zanussi
2017-06-26 22:49 ` [PATCH 12/32] tracing: Add hist trigger timestamp support Tom Zanussi
2017-07-17  6:00   ` Namhyung Kim
2017-07-17 16:57     ` Tom Zanussi
2017-06-26 22:49 ` [PATCH 13/32] tracing: Add per-element variable support to tracing_map Tom Zanussi
2017-06-26 22:49 ` [PATCH 14/32] tracing: Add hist_data member to hist_field Tom Zanussi
2017-06-26 22:49 ` [PATCH 15/32] tracing: Add usecs modifier for hist trigger timestamps Tom Zanussi
2017-06-26 22:49 ` [PATCH 16/32] tracing: Add variable support to hist triggers Tom Zanussi
2017-07-19  1:07   ` Namhyung Kim
2017-07-19 15:40     ` Tom Zanussi
2017-06-26 22:49 ` [PATCH 17/32] tracing: Account for variables in named trigger compatibility Tom Zanussi
2017-06-26 22:49 ` [PATCH 18/32] tracing: Add simple expression support to hist triggers Tom Zanussi
2017-07-21  2:02   ` Namhyung Kim
2017-07-21 16:29     ` Tom Zanussi
2017-06-26 22:49 ` [PATCH 19/32] tracing: Add variable reference handling " Tom Zanussi
2017-07-21  3:31   ` Namhyung Kim
2017-07-21 16:41     ` Tom Zanussi
2017-06-26 22:49 ` [PATCH 20/32] tracing: Add support for dynamic tracepoints Tom Zanussi
2017-06-26 22:49 ` [PATCH 21/32] tracing: Add hist trigger action hook Tom Zanussi
2017-06-26 22:49 ` [PATCH 22/32] tracing: Add support for 'synthetic' events Tom Zanussi
2017-07-23 12:00   ` Namhyung Kim
2017-07-24 16:11     ` Tom Zanussi
2017-06-26 22:49 ` [PATCH 23/32] tracing: Add 'onmatch' hist trigger action support Tom Zanussi
2017-07-23 15:12   ` Namhyung Kim
2017-07-24 16:17     ` Tom Zanussi
2017-07-26  2:40   ` Namhyung Kim
2017-07-26 16:38     ` Tom Zanussi
2017-06-26 22:49 ` [PATCH 24/32] tracing: Add 'onmax' " Tom Zanussi
2017-07-26  3:04   ` Namhyung Kim
2017-07-26 16:45     ` Tom Zanussi
2017-06-26 22:49 ` [PATCH 25/32] tracing: Allow whitespace to surround hist trigger filter Tom Zanussi
2017-06-26 22:49 ` [PATCH 26/32] tracing: Make duplicate count from tracing_map available Tom Zanussi
2017-06-26 22:49 ` [PATCH 27/32] tracing: Add cpu field for hist triggers Tom Zanussi
2017-06-26 22:49 ` [PATCH 28/32] tracing: Add hist trigger support for variable reference aliases Tom Zanussi
2017-06-26 22:49 ` [PATCH 29/32] tracing: Add 'last error' error facility for hist triggers Tom Zanussi
2017-07-26  4:39   ` Namhyung Kim
2017-07-26 16:47     ` Tom Zanussi
2017-06-26 22:49 ` [PATCH 30/32] tracing: Add inter-event hist trigger Documentation Tom Zanussi
2017-06-26 22:49 ` [PATCH 31/32] tracing: Make tracing_set_clock() non-static Tom Zanussi
2017-06-26 22:49 ` [PATCH 32/32] tracing: Add a clock attribute for hist triggers Tom Zanussi
2017-06-27 14:58 ` [PATCH 00/32] tracing: Inter-event (e.g. latency) support Steven Rostedt
2017-06-28 14:21 ` Masami Hiramatsu
2017-06-28 19:09   ` Tom Zanussi
2017-07-01  7:01 ` Joel Fernandes (Google)
2017-07-12 19:17   ` Tom Zanussi
2017-07-04 16:12 ` Sebastian Andrzej Siewior
2017-07-12 19:20   ` Tom Zanussi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1499956897.3995.32.camel@tzanussi-mobl.amr.corp.intel.com \
    --to=tom.zanussi@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=pgregor@quadrant-systems.co.uk \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=vedang.patel@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).