summaryrefslogtreecommitdiff
path: root/tools/perf/util/parse-events.l
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-06-15 10:31:40 +0400
committerIngo Molnar <mingo@kernel.org>2012-06-18 14:13:25 +0400
commit90e2b22dee908c13df256140a0d6527e3e8ea3f4 (patch)
tree1b874dc6daed04ffd2e6cbdcf30b649407b4f77d /tools/perf/util/parse-events.l
parentac20de6fff445d6deb0c44c25946d198f79f2f00 (diff)
downloadlinux-90e2b22dee908c13df256140a0d6527e3e8ea3f4.tar.xz
perf/tool: Add support to reuse event grammar to parse out terms
We want to reuse the event grammar for parsing aliased terms. The obvious reason is we dont need to add new code when there's already support for this in event grammar. Doing this by adding terms and event start entries into event parse grammar. The grammar forks on the begining based on the starting token, which is supplied via bison interface into the lexer. The lexer then returns the starting token as the first token, thus making the grammar switch accordingly. Currently 2 starting tokens/grammars are supported: PE_START_TERMS, PE_START_EVENTS The PE_START_TERMS related grammar uses 'event_config' part of the grammar for term parsing. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1339741902-8449-12-git-send-email-zheng.z.yan@intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/parse-events.l')
-rw-r--r--tools/perf/util/parse-events.l13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index 329794eea711..488362e14133 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -79,6 +79,19 @@ modifier_event [ukhpGH]{1,8}
modifier_bp [rwx]
%%
+
+%{
+ {
+ int start_token;
+
+ start_token = (int) parse_events_get_extra(yyscanner);
+ if (start_token) {
+ parse_events_set_extra(NULL, yyscanner);
+ return start_token;
+ }
+ }
+%}
+
cpu-cycles|cycles { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES); }
stalled-cycles-frontend|idle-cycles-frontend { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND); }
stalled-cycles-backend|idle-cycles-backend { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_BACKEND); }