From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751473AbbKBHmt (ORCPT ); Mon, 2 Nov 2015 02:42:49 -0500 Received: from LGEAMRELO11.lge.com ([156.147.23.51]:60954 "EHLO lgeamrelo11.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750873AbbKBHmr (ORCPT ); Mon, 2 Nov 2015 02:42:47 -0500 X-Original-SENDERIP: 156.147.1.125 X-Original-MAILFROM: namhyung@kernel.org X-Original-SENDERIP: 165.244.98.150 X-Original-MAILFROM: namhyung@kernel.org X-Original-SENDERIP: 10.177.227.17 X-Original-MAILFROM: namhyung@kernel.org Date: Mon, 2 Nov 2015 16:42:44 +0900 From: Namhyung Kim To: Tom Zanussi CC: rostedt@goodmis.org, daniel.wagner@bmw-carit.de, 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 v11 10/28] tracing: Add hist trigger support for multiple values ('vals=' param) Message-ID: <20151102074244.GC17941@sejong> References: MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-MIMETrack: Itemize by SMTP Server on LGEKRMHUB05/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2015/11/02 16:42:45, Serialize by Router on LGEKRMHUB05/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2015/11/02 16:42:45, Serialize complete at 2015/11/02 16:42:45 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 22, 2015 at 01:14:14PM -0500, Tom Zanussi wrote: > Allow users to specify trace event fields to use in aggregated sums > via a new 'vals=' keyword. Before this addition, the only aggregated > sum supported was the implied value 'hitcount'. With this addition, > 'hitcount' is also supported as an explicit value field, as is any > numeric trace event field. > > This expands the hist trigger syntax from this: > > # echo hist:keys=xxx [ if filter] > event/trigger > > to this: > > # echo hist:keys=xxx:vals=yyy [ if filter] > event/trigger > > Signed-off-by: Tom Zanussi > Tested-by: Masami Hiramatsu > --- Just nipicks.. > kernel/trace/trace.c | 12 ++++--- > kernel/trace/trace_events_hist.c | 75 +++++++++++++++++++++++++++++++++++++++- > 2 files changed, 81 insertions(+), 6 deletions(-) > > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c > index 6d5870b..98817d5 100644 > --- a/kernel/trace/trace.c > +++ b/kernel/trace/trace.c > @@ -3799,14 +3799,16 @@ static const char readme_msg[] = > #ifdef CONFIG_HIST_TRIGGERS > " hist trigger\t- If set, event hits are aggregated into a hash table\n" > "\t Format: hist:keys=\n" > + "\t [:values=[,,...] or > "\t [:size=#entries]\n" > "\t [if ]\n\n" > "\t When a matching event is hit, an entry is added to a hash\n" > - "\t table using the key named, and the value of a sum called\n" > - "\t 'hitcount' is incremented. Keys correspond to fields in the\n" > - "\t event's format description. Keys can be any field. The\n" > - "\t 'size' parameter can be used to specify more or fewer than\n" > - "\t the default 2048 entries for the hashtable size.\n\n" > + "\t table using the key(s) and value(s) named, and the value of a\n" > + "\t sum called 'hitcount' is incremented. Keys and values\n" > + "\t correspond to fields in the event's format description. Keys\n" > + "\t can be any field. Values must correspond to numeric fields.\n" > + "\t The 'size' parameter can be used to specify more or fewer\n" > + "\t than the default 2048 entries for the hashtable size.\n\n" > "\t Reading the 'hist' file for the event will dump the hash\n" > "\t table in its entirety to stdout." > #endif [SNIP] > @@ -534,6 +593,12 @@ hist_trigger_entry_print(struct seq_file *m, > seq_printf(m, " hitcount: %10llu", > tracing_map_read_sum(elt, HITCOUNT_IDX)); > > + for (i = 1; i < hist_data->n_vals; i++) { > + seq_printf(m, " %s: %10llu", > + hist_data->fields[i]->field->name, > + tracing_map_read_sum(elt, i)); > + } > + > seq_puts(m, "\n"); > } > > @@ -641,7 +706,15 @@ static int event_hist_trigger_print(struct seq_file *m, > } > > seq_puts(m, ":vals="); > - seq_puts(m, "hitcount"); > + > + for (i = 0; i < hist_data->n_vals; i++) { > + if (i == 0) s/0/HITCOUNT_IDX/ ? Thanks, Namhyung > + seq_puts(m, "hitcount"); > + else { > + seq_puts(m, ","); > + hist_field_print(m, hist_data->fields[i]); > + } > + } > > seq_puts(m, ":sort="); > seq_puts(m, "hitcount"); > -- > 1.9.3 >