diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-02-19 16:45:12 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-02-19 17:12:50 -0500 |
commit | 1d55e8ef340dad1ccd5aaf53071de41fc3d8dba4 (patch) | |
tree | 6c7e4c8bd38dafb6648f30fcbeae8ed70a07dd60 /tools/perf/util/parse-events.y | |
parent | e814fddde18fec43fa41a27ae94c09b54772697e (diff) |
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@intel.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Cody P Schafer <dev@codyps.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jeremie Galarneau <jeremie.galarneau@efficios.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kirill Smelkov <kirr@nexedi.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/n/tip-e3xzpx9cqsmwnaguaxyw6r42@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/parse-events.y')
-rw-r--r-- | tools/perf/util/parse-events.y | 47 |
1 files changed, 18 insertions, 29 deletions
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, | |||
64 | %type <str> PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT | 64 | %type <str> PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT |
65 | %type <num> value_sym | 65 | %type <num> value_sym |
66 | %type <head> event_config | 66 | %type <head> event_config |
67 | %type <head> opt_event_config | ||
67 | %type <term> event_term | 68 | %type <term> event_term |
68 | %type <head> event_pmu | 69 | %type <head> event_pmu |
69 | %type <head> event_legacy_symbol | 70 | %type <head> event_legacy_symbol |
@@ -222,16 +223,6 @@ PE_NAME '/' event_config '/' | |||
222 | $$ = list; | 223 | $$ = list; |
223 | } | 224 | } |
224 | | | 225 | | |
225 | PE_NAME '/' '/' | ||
226 | { | ||
227 | struct parse_events_evlist *data = _data; | ||
228 | struct list_head *list; | ||
229 | |||
230 | ALLOC_LIST(list); | ||
231 | ABORT_ON(parse_events_add_pmu(data, list, $1, NULL)); | ||
232 | $$ = list; | ||
233 | } | ||
234 | | | ||
235 | PE_KERNEL_PMU_EVENT sep_dc | 226 | PE_KERNEL_PMU_EVENT sep_dc |
236 | { | 227 | { |
237 | struct parse_events_evlist *data = _data; | 228 | struct parse_events_evlist *data = _data; |
@@ -378,7 +369,7 @@ PE_PREFIX_MEM PE_VALUE sep_dc | |||
378 | } | 369 | } |
379 | 370 | ||
380 | event_legacy_tracepoint: | 371 | event_legacy_tracepoint: |
381 | tracepoint_name | 372 | tracepoint_name opt_event_config |
382 | { | 373 | { |
383 | struct parse_events_evlist *data = _data; | 374 | struct parse_events_evlist *data = _data; |
384 | struct parse_events_error *error = data->error; | 375 | struct parse_events_error *error = data->error; |
@@ -389,24 +380,7 @@ tracepoint_name | |||
389 | error->idx = @1.first_column; | 380 | error->idx = @1.first_column; |
390 | 381 | ||
391 | if (parse_events_add_tracepoint(list, &data->idx, $1.sys, $1.event, | 382 | if (parse_events_add_tracepoint(list, &data->idx, $1.sys, $1.event, |
392 | error, NULL)) | 383 | error, $2)) |
393 | return -1; | ||
394 | |||
395 | $$ = list; | ||
396 | } | ||
397 | | | ||
398 | tracepoint_name '/' event_config '/' | ||
399 | { | ||
400 | struct parse_events_evlist *data = _data; | ||
401 | struct parse_events_error *error = data->error; | ||
402 | struct list_head *list; | ||
403 | |||
404 | ALLOC_LIST(list); | ||
405 | if (error) | ||
406 | error->idx = @1.first_column; | ||
407 | |||
408 | if (parse_events_add_tracepoint(list, &data->idx, $1.sys, $1.event, | ||
409 | error, $3)) | ||
410 | return -1; | 384 | return -1; |
411 | 385 | ||
412 | $$ = list; | 386 | $$ = list; |
@@ -476,6 +450,21 @@ PE_BPF_SOURCE | |||
476 | $$ = list; | 450 | $$ = list; |
477 | } | 451 | } |
478 | 452 | ||
453 | opt_event_config: | ||
454 | '/' event_config '/' | ||
455 | { | ||
456 | $$ = $2; | ||
457 | } | ||
458 | | | ||
459 | '/' '/' | ||
460 | { | ||
461 | $$ = NULL; | ||
462 | } | ||
463 | | | ||
464 | { | ||
465 | $$ = NULL; | ||
466 | } | ||
467 | |||
479 | start_terms: event_config | 468 | start_terms: event_config |
480 | { | 469 | { |
481 | struct parse_events_terms *data = _data; | 470 | struct parse_events_terms *data = _data; |