Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760236AbcDEXfI (ORCPT ); Tue, 5 Apr 2016 19:35:08 -0400 Received: from mga11.intel.com ([192.55.52.93]:59175 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752044AbcDEXfH (ORCPT ); Tue, 5 Apr 2016 19:35:07 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,445,1455004800"; d="scan'208";a="79763800" Message-ID: <57044BA4.8000709@linux.intel.com> Date: Tue, 05 Apr 2016 18:35:00 -0500 From: Tom Zanussi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Namhyung Kim , Daniel Wagner CC: 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 References: <7ff396b246c6a881f46b979735fddf05a0d6c71a.1457029949.git.tom.zanussi@linux.intel.com> <56FA5284.2050106@monom.org> <20160329151701.GA1797@danjae> In-Reply-To: <20160329151701.GA1797@danjae> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3129 Lines: 102 Hi Namhyung, Sorry for the late reply, just catching up after Spring Break... On 03/29/2016 10:17 AM, Namhyung Kim wrote: > 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? > Looks fine to me. Thanks, Acked-by: Tom Zanussi > 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) >