Commit | Line | Data |
---|---|---|
89812fc8 | 1 | |
ac20de6f ZY |
2 | %option reentrant |
3 | %option bison-bridge | |
89812fc8 | 4 | %option prefix="parse_events_" |
08d2f762 | 5 | %option stack |
6297d423 JO |
6 | %option bison-locations |
7 | %option yylineno | |
b6af53b7 | 8 | %option reject |
89812fc8 JO |
9 | |
10 | %{ | |
11 | #include <errno.h> | |
29479bfe JO |
12 | #include <sys/types.h> |
13 | #include <sys/stat.h> | |
14 | #include <unistd.h> | |
8f707d84 | 15 | #include "parse-events.h" |
e571e029 | 16 | #include "parse-events-bison.h" |
f0fbb114 | 17 | #include "evsel.h" |
89812fc8 | 18 | |
ac20de6f ZY |
19 | char *parse_events_get_text(yyscan_t yyscanner); |
20 | YYSTYPE *parse_events_get_lval(yyscan_t yyscanner); | |
ba5c371e IR |
21 | int parse_events_get_column(yyscan_t yyscanner); |
22 | int parse_events_get_leng(yyscan_t yyscanner); | |
ac20de6f | 23 | |
ba5c371e | 24 | static int get_column(yyscan_t scanner) |
89812fc8 | 25 | { |
ba5c371e | 26 | return parse_events_get_column(scanner) - parse_events_get_leng(scanner); |
89812fc8 JO |
27 | } |
28 | ||
ba5c371e | 29 | static int value(struct parse_events_state *parse_state, yyscan_t scanner, int base) |
89812fc8 | 30 | { |
ac20de6f ZY |
31 | YYSTYPE *yylval = parse_events_get_lval(scanner); |
32 | char *text = parse_events_get_text(scanner); | |
ba5c371e | 33 | u64 num; |
ac20de6f | 34 | |
ba5c371e IR |
35 | errno = 0; |
36 | num = strtoull(text, NULL, base); | |
37 | if (errno) { | |
38 | struct parse_events_error *error = parse_state->error; | |
39 | char *help = NULL; | |
40 | ||
41 | if (asprintf(&help, "Bad base %d number \"%s\"", base, text) > 0) | |
42 | parse_events_error__handle(error, get_column(scanner), help , NULL); | |
43 | ||
44 | return PE_ERROR; | |
45 | } | |
46 | ||
47 | yylval->num = num; | |
48 | return PE_VALUE; | |
89812fc8 JO |
49 | } |
50 | ||
ac20de6f | 51 | static int str(yyscan_t scanner, int token) |
89812fc8 | 52 | { |
ac20de6f ZY |
53 | YYSTYPE *yylval = parse_events_get_lval(scanner); |
54 | char *text = parse_events_get_text(scanner); | |
55 | ||
f92da712 AB |
56 | if (text[0] != '\'') { |
57 | yylval->str = strdup(text); | |
58 | } else { | |
59 | /* | |
60 | * If a text tag specified on the command line | |
61 | * contains opening single quite ' then it is | |
62 | * expected that the tag ends with single quote | |
63 | * as well, like this: | |
64 | * name=\'CPU_CLK_UNHALTED.THREAD:cmask=1\' | |
65 | * quotes need to be escaped to bypass shell | |
66 | * processing. | |
67 | */ | |
68 | yylval->str = strndup(&text[1], strlen(text) - 2); | |
69 | } | |
70 | ||
89812fc8 JO |
71 | return token; |
72 | } | |
73 | ||
6fd1e519 IR |
74 | static int lc_str(yyscan_t scanner, const struct parse_events_state *state) |
75 | { | |
76 | return str(scanner, state->match_legacy_cache_terms ? PE_LEGACY_CACHE : PE_NAME); | |
77 | } | |
78 | ||
dd60fba7 MP |
79 | /* |
80 | * This function is called when the parser gets two kind of input: | |
81 | * | |
82 | * @cfg1 or @cfg2=config | |
83 | * | |
84 | * The leading '@' is stripped off before 'cfg1' and 'cfg2=config' are given to | |
85 | * bison. In the latter case it is necessary to keep the string intact so that | |
86 | * the PMU kernel driver can determine what configurable is associated to | |
87 | * 'config'. | |
88 | */ | |
89 | static int drv_str(yyscan_t scanner, int token) | |
90 | { | |
91 | YYSTYPE *yylval = parse_events_get_lval(scanner); | |
92 | char *text = parse_events_get_text(scanner); | |
93 | ||
94 | /* Strip off the '@' */ | |
95 | yylval->str = strdup(text + 1); | |
96 | return token; | |
97 | } | |
98 | ||
bb65ff78 IR |
99 | /* |
100 | * Use yyless to return all the characaters to the input. Update the column for | |
101 | * location debugging. If __alloc is non-zero set yylval to the text for the | |
102 | * returned token's value. | |
103 | */ | |
6297d423 JO |
104 | #define REWIND(__alloc) \ |
105 | do { \ | |
106 | YYSTYPE *__yylval = parse_events_get_lval(yyscanner); \ | |
107 | char *text = parse_events_get_text(yyscanner); \ | |
108 | \ | |
109 | if (__alloc) \ | |
110 | __yylval->str = strdup(text); \ | |
111 | \ | |
112 | yycolumn -= strlen(text); \ | |
113 | yyless(0); \ | |
114 | } while (0) | |
115 | ||
4f1b0673 | 116 | static int sym(yyscan_t scanner, int type, int config) |
89812fc8 | 117 | { |
ac20de6f ZY |
118 | YYSTYPE *yylval = parse_events_get_lval(scanner); |
119 | ||
4f1b0673 ACM |
120 | yylval->num = (type << 16) + config; |
121 | return type == PERF_TYPE_HARDWARE ? PE_VALUE_SYM_HW : PE_VALUE_SYM_SW; | |
89812fc8 JO |
122 | } |
123 | ||
f0fbb114 AK |
124 | static int tool(yyscan_t scanner, enum perf_tool_event event) |
125 | { | |
126 | YYSTYPE *yylval = parse_events_get_lval(scanner); | |
127 | ||
128 | yylval->num = event; | |
129 | return PE_VALUE_SYM_TOOL; | |
130 | } | |
131 | ||
58d3a4ce | 132 | static int term(yyscan_t scanner, enum parse_events__term_type type) |
8f707d84 | 133 | { |
ac20de6f ZY |
134 | YYSTYPE *yylval = parse_events_get_lval(scanner); |
135 | ||
41636448 | 136 | yylval->term_type = type; |
8f707d84 JO |
137 | return PE_TERM; |
138 | } | |
139 | ||
4f1b0673 | 140 | static int hw_term(yyscan_t scanner, int config) |
5ea8f2cc IR |
141 | { |
142 | YYSTYPE *yylval = parse_events_get_lval(scanner); | |
143 | char *text = parse_events_get_text(scanner); | |
144 | ||
4f1b0673 ACM |
145 | yylval->hardware_term.str = strdup(text); |
146 | yylval->hardware_term.num = PERF_TYPE_HARDWARE + config; | |
5ea8f2cc IR |
147 | return PE_TERM_HW; |
148 | } | |
149 | ||
e30a7912 IR |
150 | static void modifiers_error(struct parse_events_state *parse_state, yyscan_t scanner, |
151 | int pos, char mod_char, const char *mod_name) | |
152 | { | |
153 | struct parse_events_error *error = parse_state->error; | |
154 | char *help = NULL; | |
155 | ||
156 | if (asprintf(&help, "Duplicate modifier '%c' (%s)", mod_char, mod_name) > 0) | |
157 | parse_events_error__handle(error, get_column(scanner) + pos, help , NULL); | |
158 | } | |
159 | ||
160 | static int modifiers(struct parse_events_state *parse_state, yyscan_t scanner) | |
161 | { | |
162 | YYSTYPE *yylval = parse_events_get_lval(scanner); | |
163 | char *text = parse_events_get_text(scanner); | |
164 | struct parse_events_modifier mod = { .precise = 0, }; | |
165 | ||
166 | for (size_t i = 0, n = strlen(text); i < n; i++) { | |
167 | #define CASE(c, field) \ | |
168 | case c: \ | |
169 | if (mod.field) { \ | |
170 | modifiers_error(parse_state, scanner, i, c, #field); \ | |
171 | return PE_ERROR; \ | |
172 | } \ | |
173 | mod.field = true; \ | |
174 | break | |
175 | ||
176 | switch (text[i]) { | |
177 | CASE('u', user); | |
178 | CASE('k', kernel); | |
179 | CASE('h', hypervisor); | |
180 | CASE('I', non_idle); | |
181 | CASE('G', guest); | |
182 | CASE('H', host); | |
183 | case 'p': | |
184 | mod.precise++; | |
185 | /* | |
186 | * precise ip: | |
187 | * | |
188 | * 0 - SAMPLE_IP can have arbitrary skid | |
189 | * 1 - SAMPLE_IP must have constant skid | |
190 | * 2 - SAMPLE_IP requested to have 0 skid | |
191 | * 3 - SAMPLE_IP must have 0 skid | |
192 | * | |
193 | * See also PERF_RECORD_MISC_EXACT_IP | |
194 | */ | |
195 | if (mod.precise > 3) { | |
196 | struct parse_events_error *error = parse_state->error; | |
197 | char *help = strdup("Maximum precise value is 3"); | |
198 | ||
199 | if (help) { | |
200 | parse_events_error__handle(error, get_column(scanner) + i, | |
201 | help , NULL); | |
202 | } | |
203 | return PE_ERROR; | |
204 | } | |
205 | break; | |
206 | CASE('P', precise_max); | |
207 | CASE('S', sample_read); | |
208 | CASE('D', pinned); | |
209 | CASE('W', weak); | |
210 | CASE('e', exclusive); | |
211 | CASE('b', bpf); | |
212 | default: | |
213 | return PE_ERROR; | |
214 | } | |
215 | #undef CASE | |
216 | } | |
217 | yylval->mod = mod; | |
218 | return PE_MODIFIER_EVENT; | |
219 | } | |
220 | ||
6297d423 JO |
221 | #define YY_USER_ACTION \ |
222 | do { \ | |
223 | yylloc->last_column = yylloc->first_column; \ | |
224 | yylloc->first_column = yycolumn; \ | |
225 | yycolumn += yyleng; \ | |
226 | } while (0); | |
227 | ||
9445464b JO |
228 | #define USER_REJECT \ |
229 | yycolumn -= yyleng; \ | |
230 | REJECT | |
231 | ||
89812fc8 JO |
232 | %} |
233 | ||
08d2f762 | 234 | %x mem |
ac2ba9f3 RR |
235 | %s config |
236 | %x event | |
237 | ||
238 | group [^,{}/]*[{][^}]*[}][^,{}/]* | |
239 | event_pmu [^,{}/]+[/][^/]*[/][^,{}/]* | |
240 | event [^,{}/]+ | |
08d2f762 | 241 | |
89812fc8 | 242 | num_dec [0-9]+ |
03ff4c6b IR |
243 | num_hex 0x[a-fA-F0-9]{1,16} |
244 | num_raw_hex [a-fA-F0-9]{1,16} | |
5ceb5799 DM |
245 | name [a-zA-Z0-9_*?\[\]][a-zA-Z0-9_*?.\[\]!\-]* |
246 | name_tag [\'][a-zA-Z0-9_*?\[\]][a-zA-Z0-9_*?\-,\.\[\]:=]*[\'] | |
a34f3be7 | 247 | name_minus [a-zA-Z_*?][a-zA-Z0-9\-_*?.:]* |
dd60fba7 | 248 | drv_cfg_term [a-zA-Z0-9_\.]+(=[a-zA-Z0-9_*?\.:]+)? |
f0617f52 AH |
249 | /* |
250 | * If you add a modifier you need to update check_modifier(). | |
251 | * Also, the letters in modifier_event must not be in modifier_bp. | |
252 | */ | |
e30a7912 | 253 | modifier_event [ukhpPGHSDIWeb]{1,15} |
7582732f | 254 | modifier_bp [rwx]{1,3} |
70c90e4a IR |
255 | lc_type (L1-dcache|l1-d|l1d|L1-data|L1-icache|l1-i|l1i|L1-instruction|LLC|L2|dTLB|d-tlb|Data-TLB|iTLB|i-tlb|Instruction-TLB|branch|branches|bpu|btb|bpc|node) |
256 | lc_op_result (load|loads|read|store|stores|write|prefetch|prefetches|speculative-read|speculative-load|refs|Reference|ops|access|misses|miss) | |
f0617f52 AH |
257 | digit [0-9] |
258 | non_digit [^0-9] | |
89812fc8 JO |
259 | |
260 | %% | |
90e2b22d JO |
261 | |
262 | %{ | |
1244a327 | 263 | struct parse_events_state *_parse_state = parse_events_get_extra(yyscanner); |
1244a327 JO |
264 | { |
265 | int start_token = _parse_state->stoken; | |
ac2ba9f3 RR |
266 | |
267 | if (start_token == PE_START_TERMS) | |
268 | BEGIN(config); | |
269 | else if (start_token == PE_START_EVENTS) | |
270 | BEGIN(event); | |
271 | ||
90e2b22d | 272 | if (start_token) { |
1244a327 | 273 | _parse_state->stoken = 0; |
6297d423 JO |
274 | /* |
275 | * The flex parser does not init locations variable | |
276 | * via the scan_string interface, so we need do the | |
277 | * init in here. | |
278 | */ | |
279 | yycolumn = 0; | |
90e2b22d JO |
280 | return start_token; |
281 | } | |
282 | } | |
283 | %} | |
284 | ||
ac2ba9f3 RR |
285 | <event>{ |
286 | ||
287 | {group} { | |
6297d423 JO |
288 | BEGIN(INITIAL); |
289 | REWIND(0); | |
ac2ba9f3 RR |
290 | } |
291 | ||
292 | {event_pmu} | | |
293 | {event} { | |
6297d423 JO |
294 | BEGIN(INITIAL); |
295 | REWIND(1); | |
ac2ba9f3 RR |
296 | return PE_EVENT_NAME; |
297 | } | |
298 | ||
ac2ba9f3 | 299 | <<EOF>> { |
6297d423 JO |
300 | BEGIN(INITIAL); |
301 | REWIND(0); | |
ac2ba9f3 | 302 | } |
ae762641 JO |
303 | , { |
304 | return ','; | |
305 | } | |
ac2ba9f3 RR |
306 | } |
307 | ||
82004223 | 308 | <config>{ |
e64b020b | 309 | /* |
17cb5f84 | 310 | * Please update config_term_names when new static term is added. |
e64b020b | 311 | */ |
82004223 JO |
312 | config { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_CONFIG); } |
313 | config1 { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_CONFIG1); } | |
314 | config2 { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_CONFIG2); } | |
204e7c49 | 315 | config3 { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_CONFIG3); } |
82004223 JO |
316 | name { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_NAME); } |
317 | period { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD); } | |
09af2a55 | 318 | freq { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_SAMPLE_FREQ); } |
82004223 | 319 | branch_type { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE); } |
32067712 | 320 | time { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_TIME); } |
d457c963 KL |
321 | call-graph { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_CALLGRAPH); } |
322 | stack-size { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_STACKSIZE); } | |
792d48b4 | 323 | max-stack { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_MAX_STACK); } |
2fda5ada | 324 | nr { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_MAX_EVENTS); } |
374ce938 WN |
325 | inherit { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_INHERIT); } |
326 | no-inherit { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_NOINHERIT); } | |
626a6b78 WN |
327 | overwrite { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_OVERWRITE); } |
328 | no-overwrite { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_NOOVERWRITE); } | |
064b4e82 | 329 | percore { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_PERCORE); } |
1b992154 | 330 | aux-output { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_AUX_OUTPUT); } |
eb7a52d4 | 331 | aux-sample-size { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE); } |
2b62b3a6 | 332 | metric-id { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_METRIC_ID); } |
4f1b0673 ACM |
333 | cpu-cycles|cycles { return hw_term(yyscanner, PERF_COUNT_HW_CPU_CYCLES); } |
334 | stalled-cycles-frontend|idle-cycles-frontend { return hw_term(yyscanner, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND); } | |
335 | stalled-cycles-backend|idle-cycles-backend { return hw_term(yyscanner, PERF_COUNT_HW_STALLED_CYCLES_BACKEND); } | |
336 | instructions { return hw_term(yyscanner, PERF_COUNT_HW_INSTRUCTIONS); } | |
337 | cache-references { return hw_term(yyscanner, PERF_COUNT_HW_CACHE_REFERENCES); } | |
338 | cache-misses { return hw_term(yyscanner, PERF_COUNT_HW_CACHE_MISSES); } | |
339 | branch-instructions|branches { return hw_term(yyscanner, PERF_COUNT_HW_BRANCH_INSTRUCTIONS); } | |
340 | branch-misses { return hw_term(yyscanner, PERF_COUNT_HW_BRANCH_MISSES); } | |
341 | bus-cycles { return hw_term(yyscanner, PERF_COUNT_HW_BUS_CYCLES); } | |
342 | ref-cycles { return hw_term(yyscanner, PERF_COUNT_HW_REF_CPU_CYCLES); } | |
70c90e4a IR |
343 | r{num_raw_hex} { return str(yyscanner, PE_RAW); } |
344 | r0x{num_raw_hex} { return str(yyscanner, PE_RAW); } | |
82004223 JO |
345 | , { return ','; } |
346 | "/" { BEGIN(INITIAL); return '/'; } | |
6fd1e519 IR |
347 | {lc_type} { return lc_str(yyscanner, _parse_state); } |
348 | {lc_type}-{lc_op_result} { return lc_str(yyscanner, _parse_state); } | |
349 | {lc_type}-{lc_op_result}-{lc_op_result} { return lc_str(yyscanner, _parse_state); } | |
82004223 | 350 | {name_minus} { return str(yyscanner, PE_NAME); } |
dd60fba7 | 351 | @{drv_cfg_term} { return drv_str(yyscanner, PE_DRV_CFG_TERM); } |
82004223 JO |
352 | } |
353 | ||
354 | <mem>{ | |
355 | {modifier_bp} { return str(yyscanner, PE_MODIFIER_BP); } | |
f0617f52 AH |
356 | /* |
357 | * The colon before memory access modifiers can get mixed up with the | |
358 | * colon before event modifiers. Fortunately none of the option letters | |
359 | * are the same, so trailing context can be used disambiguate the two | |
360 | * cases. | |
361 | */ | |
6ec9503f | 362 | ":"/{modifier_bp} { return PE_BP_COLON; } |
f0617f52 AH |
363 | /* |
364 | * The slash before memory length can get mixed up with the slash before | |
365 | * config terms. Fortunately config terms do not start with a numeric | |
366 | * digit, so trailing context can be used disambiguate the two cases. | |
367 | */ | |
6ec9503f | 368 | "/"/{digit} { return PE_BP_SLASH; } |
f0617f52 | 369 | "/"/{non_digit} { BEGIN(config); return '/'; } |
ba5c371e IR |
370 | {num_dec} { return value(_parse_state, yyscanner, 10); } |
371 | {num_hex} { return value(_parse_state, yyscanner, 16); } | |
82004223 JO |
372 | /* |
373 | * We need to separate 'mem:' scanner part, in order to get specific | |
374 | * modifier bits parsed out. Otherwise we would need to handle PE_NAME | |
375 | * and we'd need to parse it manually. During the escape from <mem> | |
376 | * state we need to put the escaping char back, so we dont miss it. | |
377 | */ | |
378 | . { unput(*yytext); BEGIN(INITIAL); } | |
379 | /* | |
380 | * We destroy the scanner after reaching EOF, | |
381 | * but anyway just to be sure get back to INIT state. | |
382 | */ | |
383 | <<EOF>> { BEGIN(INITIAL); } | |
384 | } | |
385 | ||
4f1b0673 ACM |
386 | cpu-cycles|cycles { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES); } |
387 | stalled-cycles-frontend|idle-cycles-frontend { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND); } | |
388 | stalled-cycles-backend|idle-cycles-backend { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_BACKEND); } | |
389 | instructions { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS); } | |
390 | cache-references { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_REFERENCES); } | |
391 | cache-misses { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES); } | |
392 | branch-instructions|branches { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_INSTRUCTIONS); } | |
393 | branch-misses { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_MISSES); } | |
394 | bus-cycles { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_BUS_CYCLES); } | |
395 | ref-cycles { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_REF_CPU_CYCLES); } | |
396 | cpu-clock { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_CLOCK); } | |
397 | task-clock { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK); } | |
398 | page-faults|faults { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS); } | |
399 | minor-faults { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MIN); } | |
400 | major-faults { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MAJ); } | |
401 | context-switches|cs { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CONTEXT_SWITCHES); } | |
402 | cpu-migrations|migrations { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_MIGRATIONS); } | |
403 | alignment-faults { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_ALIGNMENT_FAULTS); } | |
404 | emulation-faults { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_EMULATION_FAULTS); } | |
405 | dummy { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_DUMMY); } | |
f0fbb114 | 406 | duration_time { return tool(yyscanner, PERF_TOOL_DURATION_TIME); } |
b03b89b3 FF |
407 | user_time { return tool(yyscanner, PERF_TOOL_USER_TIME); } |
408 | system_time { return tool(yyscanner, PERF_TOOL_SYSTEM_TIME); } | |
4f1b0673 ACM |
409 | bpf-output { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_BPF_OUTPUT); } |
410 | cgroup-switches { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CGROUP_SWITCHES); } | |
89812fc8 | 411 | |
70c90e4a IR |
412 | {lc_type} { return str(yyscanner, PE_LEGACY_CACHE); } |
413 | {lc_type}-{lc_op_result} { return str(yyscanner, PE_LEGACY_CACHE); } | |
414 | {lc_type}-{lc_op_result}-{lc_op_result} { return str(yyscanner, PE_LEGACY_CACHE); } | |
08d2f762 | 415 | mem: { BEGIN(mem); return PE_PREFIX_MEM; } |
70c90e4a | 416 | r{num_raw_hex} { return str(yyscanner, PE_RAW); } |
ba5c371e IR |
417 | {num_dec} { return value(_parse_state, yyscanner, 10); } |
418 | {num_hex} { return value(_parse_state, yyscanner, 16); } | |
89812fc8 | 419 | |
e30a7912 | 420 | {modifier_event} { return modifiers(_parse_state, yyscanner); } |
70c90e4a | 421 | {name} { return str(yyscanner, PE_NAME); } |
f92da712 | 422 | {name_tag} { return str(yyscanner, PE_NAME); } |
ac2ba9f3 | 423 | "/" { BEGIN(config); return '/'; } |
ac2ba9f3 | 424 | , { BEGIN(event); return ','; } |
89812fc8 | 425 | : { return ':'; } |
ac2ba9f3 | 426 | "{" { BEGIN(event); return '{'; } |
89efb029 | 427 | "}" { return '}'; } |
89812fc8 | 428 | = { return '='; } |
8c5f0a84 | 429 | \n { } |
82004223 | 430 | . { } |
08d2f762 | 431 | |
89812fc8 JO |
432 | %% |
433 | ||
1d037ca1 | 434 | int parse_events_wrap(void *scanner __maybe_unused) |
89812fc8 JO |
435 | { |
436 | return 1; | |
437 | } |