linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Daniel Wagner <wagi@monom.org>
Cc: Tom Zanussi <tom.zanussi@linux.intel.com>,
	rostedt@goodmis.org, masami.hiramatsu.pt@hitachi.com,
	josh@joshtriplett.org, andi@firstfloor.org,
	mathieu.desnoyers@efficios.com, peterz@infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v16 22/23] tracing: Add hist trigger 'log2' modifier
Date: Wed, 30 Mar 2016 00:17:01 +0900	[thread overview]
Message-ID: <20160329151701.GA1797@danjae> (raw)
In-Reply-To: <56FA5284.2050106@monom.org>

Hi Daniel,

On Tue, Mar 29, 2016 at 12:01:40PM +0200, Daniel Wagner wrote:
> Hi,
> 
> On 03/03/2016 07:55 PM, Tom Zanussi wrote:
> > When using '.log2' modifier, the output looks like:
> > 
> >   # echo 'hist:key=bytes_req.log2' > kmalloc/trigger
> >   # cat kmalloc/hist
> > 
> >   { bytes_req: ~ 2^12 } hitcount:          1
> >   { bytes_req: ~ 2^11 } hitcount:          1
> >   { bytes_req: ~ 2^9  } hitcount:          2
> >   { bytes_req: ~ 2^6  } hitcount:          3
> >   { bytes_req: ~ 2^3  } hitcount:         13
> >   { bytes_req: ~ 2^5  } hitcount:         19
> >   { bytes_req: ~ 2^8  } hitcount:         49
> >   { bytes_req: ~ 2^7  } hitcount:         57
> >   { bytes_req: ~ 2^4  } hitcount:         74
> 
> 
> I found a small inconsistency. My command line is
> 
>   echo 'hist:key=latency.log2:sort=latency' > /sys/kernel/debug/tracing/events/test/latency_complete/trigger
> 
> When looking at the output of 'hist' you see that the 
> 'sort=' is not what I provided.
> 
> cat /sys/kernel/debug/tracing/events/test/latency_complete/hist
> # event histogram
> #
> # trigger info: hist:keys=latency.log2:vals=hitcount:sort=latency.log2:size=2048 [active]
> #
> #

Maybe we want to skip printing those flags for sort keys..
What about this?

Thanks,
Namhyung



diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 53e7d7bc67ca..464ef52117bd 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -1118,10 +1118,11 @@ static const char *get_hist_field_flags(struct hist_field *hist_field)
 	return flags_str;
 }
 
-static void hist_field_print(struct seq_file *m, struct hist_field *hist_field)
+static void hist_field_print(struct seq_file *m, struct hist_field *hist_field,
+			     bool print_flags)
 {
 	seq_printf(m, "%s", hist_field->field->name);
-	if (hist_field->flags) {
+	if (hist_field->flags && print_flags) {
 		const char *flags_str = get_hist_field_flags(hist_field);
 
 		if (flags_str)
@@ -1153,7 +1154,7 @@ static int event_hist_trigger_print(struct seq_file *m,
 		if (key_field->flags & HIST_FIELD_STACKTRACE)
 			seq_puts(m, "stacktrace");
 		else
-			hist_field_print(m, key_field);
+			hist_field_print(m, key_field, true);
 	}
 
 	seq_puts(m, ":vals=");
@@ -1163,7 +1164,7 @@ static int event_hist_trigger_print(struct seq_file *m,
 			seq_puts(m, "hitcount");
 		else {
 			seq_puts(m, ",");
-			hist_field_print(m, hist_data->fields[i]);
+			hist_field_print(m, hist_data->fields[i], true);
 		}
 	}
 
@@ -1182,7 +1183,7 @@ static int event_hist_trigger_print(struct seq_file *m,
 		else {
 			unsigned int idx = sort_key->field_idx;
 
-			hist_field_print(m, hist_data->fields[idx]);
+			hist_field_print(m, hist_data->fields[idx], false);
 		}
 
 		if (sort_key->descending)

  reply	other threads:[~2016-03-29 15:17 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03 18:54 [PATCH 00/23] tracing: 'hist' triggers Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 01/23] tracing: Update some tracing_map constants and comments Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 02/23] tracing: Add 'hist' event trigger command Tom Zanussi
2016-03-08 22:26   ` Steven Rostedt
2016-03-09  0:03     ` Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 03/23] tracing: Add hist trigger support for multiple values ('vals=' param) Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 04/23] tracing: Add hist trigger support for compound keys Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 05/23] tracing: Add hist trigger support for user-defined sorting ('sort=' param) Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 06/23] tracing: Add hist trigger support for pausing and continuing a trace Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 07/23] tracing: Add hist trigger support for clearing " Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 08/23] tracing: Add hist trigger 'hex' modifier for displaying numeric fields Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 09/23] tracing: Add hist trigger 'sym' and 'sym-offset' modifiers Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 10/23] tracing: Add hist trigger 'execname' modifier Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 11/23] tracing: Add hist trigger 'syscall' modifier Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 12/23] tracing: Add hist trigger support for stacktraces as keys Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 13/23] tracing: Support string type key properly Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 14/23] tracing: Remove restriction on string position in hist trigger keys Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 15/23] tracing: Add enable_hist/disable_hist triggers Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 16/23] tracing: Add 'hist' trigger Documentation Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 17/23] tracing: Add support for multiple hist triggers per event Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 18/23] tracing: Add support for named triggers Tom Zanussi
2016-03-03 18:54 ` [PATCH v16 19/23] tracing: Add support for named hist triggers Tom Zanussi
2016-03-03 18:55 ` [PATCH v16 20/23] kselftests/ftrace : Add event trigger testcases Tom Zanussi
2016-03-03 18:55 ` [PATCH v16 21/23] kselftests/ftrace: Add hist " Tom Zanussi
2016-03-03 18:55 ` [PATCH v16 22/23] tracing: Add hist trigger 'log2' modifier Tom Zanussi
2016-03-29 10:01   ` Daniel Wagner
2016-03-29 15:17     ` Namhyung Kim [this message]
2016-03-31  5:09       ` Daniel Wagner
2016-04-05 23:35       ` Tom Zanussi
2016-03-03 18:55 ` [PATCH v16 23/23] kselftests/ftrace: Add a test for log2 modifier of hist trigger Tom Zanussi
2016-03-09 14:44 ` [PATCH 00/23] tracing: 'hist' triggers Steven Rostedt
2016-03-09 15:04   ` 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=20160329151701.GA1797@danjae \
    --to=namhyung@kernel.org \
    --cc=andi@firstfloor.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tom.zanussi@linux.intel.com \
    --cc=wagi@monom.org \
    /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).