blob: 9db5097317f4572f374276216c5902d78b1d921b [file] [log] [blame]
Jiri Olsa89812fc2012-03-15 20:09:15 +01001
Zheng Yanac20de6f2012-06-15 14:31:39 +08002%option reentrant
3%option bison-bridge
Jiri Olsa89812fc2012-03-15 20:09:15 +01004%option prefix="parse_events_"
Jiri Olsa08d2f762012-05-21 09:12:52 +02005%option stack
Jiri Olsa6297d422015-04-22 21:10:17 +02006%option bison-locations
7%option yylineno
Jiri Olsab6af53b2017-11-08 16:43:09 +01008%option reject
Jiri Olsa89812fc2012-03-15 20:09:15 +01009
10%{
11#include <errno.h>
Jiri Olsa29479bf2017-10-13 10:37:35 +020012#include <sys/types.h>
13#include <sys/stat.h>
14#include <unistd.h>
Jiri Olsa89812fc2012-03-15 20:09:15 +010015#include "../perf.h"
Jiri Olsa8f707d82012-03-15 20:09:16 +010016#include "parse-events.h"
Wang Nane571e022016-02-22 09:10:35 +000017#include "parse-events-bison.h"
Andi Kleenf0fbb112019-03-26 15:18:21 -070018#include "evsel.h"
Jiri Olsa89812fc2012-03-15 20:09:15 +010019
Zheng Yanac20de6f2012-06-15 14:31:39 +080020char *parse_events_get_text(yyscan_t yyscanner);
21YYSTYPE *parse_events_get_lval(yyscan_t yyscanner);
22
23static int __value(YYSTYPE *yylval, char *str, int base, int token)
Jiri Olsa89812fc2012-03-15 20:09:15 +010024{
Robert Richterb527bab2012-08-07 19:43:13 +020025 u64 num;
Jiri Olsa89812fc2012-03-15 20:09:15 +010026
27 errno = 0;
Robert Richterb527bab2012-08-07 19:43:13 +020028 num = strtoull(str, NULL, base);
Jiri Olsa89812fc2012-03-15 20:09:15 +010029 if (errno)
30 return PE_ERROR;
31
Zheng Yanac20de6f2012-06-15 14:31:39 +080032 yylval->num = num;
Jiri Olsa89812fc2012-03-15 20:09:15 +010033 return token;
34}
35
Zheng Yanac20de6f2012-06-15 14:31:39 +080036static int value(yyscan_t scanner, int base)
Jiri Olsa89812fc2012-03-15 20:09:15 +010037{
Zheng Yanac20de6f2012-06-15 14:31:39 +080038 YYSTYPE *yylval = parse_events_get_lval(scanner);
39 char *text = parse_events_get_text(scanner);
40
41 return __value(yylval, text, base, PE_VALUE);
Jiri Olsa89812fc2012-03-15 20:09:15 +010042}
43
Zheng Yanac20de6f2012-06-15 14:31:39 +080044static int str(yyscan_t scanner, int token)
Jiri Olsa89812fc2012-03-15 20:09:15 +010045{
Zheng Yanac20de6f2012-06-15 14:31:39 +080046 YYSTYPE *yylval = parse_events_get_lval(scanner);
47 char *text = parse_events_get_text(scanner);
48
Alexey Budankovf92da712018-06-04 09:50:56 +030049 if (text[0] != '\'') {
50 yylval->str = strdup(text);
51 } else {
52 /*
53 * If a text tag specified on the command line
54 * contains opening single quite ' then it is
55 * expected that the tag ends with single quote
56 * as well, like this:
57 * name=\'CPU_CLK_UNHALTED.THREAD:cmask=1\'
58 * quotes need to be escaped to bypass shell
59 * processing.
60 */
61 yylval->str = strndup(&text[1], strlen(text) - 2);
62 }
63
Jiri Olsa89812fc2012-03-15 20:09:15 +010064 return token;
65}
66
Jiri Olsa4929e952020-07-26 09:52:44 +020067static int raw(yyscan_t scanner)
68{
69 YYSTYPE *yylval = parse_events_get_lval(scanner);
70 char *text = parse_events_get_text(scanner);
71
72 if (perf_pmu__parse_check(text) == PMU_EVENT_SYMBOL)
73 return str(scanner, PE_NAME);
74
75 return __value(yylval, text + 1, 16, PE_RAW);
76}
77
Jiri Olsa29479bf2017-10-13 10:37:35 +020078static bool isbpf_suffix(char *text)
Andi Kleen77d08712017-08-11 16:26:19 -070079{
Andi Kleen77d08712017-08-11 16:26:19 -070080 int len = strlen(text);
81
82 if (len < 2)
83 return false;
84 if ((text[len - 1] == 'c' || text[len - 1] == 'o') &&
85 text[len - 2] == '.')
86 return true;
87 if (len > 4 && !strcmp(text + len - 4, ".obj"))
88 return true;
89 return false;
90}
91
Jiri Olsa29479bf2017-10-13 10:37:35 +020092static bool isbpf(yyscan_t scanner)
93{
94 char *text = parse_events_get_text(scanner);
95 struct stat st;
96
97 if (!isbpf_suffix(text))
98 return false;
99
100 return stat(text, &st) == 0;
101}
102
Mathieu Poirierdd60fba2016-09-06 10:37:15 -0600103/*
104 * This function is called when the parser gets two kind of input:
105 *
106 * @cfg1 or @cfg2=config
107 *
108 * The leading '@' is stripped off before 'cfg1' and 'cfg2=config' are given to
109 * bison. In the latter case it is necessary to keep the string intact so that
110 * the PMU kernel driver can determine what configurable is associated to
111 * 'config'.
112 */
113static int drv_str(yyscan_t scanner, int token)
114{
115 YYSTYPE *yylval = parse_events_get_lval(scanner);
116 char *text = parse_events_get_text(scanner);
117
118 /* Strip off the '@' */
119 yylval->str = strdup(text + 1);
120 return token;
121}
122
Jiri Olsa6297d422015-04-22 21:10:17 +0200123#define REWIND(__alloc) \
124do { \
125 YYSTYPE *__yylval = parse_events_get_lval(yyscanner); \
126 char *text = parse_events_get_text(yyscanner); \
127 \
128 if (__alloc) \
129 __yylval->str = strdup(text); \
130 \
131 yycolumn -= strlen(text); \
132 yyless(0); \
133} while (0)
134
Jiri Olsa387ad332020-06-02 23:47:29 +0200135static int pmu_str_check(yyscan_t scanner, struct parse_events_state *parse_state)
Kan Liangba32a452014-10-07 11:08:51 -0400136{
137 YYSTYPE *yylval = parse_events_get_lval(scanner);
138 char *text = parse_events_get_text(scanner);
139
140 yylval->str = strdup(text);
Jiri Olsa387ad332020-06-02 23:47:29 +0200141
142 if (parse_state->fake_pmu)
143 return PE_PMU_EVENT_FAKE;
144
Kan Liangba32a452014-10-07 11:08:51 -0400145 switch (perf_pmu__parse_check(text)) {
146 case PMU_EVENT_SYMBOL_PREFIX:
147 return PE_PMU_EVENT_PRE;
148 case PMU_EVENT_SYMBOL_SUFFIX:
149 return PE_PMU_EVENT_SUF;
150 case PMU_EVENT_SYMBOL:
151 return PE_KERNEL_PMU_EVENT;
152 default:
153 return PE_NAME;
154 }
155}
156
Zheng Yanac20de6f2012-06-15 14:31:39 +0800157static int sym(yyscan_t scanner, int type, int config)
Jiri Olsa89812fc2012-03-15 20:09:15 +0100158{
Zheng Yanac20de6f2012-06-15 14:31:39 +0800159 YYSTYPE *yylval = parse_events_get_lval(scanner);
160
161 yylval->num = (type << 16) + config;
Jiri Olsacf3506d2012-07-04 00:00:43 +0200162 return type == PERF_TYPE_HARDWARE ? PE_VALUE_SYM_HW : PE_VALUE_SYM_SW;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100163}
164
Andi Kleenf0fbb112019-03-26 15:18:21 -0700165static int tool(yyscan_t scanner, enum perf_tool_event event)
166{
167 YYSTYPE *yylval = parse_events_get_lval(scanner);
168
169 yylval->num = event;
170 return PE_VALUE_SYM_TOOL;
171}
172
Zheng Yanac20de6f2012-06-15 14:31:39 +0800173static int term(yyscan_t scanner, int type)
Jiri Olsa8f707d82012-03-15 20:09:16 +0100174{
Zheng Yanac20de6f2012-06-15 14:31:39 +0800175 YYSTYPE *yylval = parse_events_get_lval(scanner);
176
177 yylval->num = type;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100178 return PE_TERM;
179}
180
Jiri Olsa6297d422015-04-22 21:10:17 +0200181#define YY_USER_ACTION \
182do { \
183 yylloc->last_column = yylloc->first_column; \
184 yylloc->first_column = yycolumn; \
185 yycolumn += yyleng; \
186} while (0);
187
Jiri Olsa94454642017-10-12 17:03:38 +0200188#define USER_REJECT \
189 yycolumn -= yyleng; \
190 REJECT
191
Jiri Olsa89812fc2012-03-15 20:09:15 +0100192%}
193
Jiri Olsa08d2f762012-05-21 09:12:52 +0200194%x mem
Robert Richterac2ba9f2012-08-16 21:10:21 +0200195%s config
196%x event
Wang Nane571e022016-02-22 09:10:35 +0000197%x array
Robert Richterac2ba9f2012-08-16 21:10:21 +0200198
199group [^,{}/]*[{][^}]*[}][^,{}/]*
200event_pmu [^,{}/]+[/][^/]*[/][^,{}/]*
201event [^,{}/]+
Andi Kleen77d08712017-08-11 16:26:19 -0700202bpf_object [^,{}]+\.(o|bpf)[a-zA-Z0-9._]*
203bpf_source [^,{}]+\.c[a-zA-Z0-9._]*
Jiri Olsa08d2f762012-05-21 09:12:52 +0200204
Jiri Olsa89812fc2012-03-15 20:09:15 +0100205num_dec [0-9]+
206num_hex 0x[a-fA-F0-9]+
207num_raw_hex [a-fA-F0-9]+
Agustin Vega-Friasb2b9d3a2018-03-06 09:04:42 -0500208name [a-zA-Z_*?\[\]][a-zA-Z0-9_*?.\[\]]*
Alexey Budankovf92da712018-06-04 09:50:56 +0300209name_tag [\'][a-zA-Z_*?\[\]][a-zA-Z0-9_*?\-,\.\[\]:=]*[\']
Wang Nana34f3be2016-02-22 09:10:31 +0000210name_minus [a-zA-Z_*?][a-zA-Z0-9\-_*?.:]*
Mathieu Poirierdd60fba2016-09-06 10:37:15 -0600211drv_cfg_term [a-zA-Z0-9_\.]+(=[a-zA-Z0-9_*?\.:]+)?
Michael Ellermane9a7c412013-08-06 23:28:05 +1000212/* If you add a modifier you need to update check_modifier() */
Andi Kleen0997a262020-10-14 07:42:55 -0700213modifier_event [ukhpPGHSDIWe]+
Jiri Olsa75827322012-06-29 09:22:54 +0200214modifier_bp [rwx]{1,3}
Jiri Olsa89812fc2012-03-15 20:09:15 +0100215
216%%
Jiri Olsa90e2b222012-06-15 14:31:40 +0800217
218%{
Jiri Olsa1244a322020-05-25 00:42:08 +0200219 struct parse_events_state *_parse_state = parse_events_get_extra(yyscanner);
Jiri Olsa90e2b222012-06-15 14:31:40 +0800220
Jiri Olsa1244a322020-05-25 00:42:08 +0200221 {
222 int start_token = _parse_state->stoken;
Robert Richterac2ba9f2012-08-16 21:10:21 +0200223
224 if (start_token == PE_START_TERMS)
225 BEGIN(config);
226 else if (start_token == PE_START_EVENTS)
227 BEGIN(event);
228
Jiri Olsa90e2b222012-06-15 14:31:40 +0800229 if (start_token) {
Jiri Olsa1244a322020-05-25 00:42:08 +0200230 _parse_state->stoken = 0;
Jiri Olsa6297d422015-04-22 21:10:17 +0200231 /*
232 * The flex parser does not init locations variable
233 * via the scan_string interface, so we need do the
234 * init in here.
235 */
236 yycolumn = 0;
Jiri Olsa90e2b222012-06-15 14:31:40 +0800237 return start_token;
238 }
239 }
240%}
241
Robert Richterac2ba9f2012-08-16 21:10:21 +0200242<event>{
243
244{group} {
Jiri Olsa6297d422015-04-22 21:10:17 +0200245 BEGIN(INITIAL);
246 REWIND(0);
Robert Richterac2ba9f2012-08-16 21:10:21 +0200247 }
248
249{event_pmu} |
Wang Nan84c86ca2015-10-14 12:41:14 +0000250{bpf_object} |
Wang Nand509db02015-10-14 12:41:20 +0000251{bpf_source} |
Robert Richterac2ba9f2012-08-16 21:10:21 +0200252{event} {
Jiri Olsa6297d422015-04-22 21:10:17 +0200253 BEGIN(INITIAL);
254 REWIND(1);
Robert Richterac2ba9f2012-08-16 21:10:21 +0200255 return PE_EVENT_NAME;
256 }
257
Robert Richterac2ba9f2012-08-16 21:10:21 +0200258<<EOF>> {
Jiri Olsa6297d422015-04-22 21:10:17 +0200259 BEGIN(INITIAL);
260 REWIND(0);
Robert Richterac2ba9f2012-08-16 21:10:21 +0200261 }
Jiri Olsaae762642020-05-20 09:40:50 +0200262, {
263 return ',';
264 }
Robert Richterac2ba9f2012-08-16 21:10:21 +0200265}
266
Wang Nane571e022016-02-22 09:10:35 +0000267<array>{
268"]" { BEGIN(config); return ']'; }
269{num_dec} { return value(yyscanner, 10); }
270{num_hex} { return value(yyscanner, 16); }
271, { return ','; }
272"\.\.\." { return PE_ARRAY_RANGE; }
273}
274
Jiri Olsa82004222013-09-27 18:29:58 +0200275<config>{
Jiri Olsae64b0202015-04-22 21:10:21 +0200276 /*
Wang Nan17cb5f82016-02-19 11:43:57 +0000277 * Please update config_term_names when new static term is added.
Jiri Olsae64b0202015-04-22 21:10:21 +0200278 */
Jiri Olsa82004222013-09-27 18:29:58 +0200279config { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_CONFIG); }
280config1 { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_CONFIG1); }
281config2 { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_CONFIG2); }
282name { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_NAME); }
283period { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD); }
Namhyung Kim09af2a52015-08-09 15:45:23 +0900284freq { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_SAMPLE_FREQ); }
Jiri Olsa82004222013-09-27 18:29:58 +0200285branch_type { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE); }
Kan Liang32067712015-08-04 04:30:19 -0400286time { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_TIME); }
Kan Liangd457c962015-08-11 06:30:47 -0400287call-graph { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_CALLGRAPH); }
288stack-size { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_STACKSIZE); }
Arnaldo Carvalho de Melo792d48b2016-04-28 19:03:42 -0300289max-stack { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_MAX_STACK); }
Arnaldo Carvalho de Melo2fda5ad2018-10-19 15:47:34 -0300290nr { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_MAX_EVENTS); }
Wang Nan374ce932015-10-28 10:55:02 +0000291inherit { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_INHERIT); }
292no-inherit { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_NOINHERIT); }
Wang Nan626a6b72016-07-14 08:34:45 +0000293overwrite { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_OVERWRITE); }
294no-overwrite { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_NOOVERWRITE); }
Jin Yao064b4e82019-04-12 21:59:47 +0800295percore { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_PERCORE); }
Adrian Hunter1b992152019-08-06 11:46:05 +0300296aux-output { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_AUX_OUTPUT); }
Adrian Huntereb7a52d2019-11-15 14:42:17 +0200297aux-sample-size { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE); }
Jiri Olsa3a6c51e2020-04-17 00:14:05 +0200298r{num_raw_hex} { return raw(yyscanner); }
Jiri Olsac33cdf52020-07-25 14:19:58 +0200299r0x{num_raw_hex} { return raw(yyscanner); }
Jiri Olsa82004222013-09-27 18:29:58 +0200300, { return ','; }
301"/" { BEGIN(INITIAL); return '/'; }
302{name_minus} { return str(yyscanner, PE_NAME); }
Wang Nane571e022016-02-22 09:10:35 +0000303\[all\] { return PE_ARRAY_ALL; }
304"[" { BEGIN(array); return '['; }
Mathieu Poirierdd60fba2016-09-06 10:37:15 -0600305@{drv_cfg_term} { return drv_str(yyscanner, PE_DRV_CFG_TERM); }
Jiri Olsa82004222013-09-27 18:29:58 +0200306}
307
308<mem>{
309{modifier_bp} { return str(yyscanner, PE_MODIFIER_BP); }
310: { return ':'; }
Jacob Shin3741eb92014-05-29 17:26:51 +0200311"/" { return '/'; }
Jiri Olsa82004222013-09-27 18:29:58 +0200312{num_dec} { return value(yyscanner, 10); }
313{num_hex} { return value(yyscanner, 16); }
314 /*
315 * We need to separate 'mem:' scanner part, in order to get specific
316 * modifier bits parsed out. Otherwise we would need to handle PE_NAME
317 * and we'd need to parse it manually. During the escape from <mem>
318 * state we need to put the escaping char back, so we dont miss it.
319 */
320. { unput(*yytext); BEGIN(INITIAL); }
321 /*
322 * We destroy the scanner after reaching EOF,
323 * but anyway just to be sure get back to INIT state.
324 */
325<<EOF>> { BEGIN(INITIAL); }
326}
327
Zheng Yanac20de6f2012-06-15 14:31:39 +0800328cpu-cycles|cycles { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES); }
329stalled-cycles-frontend|idle-cycles-frontend { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND); }
330stalled-cycles-backend|idle-cycles-backend { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_BACKEND); }
331instructions { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS); }
332cache-references { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_REFERENCES); }
333cache-misses { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES); }
334branch-instructions|branches { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_INSTRUCTIONS); }
335branch-misses { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_MISSES); }
336bus-cycles { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_BUS_CYCLES); }
337ref-cycles { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_REF_CPU_CYCLES); }
338cpu-clock { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_CLOCK); }
339task-clock { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK); }
340page-faults|faults { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS); }
341minor-faults { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MIN); }
342major-faults { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MAJ); }
343context-switches|cs { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CONTEXT_SWITCHES); }
344cpu-migrations|migrations { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_MIGRATIONS); }
345alignment-faults { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_ALIGNMENT_FAULTS); }
346emulation-faults { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_EMULATION_FAULTS); }
Adrian Hunterd22d1a22013-08-31 21:50:52 +0300347dummy { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_DUMMY); }
Andi Kleenf0fbb112019-03-26 15:18:21 -0700348duration_time { return tool(yyscanner, PERF_TOOL_DURATION_TIME); }
Wang Nan03e0a7d2016-02-22 09:10:37 +0000349bpf-output { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_BPF_OUTPUT); }
Jiri Olsa89812fc2012-03-15 20:09:15 +0100350
Kan Liangba32a452014-10-07 11:08:51 -0400351 /*
352 * We have to handle the kernel PMU event cycles-ct/cycles-t/mem-loads/mem-stores separately.
353 * Because the prefix cycles is mixed up with cpu-cycles.
354 * loads and stores are mixed up with cache event
355 */
Adrian Hunter47327f562020-03-26 10:01:47 +0200356cycles-ct |
357cycles-t |
358mem-loads |
359mem-stores |
360topdown-[a-z-]+ |
361tx-capacity-[a-z-]+ |
362el-capacity-[a-z-]+ { return str(yyscanner, PE_KERNEL_PMU_EVENT); }
Kan Liangba32a452014-10-07 11:08:51 -0400363
Jiri Olsa89812fc2012-03-15 20:09:15 +0100364L1-dcache|l1-d|l1d|L1-data |
365L1-icache|l1-i|l1i|L1-instruction |
366LLC|L2 |
367dTLB|d-tlb|Data-TLB |
368iTLB|i-tlb|Instruction-TLB |
369branch|branches|bpu|btb|bpc |
Zheng Yanac20de6f2012-06-15 14:31:39 +0800370node { return str(yyscanner, PE_NAME_CACHE_TYPE); }
Jiri Olsa89812fc2012-03-15 20:09:15 +0100371
372load|loads|read |
373store|stores|write |
374prefetch|prefetches |
375speculative-read|speculative-load |
376refs|Reference|ops|access |
Zheng Yanac20de6f2012-06-15 14:31:39 +0800377misses|miss { return str(yyscanner, PE_NAME_CACHE_OP_RESULT); }
Jiri Olsa89812fc2012-03-15 20:09:15 +0100378
Jiri Olsa08d2f762012-05-21 09:12:52 +0200379mem: { BEGIN(mem); return PE_PREFIX_MEM; }
Zheng Yanac20de6f2012-06-15 14:31:39 +0800380r{num_raw_hex} { return raw(yyscanner); }
381{num_dec} { return value(yyscanner, 10); }
382{num_hex} { return value(yyscanner, 16); }
Jiri Olsa89812fc2012-03-15 20:09:15 +0100383
Zheng Yanac20de6f2012-06-15 14:31:39 +0800384{modifier_event} { return str(yyscanner, PE_MODIFIER_EVENT); }
Jiri Olsaa271bfa2017-11-09 10:02:10 +0100385{bpf_object} { if (!isbpf(yyscanner)) { USER_REJECT }; return str(yyscanner, PE_BPF_OBJECT); }
386{bpf_source} { if (!isbpf(yyscanner)) { USER_REJECT }; return str(yyscanner, PE_BPF_SOURCE); }
Jiri Olsa387ad332020-06-02 23:47:29 +0200387{name} { return pmu_str_check(yyscanner, _parse_state); }
Alexey Budankovf92da712018-06-04 09:50:56 +0300388{name_tag} { return str(yyscanner, PE_NAME); }
Robert Richterac2ba9f2012-08-16 21:10:21 +0200389"/" { BEGIN(config); return '/'; }
Jiri Olsa89812fc2012-03-15 20:09:15 +0100390- { return '-'; }
Robert Richterac2ba9f2012-08-16 21:10:21 +0200391, { BEGIN(event); return ','; }
Jiri Olsa89812fc2012-03-15 20:09:15 +0100392: { return ':'; }
Robert Richterac2ba9f2012-08-16 21:10:21 +0200393"{" { BEGIN(event); return '{'; }
Jiri Olsa89efb022012-08-08 12:14:14 +0200394"}" { return '}'; }
Jiri Olsa89812fc2012-03-15 20:09:15 +0100395= { return '='; }
Jiri Olsa8c5f0a82012-07-04 00:00:39 +0200396\n { }
Jiri Olsa82004222013-09-27 18:29:58 +0200397. { }
Jiri Olsa08d2f762012-05-21 09:12:52 +0200398
Jiri Olsa89812fc2012-03-15 20:09:15 +0100399%%
400
Irina Tirdea1d037ca2012-09-11 01:15:03 +0300401int parse_events_wrap(void *scanner __maybe_unused)
Jiri Olsa89812fc2012-03-15 20:09:15 +0100402{
403 return 1;
404}