aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-05-21 03:12:52 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-05-22 10:24:04 -0400
commit08d2f762ac4af861b962e543fceab341f05c8886 (patch)
tree6a4ddd3c8c8383ee9d0ba7d048aaa6c3d301307f /tools
parentb847cbdc6750bdea248ace75c1868f8ef57dcdf0 (diff)
perf tools: Separate 'mem:' event scanner bits
Separating 'mem:' scanner processing, so we can parse out modifier specifically and dont clash with other rules. This is just precaution for the future, so we dont need to worry about the rules clashing where we need to parse out any sub-rule of global rules. 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/1337584373-2741-5-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/parse-events.c1
-rw-r--r--tools/perf/util/parse-events.l25
2 files changed, 24 insertions, 2 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 4025e18765c4..59324e7b3d8e 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -787,6 +787,7 @@ int parse_events(struct perf_evlist *evlist, const char *str, int unset __used)
787 787
788 parse_events__flush_buffer(buffer); 788 parse_events__flush_buffer(buffer);
789 parse_events__delete_buffer(buffer); 789 parse_events__delete_buffer(buffer);
790 parse_events_lex_destroy();
790 791
791 if (!ret) { 792 if (!ret) {
792 int entries = idx - evlist->nr_entries; 793 int entries = idx - evlist->nr_entries;
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index 1fcf1bbc5458..331d28a08dcb 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -1,5 +1,6 @@
1 1
2%option prefix="parse_events_" 2%option prefix="parse_events_"
3%option stack
3 4
4%{ 5%{
5#include <errno.h> 6#include <errno.h>
@@ -50,6 +51,8 @@ static int term(int type)
50 51
51%} 52%}
52 53
54%x mem
55
53num_dec [0-9]+ 56num_dec [0-9]+
54num_hex 0x[a-fA-F0-9]+ 57num_hex 0x[a-fA-F0-9]+
55num_raw_hex [a-fA-F0-9]+ 58num_raw_hex [a-fA-F0-9]+
@@ -105,13 +108,12 @@ config2 { return term(PARSE_EVENTS__TERM_TYPE_CONFIG2); }
105period { return term(PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD); } 108period { return term(PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD); }
106branch_type { return term(PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE); } 109branch_type { return term(PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE); }
107 110
108mem: { return PE_PREFIX_MEM; } 111mem: { BEGIN(mem); return PE_PREFIX_MEM; }
109r{num_raw_hex} { return raw(); } 112r{num_raw_hex} { return raw(); }
110{num_dec} { return value(10); } 113{num_dec} { return value(10); }
111{num_hex} { return value(16); } 114{num_hex} { return value(16); }
112 115
113{modifier_event} { return str(PE_MODIFIER_EVENT); } 116{modifier_event} { return str(PE_MODIFIER_EVENT); }
114{modifier_bp} { return str(PE_MODIFIER_BP); }
115{name} { return str(PE_NAME); } 117{name} { return str(PE_NAME); }
116"/" { return '/'; } 118"/" { return '/'; }
117- { return '-'; } 119- { return '-'; }
@@ -119,6 +121,25 @@ r{num_raw_hex} { return raw(); }
119: { return ':'; } 121: { return ':'; }
120= { return '='; } 122= { return '='; }
121 123
124<mem>{
125{modifier_bp} { return str(PE_MODIFIER_BP); }
126: { return ':'; }
127{num_dec} { return value(10); }
128{num_hex} { return value(16); }
129 /*
130 * We need to separate 'mem:' scanner part, in order to get specific
131 * modifier bits parsed out. Otherwise we would need to handle PE_NAME
132 * and we'd need to parse it manually. During the escape from <mem>
133 * state we need to put the escaping char back, so we dont miss it.
134 */
135. { unput(*parse_events_text); BEGIN(INITIAL); }
136 /*
137 * We destroy the scanner after reaching EOF,
138 * but anyway just to be sure get back to INIT state.
139 */
140<<EOF>> { BEGIN(INITIAL); }
141}
142
122%% 143%%
123 144
124int parse_events_wrap(void) 145int parse_events_wrap(void)