diff options
author | Jiri Olsa <jolsa@redhat.com> | 2012-03-20 19:15:40 +0100 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-03-22 19:11:38 +0100 |
commit | 5d7be90ed5cfb5dd3c9ab726d7daa91b86b81747 (patch) | |
tree | 9b40166a00566af8bef1c388d51b8863a92cc6fe /tools/perf/util/parse-events.y | |
parent | perf tools: Fix various casting issues for 32 bits (diff) | |
download | linux-5d7be90ed5cfb5dd3c9ab726d7daa91b86b81747.tar.xz linux-5d7be90ed5cfb5dd3c9ab726d7daa91b86b81747.zip |
perf tools: Fix modifier to be applied on correct events
The event modifier needs to be applied only on the event definition it
is attached to.
The current state is that in case of multiple events definition (in
single '-e' option, separated by ',') all will get modifier of the last
one.
Fixing this by adding separated list for each event definition, so the
modifier is applied only to proper event(s). Added automated test to
catch this, plus some other modifier tests.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1332267341-26338-3-git-send-email-jolsa@redhat.com
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 | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index 3a530193f5a8..d9637da7333c 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y @@ -1,6 +1,7 @@ %name-prefix "parse_events_" -%parse-param {struct list_head *list} +%parse-param {struct list_head *list_all} +%parse-param {struct list_head *list_event} %parse-param {int *idx} %{ @@ -56,10 +57,19 @@ events ',' event | event event: event_def PE_MODIFIER_EVENT { - ABORT_ON(parse_events_modifier(list, $2)); + /* + * Apply modifier on all events added by single event definition + * (there could be more events added for multiple tracepoint + * definitions via '*?'. + */ + ABORT_ON(parse_events_modifier(list_event, $2)); + parse_events_update_lists(list_event, list_all); } | event_def +{ + parse_events_update_lists(list_event, list_all); +} event_def: event_pmu | event_legacy_symbol | @@ -72,7 +82,7 @@ event_def: event_pmu | event_pmu: PE_NAME '/' event_config '/' { - ABORT_ON(parse_events_add_pmu(list, idx, $1, $3)); + ABORT_ON(parse_events_add_pmu(list_event, idx, $1, $3)); parse_events__free_terms($3); } @@ -82,7 +92,7 @@ PE_VALUE_SYM '/' event_config '/' int type = $1 >> 16; int config = $1 & 255; - ABORT_ON(parse_events_add_numeric(list, idx, type, config, $3)); + ABORT_ON(parse_events_add_numeric(list_event, idx, type, config, $3)); parse_events__free_terms($3); } | @@ -91,52 +101,52 @@ PE_VALUE_SYM sep_slash_dc int type = $1 >> 16; int config = $1 & 255; - ABORT_ON(parse_events_add_numeric(list, idx, type, config, NULL)); + ABORT_ON(parse_events_add_numeric(list_event, idx, type, config, NULL)); } event_legacy_cache: PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT { - ABORT_ON(parse_events_add_cache(list, idx, $1, $3, $5)); + ABORT_ON(parse_events_add_cache(list_event, idx, $1, $3, $5)); } | PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT { - ABORT_ON(parse_events_add_cache(list, idx, $1, $3, NULL)); + ABORT_ON(parse_events_add_cache(list_event, idx, $1, $3, NULL)); } | PE_NAME_CACHE_TYPE { - ABORT_ON(parse_events_add_cache(list, idx, $1, NULL, NULL)); + ABORT_ON(parse_events_add_cache(list_event, idx, $1, NULL, NULL)); } event_legacy_mem: PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc { - ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) $2, $4)); + ABORT_ON(parse_events_add_breakpoint(list_event, idx, (void *) $2, $4)); } | PE_PREFIX_MEM PE_VALUE sep_dc { - ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) $2, NULL)); + ABORT_ON(parse_events_add_breakpoint(list_event, idx, (void *) $2, NULL)); } event_legacy_tracepoint: PE_NAME ':' PE_NAME { - ABORT_ON(parse_events_add_tracepoint(list, idx, $1, $3)); + ABORT_ON(parse_events_add_tracepoint(list_event, idx, $1, $3)); } event_legacy_numeric: PE_VALUE ':' PE_VALUE { - ABORT_ON(parse_events_add_numeric(list, idx, $1, $3, NULL)); + ABORT_ON(parse_events_add_numeric(list_event, idx, $1, $3, NULL)); } event_legacy_raw: PE_RAW { - ABORT_ON(parse_events_add_numeric(list, idx, PERF_TYPE_RAW, $1, NULL)); + ABORT_ON(parse_events_add_numeric(list_event, idx, PERF_TYPE_RAW, $1, NULL)); } event_config: @@ -211,7 +221,9 @@ sep_slash_dc: '/' | ':' | %% -void parse_events_error(struct list_head *list __used, int *idx __used, +void parse_events_error(struct list_head *list_all __used, + struct list_head *list_event __used, + int *idx __used, char const *msg __used) { } |