perf tools: Add support to update event modifier
Commit-ID: f5b1135bf79557563a814e53ecd610cce663c1e3 Gitweb: http://git.kernel.org/tip/f5b1135bf79557563a814e53ecd610cce663c1e3 Author: Jiri Olsa <[email protected]> AuthorDate: Wed, 8 Aug 2012 12:21:54 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 14 Aug 2012 17:03:47 -0300
perf tools: Add support to update event modifier
Adding support to update already defined event's attribute with event modifier. This change will allow to use group modifier as an update to the existing event modifiers.
Adding 'add' parameter to the parse_events__modifier_event function. Calling it with 'add' = false/true, the event modifier is initialized/updated respectively.
Added exclude_GH flag to evsel struct, because we need to remember if one of 'GH' modifiers was used for event. The reason is that the default settings for exclude_guest is 1 and during the group modifier processing we have no other way of knowing if it was set by default or by event modifier.
Keeping the current behaviour, that any event/group modifier reset the defaults for exclude_host (0) and exclude_guest (1).
--- tools/perf/util/evsel.h | 2 + tools/perf/util/parse-events.c | 74 +++++++++++++++++++++++++++++++++------ tools/perf/util/parse-events.h | 2 +- tools/perf/util/parse-events.y | 2 +- 4 files changed, 66 insertions(+), 14 deletions(-)
tools/perf/util/evsel.h +2 -0
@@ -68,6 +68,8 @@ struct perf_evsel { } handler;unsigned int sample_size;bool supported; +/* parse modifier helper */ +int exclude_GH; };struct cpu_map ;
tools/perf/util/parse-events.c +62 -12
89 lines not on this page · raw message
tools/perf/util/parse-events.h +1 -1
@@ -79,7 +79,7 @@ int parse_events__term_str(struct parse_events__term **_term,int parse_events__term_clone (struct parse_events__term **new,struct parse_events__term *term);void parse_events__free_terms (struct list_head *terms); -int parse_events__modifier_event (struct list_head *list,char *str); +int parse_events__modifier_event (struct list_head *list,char *str,bool add);int parse_events__modifier_group (struct list_head *list,char *event_mod);int parse_events_add_tracepoint (struct list_head **list,int *idx,char *sys,char *event);
tools/perf/util/parse-events.y +1 -1
@@ -153,7 +153,7 @@ event_def PE_MODIFIER_EVENT * (there could be more events added for multiple tracepoint * definitions via '*?'. */ - ABORT_ON(parse_events__modifier_event(list, $2)); + ABORT_ON(parse_events__modifier_event(list, $2, false)); $$ = list; } |