diff options
author | Jiri Olsa <jolsa@redhat.com> | 2012-03-15 15:09:16 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-03-16 13:26:06 -0400 |
commit | 8f707d843c2f4023490a873dbc182f632a3a5906 (patch) | |
tree | e4c6d509756aa869314888de0d5873c4a20a7e92 /tools/perf/util/parse-events.l | |
parent | 89812fc81f8d62d70433a8ff63d26819f372e8ec (diff) |
perf tools: Add config options support for event parsing
Adding a new rule to the event grammar to be able to specify
values of additional attributes of symbolic event.
The new syntax for event symbolic definition is:
event_legacy_symbol: PE_NAME_SYM '/' event_config '/' |
PE_NAME_SYM sep_slash_dc
event_config: event_config ',' event_term | event_term
event_term: PE_NAME '=' PE_NAME |
PE_NAME '=' PE_VALUE
PE_NAME
sep_slash_dc: '/' | ':' |
At the moment the config options are hardcoded to be used for legacy
symbol events to define several perf_event_attr fields. It is:
'config' to define perf_event_attr::config
'config1' to define perf_event_attr::config1
'config2' to define perf_event_attr::config2
'period' to define perf_event_attr::sample_period
Legacy events could be now specified as:
cycles/period=100000/
If term is specified without the value assignment, then 1 is
assigned by default.
Acked-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/n/tip-mgkavww9790jbt2jdkooyv4q@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/parse-events.l')
-rw-r--r-- | tools/perf/util/parse-events.l | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index 44dbc359f0a..ab9eca120fe 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <errno.h> | 5 | #include <errno.h> |
6 | #include "../perf.h" | 6 | #include "../perf.h" |
7 | #include "parse-events-bison.h" | 7 | #include "parse-events-bison.h" |
8 | #include "parse-events.h" | ||
8 | 9 | ||
9 | static int __value(char *str, int base, int token) | 10 | static int __value(char *str, int base, int token) |
10 | { | 11 | { |
@@ -41,6 +42,12 @@ static int sym(int type, int config) | |||
41 | return PE_VALUE_SYM; | 42 | return PE_VALUE_SYM; |
42 | } | 43 | } |
43 | 44 | ||
45 | static int term(int type) | ||
46 | { | ||
47 | parse_events_lval.num = type; | ||
48 | return PE_TERM; | ||
49 | } | ||
50 | |||
44 | %} | 51 | %} |
45 | 52 | ||
46 | num_dec [0-9]+ | 53 | num_dec [0-9]+ |
@@ -85,6 +92,18 @@ speculative-read|speculative-load | | |||
85 | refs|Reference|ops|access | | 92 | refs|Reference|ops|access | |
86 | misses|miss { return str(PE_NAME_CACHE_OP_RESULT); } | 93 | misses|miss { return str(PE_NAME_CACHE_OP_RESULT); } |
87 | 94 | ||
95 | /* | ||
96 | * These are event config hardcoded term names to be specified | ||
97 | * within xxx/.../ syntax. So far we dont clash with other names, | ||
98 | * so we can put them here directly. In case the we have a conflict | ||
99 | * in future, this needs to go into '//' condition block. | ||
100 | */ | ||
101 | config { return term(PARSE_EVENTS__TERM_TYPE_CONFIG); } | ||
102 | config1 { return term(PARSE_EVENTS__TERM_TYPE_CONFIG1); } | ||
103 | config2 { return term(PARSE_EVENTS__TERM_TYPE_CONFIG2); } | ||
104 | period { return term(PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD); } | ||
105 | branch_type { return term(PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE); } | ||
106 | |||
88 | mem: { return PE_PREFIX_MEM; } | 107 | mem: { return PE_PREFIX_MEM; } |
89 | r{num_raw_hex} { return raw(); } | 108 | r{num_raw_hex} { return raw(); } |
90 | {num_dec} { return value(10); } | 109 | {num_dec} { return value(10); } |