[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160219215207.GB12977@kernel.org>
Date: Fri, 19 Feb 2016 18:52:07 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Wang Nan <wangnan0@...wei.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Brendan Gregg <brendan.d.gregg@...il.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Cody P Schafer <dev@...yps.com>,
"David S. Miller" <davem@...emloft.net>,
He Kuang <hekuang@...wei.com>,
Jérémie Galarneau
<jeremie.galarneau@...icios.com>, Jiri Olsa <jolsa@...nel.org>,
Kirill Smelkov <kirr@...edi.com>,
Li Zefan <lizefan@...wei.com>,
Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, pi3orama@....com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 12/55] perf tools: Enable config raw and numeric events
Em Fri, Feb 19, 2016 at 12:15:33PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Fri, Feb 19, 2016 at 12:08:47PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Fri, Feb 19, 2016 at 11:44:00AM +0000, Wang Nan escreveu:
> > > This patch allows setting config terms for raw and numeric events.
> > > For example:
> > >
> > > # perf stat -e cycles/name=cyc/ ls
> > > ...
> > > 1821108 cyc
> > > ...
> > >
> > > # perf stat -e r6530160/name=event/ ls
> > > ...
> > > 1103195 event
> > > ...
> > >
> > > # perf record -e cycles -e 4:0x6530160/name=evtx,call-graph=fp/ -a sleep 1
> > > ...
> > > # perf report --stdio
> >
> > Nice stuff, but I'm investigating now why I'm getting this:
> >
> > [acme@...et linux]$ make O=/tmp/build/perf -C tools/perf install-bin
> > make: Entering directory '/home/acme/git/linux/tools/perf'
> > BUILD: Doing 'make -j4' parallel build
> > BISON /tmp/build/perf/util/parse-events-bison.c
> > util/parse-events.y:436.23-38: error: symbol opt_event_config is used, but is not defined as a token and has no rules
> > PE_VALUE ':' PE_VALUE opt_event_config
> > ^^^^^^^^^^^^^^^^
>
> Ok, this is because I deferred the patch that introduces this
> 'opt_event_config' thing, that is buried in a BPF patch, when it
> could've probably have stood out in a separate patch, trying that now.
Ok, so I added the patch below, that uses this opt_event_config thing to
simplify other places where the event config is optional, like
tracepoints, please see if this is ok, my bison skills are limited:
commit 095d8d6283cf8556432673c408cf85de4bbcd64d
Author: Arnaldo Carvalho de Melo <acme@...hat.com>
Date: Fri Feb 19 18:45:12 2016 -0300
perf tools: Introduce opt_event_config nonterminal
To remove duplicated code that differs only in using the matching
'/a,b,c/' part or NULL if no event configuration is done ('//' or no
pair of slashes at all).
Will be used by some new targets allowing the configuration of hardware
events, etc.
Lifted part of the 'opt_event_config' nonterminal from a patch by Wang
Nan.
Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: Alexei Starovoitov <ast@...nel.org>
Cc: Brendan Gregg <brendan.d.gregg@...il.com>
Cc: Cody P Schafer <dev@...yps.com>
Cc: He Kuang <hekuang@...wei.com>
Cc: Jeremie Galarneau <jeremie.galarneau@...icios.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Kirill Smelkov <kirr@...edi.com>
Cc: Li Zefan <lizefan@...wei.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Zefan Li <lizefan@...wei.com>
Cc: pi3orama@....com
Link: http://lkml.kernel.org/n/tip-e3xzpx9cqsmwnaguaxyw6r42@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index c0eac88ef474..ce68746bdc89 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -64,6 +64,7 @@ static inc_group_count(struct list_head *list,
%type <str> PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT
%type <num> value_sym
%type <head> event_config
+%type <head> opt_event_config
%type <term> event_term
%type <head> event_pmu
%type <head> event_legacy_symbol
@@ -222,16 +223,6 @@ PE_NAME '/' event_config '/'
$$ = list;
}
|
-PE_NAME '/' '/'
-{
- struct parse_events_evlist *data = _data;
- struct list_head *list;
-
- ALLOC_LIST(list);
- ABORT_ON(parse_events_add_pmu(data, list, $1, NULL));
- $$ = list;
-}
-|
PE_KERNEL_PMU_EVENT sep_dc
{
struct parse_events_evlist *data = _data;
@@ -378,7 +369,7 @@ PE_PREFIX_MEM PE_VALUE sep_dc
}
event_legacy_tracepoint:
-tracepoint_name
+tracepoint_name opt_event_config
{
struct parse_events_evlist *data = _data;
struct parse_events_error *error = data->error;
@@ -389,24 +380,7 @@ tracepoint_name
error->idx = @1.first_column;
if (parse_events_add_tracepoint(list, &data->idx, $1.sys, $1.event,
- error, NULL))
- return -1;
-
- $$ = list;
-}
-|
-tracepoint_name '/' event_config '/'
-{
- struct parse_events_evlist *data = _data;
- struct parse_events_error *error = data->error;
- struct list_head *list;
-
- ALLOC_LIST(list);
- if (error)
- error->idx = @1.first_column;
-
- if (parse_events_add_tracepoint(list, &data->idx, $1.sys, $1.event,
- error, $3))
+ error, $2))
return -1;
$$ = list;
@@ -476,6 +450,21 @@ PE_BPF_SOURCE
$$ = list;
}
+opt_event_config:
+'/' event_config '/'
+{
+ $$ = $2;
+}
+|
+'/' '/'
+{
+ $$ = NULL;
+}
+|
+{
+ $$ = NULL;
+}
+
start_terms: event_config
{
struct parse_events_terms *data = _data;
Powered by blists - more mailing lists