~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/util/parse-events.l

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/perf/util/parse-events.l (Version linux-6.12-rc7) and /tools/perf/util/parse-events.l (Version linux-6.4.16)


  1                                                     1 
  2 %option reentrant                                   2 %option reentrant
  3 %option bison-bridge                                3 %option bison-bridge
  4 %option prefix="parse_events_"                      4 %option prefix="parse_events_"
  5 %option stack                                       5 %option stack
  6 %option bison-locations                             6 %option bison-locations
  7 %option yylineno                                    7 %option yylineno
  8 %option reject                                      8 %option reject
  9                                                     9 
 10 %{                                                 10 %{
 11 #include <errno.h>                                 11 #include <errno.h>
 12 #include <sys/types.h>                             12 #include <sys/types.h>
 13 #include <sys/stat.h>                              13 #include <sys/stat.h>
 14 #include <unistd.h>                                14 #include <unistd.h>
 15 #include "parse-events.h"                          15 #include "parse-events.h"
 16 #include "parse-events-bison.h"                    16 #include "parse-events-bison.h"
 17 #include "evsel.h"                                 17 #include "evsel.h"
 18                                                    18 
 19 char *parse_events_get_text(yyscan_t yyscanner     19 char *parse_events_get_text(yyscan_t yyscanner);
 20 YYSTYPE *parse_events_get_lval(yyscan_t yyscan     20 YYSTYPE *parse_events_get_lval(yyscan_t yyscanner);
 21 int parse_events_get_column(yyscan_t yyscanner << 
 22 int parse_events_get_leng(yyscan_t yyscanner); << 
 23                                                    21 
 24 static int get_column(yyscan_t scanner)        !!  22 static int __value(YYSTYPE *yylval, char *str, int base, int token)
 25 {                                                  23 {
 26         return parse_events_get_column(scanner << 
 27 }                                              << 
 28                                                << 
 29 static int value(struct parse_events_state *pa << 
 30 {                                              << 
 31         YYSTYPE *yylval = parse_events_get_lva << 
 32         char *text = parse_events_get_text(sca << 
 33         u64 num;                                   24         u64 num;
 34                                                    25 
 35         errno = 0;                                 26         errno = 0;
 36         num = strtoull(text, NULL, base);      !!  27         num = strtoull(str, NULL, base);
 37         if (errno) {                           !!  28         if (errno)
 38                 struct parse_events_error *err << 
 39                 char *help = NULL;             << 
 40                                                << 
 41                 if (asprintf(&help, "Bad base  << 
 42                         parse_events_error__ha << 
 43                                                << 
 44                 return PE_ERROR;                   29                 return PE_ERROR;
 45         }                                      << 
 46                                                    30 
 47         yylval->num = num;                         31         yylval->num = num;
 48         return PE_VALUE;                       !!  32         return token;
                                                   >>  33 }
                                                   >>  34 
                                                   >>  35 static int value(yyscan_t scanner, int base)
                                                   >>  36 {
                                                   >>  37         YYSTYPE *yylval = parse_events_get_lval(scanner);
                                                   >>  38         char *text = parse_events_get_text(scanner);
                                                   >>  39 
                                                   >>  40         return __value(yylval, text, base, PE_VALUE);
 49 }                                                  41 }
 50                                                    42 
 51 static int str(yyscan_t scanner, int token)        43 static int str(yyscan_t scanner, int token)
 52 {                                                  44 {
 53         YYSTYPE *yylval = parse_events_get_lva     45         YYSTYPE *yylval = parse_events_get_lval(scanner);
 54         char *text = parse_events_get_text(sca     46         char *text = parse_events_get_text(scanner);
 55                                                    47 
 56         if (text[0] != '\'') {                     48         if (text[0] != '\'') {
 57                 yylval->str = strdup(text);        49                 yylval->str = strdup(text);
 58         } else {                                   50         } else {
 59                 /*                                 51                 /*
 60                  * If a text tag specified on      52                  * If a text tag specified on the command line
 61                  * contains opening single qui     53                  * contains opening single quite ' then it is
 62                  * expected that the tag ends      54                  * expected that the tag ends with single quote
 63                  * as well, like this:             55                  * as well, like this:
 64                  *     name=\'CPU_CLK_UNHALTED     56                  *     name=\'CPU_CLK_UNHALTED.THREAD:cmask=1\'
 65                  * quotes need to be escaped t     57                  * quotes need to be escaped to bypass shell
 66                  * processing.                     58                  * processing.
 67                  */                                59                  */
 68                 yylval->str = strndup(&text[1]     60                 yylval->str = strndup(&text[1], strlen(text) - 2);
 69         }                                          61         }
 70                                                    62 
 71         return token;                              63         return token;
 72 }                                                  64 }
 73                                                    65 
 74 static int lc_str(yyscan_t scanner, const stru !!  66 static int raw(yyscan_t scanner)
 75 {                                                  67 {
 76         return str(scanner, state->match_legac !!  68         YYSTYPE *yylval = parse_events_get_lval(scanner);
                                                   >>  69         char *text = parse_events_get_text(scanner);
                                                   >>  70 
                                                   >>  71         if (perf_pmu__parse_check(text) == PMU_EVENT_SYMBOL)
                                                   >>  72                 return str(scanner, PE_NAME);
                                                   >>  73 
                                                   >>  74         return __value(yylval, text + 1, 16, PE_RAW);
                                                   >>  75 }
                                                   >>  76 
                                                   >>  77 static bool isbpf_suffix(char *text)
                                                   >>  78 {
                                                   >>  79         int len = strlen(text);
                                                   >>  80 
                                                   >>  81         if (len < 2)
                                                   >>  82                 return false;
                                                   >>  83         if ((text[len - 1] == 'c' || text[len - 1] == 'o') &&
                                                   >>  84             text[len - 2] == '.')
                                                   >>  85                 return true;
                                                   >>  86         if (len > 4 && !strcmp(text + len - 4, ".obj"))
                                                   >>  87                 return true;
                                                   >>  88         return false;
                                                   >>  89 }
                                                   >>  90 
                                                   >>  91 static bool isbpf(yyscan_t scanner)
                                                   >>  92 {
                                                   >>  93         char *text = parse_events_get_text(scanner);
                                                   >>  94         struct stat st;
                                                   >>  95 
                                                   >>  96         if (!isbpf_suffix(text))
                                                   >>  97                 return false;
                                                   >>  98 
                                                   >>  99         return stat(text, &st) == 0;
 77 }                                                 100 }
 78                                                   101 
 79 /*                                                102 /*
 80  * This function is called when the parser get    103  * This function is called when the parser gets two kind of input:
 81  *                                                104  *
 82  *      @cfg1 or @cfg2=config                     105  *      @cfg1 or @cfg2=config
 83  *                                                106  *
 84  * The leading '@' is stripped off before 'cfg    107  * The leading '@' is stripped off before 'cfg1' and 'cfg2=config' are given to
 85  * bison.  In the latter case it is necessary     108  * bison.  In the latter case it is necessary to keep the string intact so that
 86  * the PMU kernel driver can determine what co    109  * the PMU kernel driver can determine what configurable is associated to
 87  * 'config'.                                      110  * 'config'.
 88  */                                               111  */
 89 static int drv_str(yyscan_t scanner, int token    112 static int drv_str(yyscan_t scanner, int token)
 90 {                                                 113 {
 91         YYSTYPE *yylval = parse_events_get_lva    114         YYSTYPE *yylval = parse_events_get_lval(scanner);
 92         char *text = parse_events_get_text(sca    115         char *text = parse_events_get_text(scanner);
 93                                                   116 
 94         /* Strip off the '@' */                   117         /* Strip off the '@' */
 95         yylval->str = strdup(text + 1);           118         yylval->str = strdup(text + 1);
 96         return token;                             119         return token;
 97 }                                                 120 }
 98                                                   121 
 99 /*                                             << 
100  * Use yyless to return all the characaters to << 
101  * location debugging. If __alloc is non-zero  << 
102  * returned token's value.                     << 
103  */                                            << 
104 #define REWIND(__alloc)                           122 #define REWIND(__alloc)                         \
105 do {                                              123 do {                                                            \
106         YYSTYPE *__yylval = parse_events_get_l    124         YYSTYPE *__yylval = parse_events_get_lval(yyscanner);   \
107         char *text = parse_events_get_text(yys    125         char *text = parse_events_get_text(yyscanner);          \
108                                                   126                                                                 \
109         if (__alloc)                              127         if (__alloc)                                            \
110                 __yylval->str = strdup(text);     128                 __yylval->str = strdup(text);                   \
111                                                   129                                                                 \
112         yycolumn -= strlen(text);                 130         yycolumn -= strlen(text);                               \
113         yyless(0);                                131         yyless(0);                                              \
114 } while (0)                                       132 } while (0)
115                                                   133 
                                                   >> 134 static int pmu_str_check(yyscan_t scanner, struct parse_events_state *parse_state)
                                                   >> 135 {
                                                   >> 136         YYSTYPE *yylval = parse_events_get_lval(scanner);
                                                   >> 137         char *text = parse_events_get_text(scanner);
                                                   >> 138 
                                                   >> 139         yylval->str = strdup(text);
                                                   >> 140 
                                                   >> 141         /*
                                                   >> 142          * If we're not testing then parse check determines the PMU event type
                                                   >> 143          * which if it isn't a PMU returns PE_NAME. When testing the result of
                                                   >> 144          * parse check can't be trusted so we return PE_PMU_EVENT_FAKE unless
                                                   >> 145          * an '!' is present in which case the text can't be a PMU name.
                                                   >> 146          */
                                                   >> 147         switch (perf_pmu__parse_check(text)) {
                                                   >> 148                 case PMU_EVENT_SYMBOL_PREFIX:
                                                   >> 149                         return PE_PMU_EVENT_PRE;
                                                   >> 150                 case PMU_EVENT_SYMBOL_SUFFIX:
                                                   >> 151                         return PE_PMU_EVENT_SUF;
                                                   >> 152                 case PMU_EVENT_SYMBOL_SUFFIX2:
                                                   >> 153                         return PE_PMU_EVENT_SUF2;
                                                   >> 154                 case PMU_EVENT_SYMBOL:
                                                   >> 155                         return parse_state->fake_pmu
                                                   >> 156                                 ? PE_PMU_EVENT_FAKE : PE_KERNEL_PMU_EVENT;
                                                   >> 157                 default:
                                                   >> 158                         return parse_state->fake_pmu && !strchr(text,'!')
                                                   >> 159                                 ? PE_PMU_EVENT_FAKE : PE_NAME;
                                                   >> 160         }
                                                   >> 161 }
                                                   >> 162 
116 static int sym(yyscan_t scanner, int type, int    163 static int sym(yyscan_t scanner, int type, int config)
117 {                                                 164 {
118         YYSTYPE *yylval = parse_events_get_lva    165         YYSTYPE *yylval = parse_events_get_lval(scanner);
119                                                   166 
120         yylval->num = (type << 16) + config;      167         yylval->num = (type << 16) + config;
121         return type == PERF_TYPE_HARDWARE ? PE    168         return type == PERF_TYPE_HARDWARE ? PE_VALUE_SYM_HW : PE_VALUE_SYM_SW;
122 }                                                 169 }
123                                                   170 
124 static int tool(yyscan_t scanner, enum perf_to    171 static int tool(yyscan_t scanner, enum perf_tool_event event)
125 {                                                 172 {
126         YYSTYPE *yylval = parse_events_get_lva    173         YYSTYPE *yylval = parse_events_get_lval(scanner);
127                                                   174 
128         yylval->num = event;                      175         yylval->num = event;
129         return PE_VALUE_SYM_TOOL;                 176         return PE_VALUE_SYM_TOOL;
130 }                                                 177 }
131                                                   178 
132 static int term(yyscan_t scanner, enum parse_e !! 179 static int term(yyscan_t scanner, int type)
133 {                                                 180 {
134         YYSTYPE *yylval = parse_events_get_lva    181         YYSTYPE *yylval = parse_events_get_lval(scanner);
135                                                   182 
136         yylval->term_type = type;              !! 183         yylval->num = type;
137         return PE_TERM;                           184         return PE_TERM;
138 }                                                 185 }
139                                                   186 
140 static int hw_term(yyscan_t scanner, int confi << 
141 {                                              << 
142         YYSTYPE *yylval = parse_events_get_lva << 
143         char *text = parse_events_get_text(sca << 
144                                                << 
145         yylval->hardware_term.str = strdup(tex << 
146         yylval->hardware_term.num = PERF_TYPE_ << 
147         return PE_TERM_HW;                     << 
148 }                                              << 
149                                                << 
150 static void modifiers_error(struct parse_event << 
151                             int pos, char mod_ << 
152 {                                              << 
153         struct parse_events_error *error = par << 
154         char *help = NULL;                     << 
155                                                << 
156         if (asprintf(&help, "Duplicate modifie << 
157                 parse_events_error__handle(err << 
158 }                                              << 
159                                                << 
160 static int modifiers(struct parse_events_state << 
161 {                                              << 
162         YYSTYPE *yylval = parse_events_get_lva << 
163         char *text = parse_events_get_text(sca << 
164         struct parse_events_modifier mod = { . << 
165                                                << 
166         for (size_t i = 0, n = strlen(text); i << 
167 #define CASE(c, field)                         << 
168                 case c:                        << 
169                         if (mod.field) {       << 
170                                 modifiers_erro << 
171                                 return PE_ERRO << 
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  << 
189                          *  1 - SAMPLE_IP must << 
190                          *  2 - SAMPLE_IP requ << 
191                          *  3 - SAMPLE_IP must << 
192                          *                     << 
193                          *  See also PERF_RECO << 
194                          */                    << 
195                         if (mod.precise > 3) { << 
196                                 struct parse_e << 
197                                 char *help = s << 
198                                                << 
199                                 if (help) {    << 
200                                         parse_ << 
201                                                << 
202                                 }              << 
203                                 return PE_ERRO << 
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                 CASE('R', retire_lat);         << 
213                 default:                       << 
214                         return PE_ERROR;       << 
215                 }                              << 
216 #undef CASE                                    << 
217         }                                      << 
218         yylval->mod = mod;                     << 
219         return PE_MODIFIER_EVENT;              << 
220 }                                              << 
221                                                << 
222 #define YY_USER_ACTION                            187 #define YY_USER_ACTION                                  \
223 do {                                              188 do {                                                    \
224         yylloc->last_column  = yylloc->first_c    189         yylloc->last_column  = yylloc->first_column;    \
225         yylloc->first_column = yycolumn;          190         yylloc->first_column = yycolumn;                \
226         yycolumn += yyleng;                       191         yycolumn += yyleng;                             \
227 } while (0);                                      192 } while (0);
228                                                   193 
229 #define USER_REJECT             \                 194 #define USER_REJECT             \
230         yycolumn -= yyleng;     \                 195         yycolumn -= yyleng;     \
231         REJECT                                    196         REJECT
232                                                   197 
233 %}                                                198 %}
234                                                   199 
235 %x mem                                            200 %x mem
236 %s config                                         201 %s config
237 %x event                                          202 %x event
                                                   >> 203 %x array
238                                                   204 
239 group           [^,{}/]*[{][^}]*[}][^,{}/]*       205 group           [^,{}/]*[{][^}]*[}][^,{}/]*
240 event_pmu       [^,{}/]+[/][^/]*[/][^,{}/]*       206 event_pmu       [^,{}/]+[/][^/]*[/][^,{}/]*
241 event           [^,{}/]+                          207 event           [^,{}/]+
                                                   >> 208 bpf_object      [^,{}]+\.(o|bpf)[a-zA-Z0-9._]*
                                                   >> 209 bpf_source      [^,{}]+\.c[a-zA-Z0-9._]*
242                                                   210 
243 num_dec         [0-9]+                            211 num_dec         [0-9]+
244 num_hex         0x[a-fA-F0-9]{1,16}            !! 212 num_hex         0x[a-fA-F0-9]+
245 num_raw_hex     [a-fA-F0-9]{1,16}              !! 213 num_raw_hex     [a-fA-F0-9]+
246 name            [a-zA-Z0-9_*?\[\]][a-zA-Z0-9_* !! 214 name            [a-zA-Z_*?\[\]][a-zA-Z0-9_*?.\[\]!]*
247 name_tag        [\'][a-zA-Z0-9_*?\[\]][a-zA-Z0 !! 215 name_tag        [\'][a-zA-Z_*?\[\]][a-zA-Z0-9_*?\-,\.\[\]:=]*[\']
248 name_minus      [a-zA-Z_*?][a-zA-Z0-9\-_*?.:]*    216 name_minus      [a-zA-Z_*?][a-zA-Z0-9\-_*?.:]*
249 drv_cfg_term    [a-zA-Z0-9_\.]+(=[a-zA-Z0-9_*?    217 drv_cfg_term    [a-zA-Z0-9_\.]+(=[a-zA-Z0-9_*?\.:]+)?
250 /*                                             !! 218 /* If you add a modifier you need to update check_modifier() */
251  * If you add a modifier you need to update ch !! 219 modifier_event  [ukhpPGHSDIWeb]+
252  * Also, the letters in modifier_event must no << 
253  */                                            << 
254 modifier_event  [ukhpPGHSDIWebR]{1,16}         << 
255 modifier_bp     [rwx]{1,3}                        220 modifier_bp     [rwx]{1,3}
256 lc_type         (L1-dcache|l1-d|l1d|L1-data|L1 << 
257 lc_op_result    (load|loads|read|store|stores| << 
258 digit           [0-9]                          << 
259 non_digit       [^0-9]                         << 
260                                                   221 
261 %%                                                222 %%
262                                                   223 
263 %{                                                224 %{
264         struct parse_events_state *_parse_stat    225         struct parse_events_state *_parse_state = parse_events_get_extra(yyscanner);
                                                   >> 226 
265         {                                         227         {
266                 int start_token = _parse_state    228                 int start_token = _parse_state->stoken;
267                                                   229 
268                 if (start_token == PE_START_TE    230                 if (start_token == PE_START_TERMS)
269                         BEGIN(config);            231                         BEGIN(config);
270                 else if (start_token == PE_STA    232                 else if (start_token == PE_START_EVENTS)
271                         BEGIN(event);             233                         BEGIN(event);
272                                                   234 
273                 if (start_token) {                235                 if (start_token) {
274                         _parse_state->stoken =    236                         _parse_state->stoken = 0;
275                         /*                        237                         /*
276                          * The flex parser doe    238                          * The flex parser does not init locations variable
277                          * via the scan_string    239                          * via the scan_string interface, so we need do the
278                          * init in here.          240                          * init in here.
279                          */                       241                          */
280                         yycolumn = 0;             242                         yycolumn = 0;
281                         return start_token;       243                         return start_token;
282                 }                                 244                 }
283          }                                        245          }
284 %}                                                246 %}
285                                                   247 
286 <event>{                                          248 <event>{
287                                                   249 
288 {group}         {                                 250 {group}         {
289                         BEGIN(INITIAL);           251                         BEGIN(INITIAL);
290                         REWIND(0);                252                         REWIND(0);
291                 }                                 253                 }
292                                                   254 
293 {event_pmu}     |                                 255 {event_pmu}     |
                                                   >> 256 {bpf_object}    |
                                                   >> 257 {bpf_source}    |
294 {event}         {                                 258 {event}         {
295                         BEGIN(INITIAL);           259                         BEGIN(INITIAL);
296                         REWIND(1);                260                         REWIND(1);
297                         return PE_EVENT_NAME;     261                         return PE_EVENT_NAME;
298                 }                                 262                 }
299                                                   263 
300 <<EOF>>         {                                 264 <<EOF>>         {
301                         BEGIN(INITIAL);           265                         BEGIN(INITIAL);
302                         REWIND(0);                266                         REWIND(0);
303                 }                                 267                 }
304 ,               {                                 268 ,               {
305                         return ',';               269                         return ',';
306                 }                                 270                 }
307 }                                                 271 }
308                                                   272 
                                                   >> 273 <array>{
                                                   >> 274 "]"                     { BEGIN(config); return ']'; }
                                                   >> 275 {num_dec}               { return value(yyscanner, 10); }
                                                   >> 276 {num_hex}               { return value(yyscanner, 16); }
                                                   >> 277 ,                       { return ','; }
                                                   >> 278 "\.\.\."                { return PE_ARRAY_RANGE; }
                                                   >> 279 }
                                                   >> 280 
309 <config>{                                         281 <config>{
310         /*                                        282         /*
311          * Please update config_term_names whe    283          * Please update config_term_names when new static term is added.
312          */                                       284          */
313 config                  { return term(yyscanne    285 config                  { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_CONFIG); }
314 config1                 { return term(yyscanne    286 config1                 { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_CONFIG1); }
315 config2                 { return term(yyscanne    287 config2                 { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_CONFIG2); }
316 config3                 { return term(yyscanne    288 config3                 { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_CONFIG3); }
317 name                    { return term(yyscanne    289 name                    { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_NAME); }
318 period                  { return term(yyscanne    290 period                  { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD); }
319 freq                    { return term(yyscanne    291 freq                    { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_SAMPLE_FREQ); }
320 branch_type             { return term(yyscanne    292 branch_type             { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE); }
321 time                    { return term(yyscanne    293 time                    { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_TIME); }
322 call-graph              { return term(yyscanne    294 call-graph              { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_CALLGRAPH); }
323 stack-size              { return term(yyscanne    295 stack-size              { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_STACKSIZE); }
324 max-stack               { return term(yyscanne    296 max-stack               { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_MAX_STACK); }
325 nr                      { return term(yyscanne    297 nr                      { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_MAX_EVENTS); }
326 inherit                 { return term(yyscanne    298 inherit                 { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_INHERIT); }
327 no-inherit              { return term(yyscanne    299 no-inherit              { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_NOINHERIT); }
328 overwrite               { return term(yyscanne    300 overwrite               { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_OVERWRITE); }
329 no-overwrite            { return term(yyscanne    301 no-overwrite            { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_NOOVERWRITE); }
330 percore                 { return term(yyscanne    302 percore                 { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_PERCORE); }
331 aux-output              { return term(yyscanne    303 aux-output              { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_AUX_OUTPUT); }
332 aux-sample-size         { return term(yyscanne    304 aux-sample-size         { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE); }
333 metric-id               { return term(yyscanne    305 metric-id               { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_METRIC_ID); }
334 cpu-cycles|cycles                              !! 306 r{num_raw_hex}          { return raw(yyscanner); }
335 stalled-cycles-frontend|idle-cycles-frontend   !! 307 r0x{num_raw_hex}        { return raw(yyscanner); }
336 stalled-cycles-backend|idle-cycles-backend     << 
337 instructions                                   << 
338 cache-references                               << 
339 cache-misses                                   << 
340 branch-instructions|branches                   << 
341 branch-misses                                  << 
342 bus-cycles                                     << 
343 ref-cycles                                     << 
344 r{num_raw_hex}          { return str(yyscanner << 
345 r0x{num_raw_hex}        { return str(yyscanner << 
346 ,                       { return ','; }           308 ,                       { return ','; }
347 "/"                     { BEGIN(INITIAL); retu    309 "/"                     { BEGIN(INITIAL); return '/'; }
348 {lc_type}                       { return lc_st << 
349 {lc_type}-{lc_op_result}        { return lc_st << 
350 {lc_type}-{lc_op_result}-{lc_op_result} { retu << 
351 {name_minus}            { return str(yyscanner    310 {name_minus}            { return str(yyscanner, PE_NAME); }
                                                   >> 311 \[all\]                 { return PE_ARRAY_ALL; }
                                                   >> 312 "["                     { BEGIN(array); return '['; }
352 @{drv_cfg_term}         { return drv_str(yysca    313 @{drv_cfg_term}         { return drv_str(yyscanner, PE_DRV_CFG_TERM); }
353 }                                                 314 }
354                                                   315 
355 <mem>{                                            316 <mem>{
356 {modifier_bp}           { return str(yyscanner    317 {modifier_bp}           { return str(yyscanner, PE_MODIFIER_BP); }
357         /*                                     !! 318 :                       { return ':'; }
358          * The colon before memory access modi !! 319 "/"                     { return '/'; }
359          * colon before event modifiers. Fortu !! 320 {num_dec}               { return value(yyscanner, 10); }
360          * are the same, so trailing context c !! 321 {num_hex}               { return value(yyscanner, 16); }
361          * cases.                              << 
362          */                                    << 
363 ":"/{modifier_bp}       { return PE_BP_COLON;  << 
364         /*                                     << 
365          * The slash before memory length can  << 
366          * config terms. Fortunately config te << 
367          * digit, so trailing context can be u << 
368          */                                    << 
369 "/"/{digit}             { return PE_BP_SLASH;  << 
370 "/"/{non_digit}         { BEGIN(config); retur << 
371 {num_dec}               { return value(_parse_ << 
372 {num_hex}               { return value(_parse_ << 
373         /*                                        322         /*
374          * We need to separate 'mem:' scanner     323          * We need to separate 'mem:' scanner part, in order to get specific
375          * modifier bits parsed out. Otherwise    324          * modifier bits parsed out. Otherwise we would need to handle PE_NAME
376          * and we'd need to parse it manually.    325          * and we'd need to parse it manually. During the escape from <mem>
377          * state we need to put the escaping c    326          * state we need to put the escaping char back, so we dont miss it.
378          */                                       327          */
379 .                       { unput(*yytext); BEGI    328 .                       { unput(*yytext); BEGIN(INITIAL); }
380         /*                                        329         /*
381          * We destroy the scanner after reachi    330          * We destroy the scanner after reaching EOF,
382          * but anyway just to be sure get back    331          * but anyway just to be sure get back to INIT state.
383          */                                       332          */
384 <<EOF>>                 { BEGIN(INITIAL); }       333 <<EOF>>                 { BEGIN(INITIAL); }
385 }                                                 334 }
386                                                   335 
387 cpu-cycles|cycles                                 336 cpu-cycles|cycles                               { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES); }
388 stalled-cycles-frontend|idle-cycles-frontend      337 stalled-cycles-frontend|idle-cycles-frontend    { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND); }
389 stalled-cycles-backend|idle-cycles-backend        338 stalled-cycles-backend|idle-cycles-backend      { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_BACKEND); }
390 instructions                                      339 instructions                                    { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS); }
391 cache-references                                  340 cache-references                                { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_REFERENCES); }
392 cache-misses                                      341 cache-misses                                    { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES); }
393 branch-instructions|branches                      342 branch-instructions|branches                    { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_INSTRUCTIONS); }
394 branch-misses                                     343 branch-misses                                   { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_MISSES); }
395 bus-cycles                                        344 bus-cycles                                      { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_BUS_CYCLES); }
396 ref-cycles                                        345 ref-cycles                                      { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_REF_CPU_CYCLES); }
397 cpu-clock                                         346 cpu-clock                                       { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_CLOCK); }
398 task-clock                                        347 task-clock                                      { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK); }
399 page-faults|faults                                348 page-faults|faults                              { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS); }
400 minor-faults                                      349 minor-faults                                    { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MIN); }
401 major-faults                                      350 major-faults                                    { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MAJ); }
402 context-switches|cs                               351 context-switches|cs                             { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CONTEXT_SWITCHES); }
403 cpu-migrations|migrations                         352 cpu-migrations|migrations                       { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_MIGRATIONS); }
404 alignment-faults                                  353 alignment-faults                                { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_ALIGNMENT_FAULTS); }
405 emulation-faults                                  354 emulation-faults                                { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_EMULATION_FAULTS); }
406 dummy                                             355 dummy                                           { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_DUMMY); }
407 duration_time                                     356 duration_time                                   { return tool(yyscanner, PERF_TOOL_DURATION_TIME); }
408 user_time                                         357 user_time                                               { return tool(yyscanner, PERF_TOOL_USER_TIME); }
409 system_time                                       358 system_time                                             { return tool(yyscanner, PERF_TOOL_SYSTEM_TIME); }
410 bpf-output                                        359 bpf-output                                      { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_BPF_OUTPUT); }
411 cgroup-switches                                   360 cgroup-switches                                 { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CGROUP_SWITCHES); }
412                                                   361 
413 {lc_type}                       { return str(y !! 362         /*
414 {lc_type}-{lc_op_result}        { return str(y !! 363          * We have to handle the kernel PMU event cycles-ct/cycles-t/mem-loads/mem-stores separately.
415 {lc_type}-{lc_op_result}-{lc_op_result} { retu !! 364          * Because the prefix cycles is mixed up with cpu-cycles.
416 mem:                    { BEGIN(mem); return P !! 365          * loads and stores are mixed up with cache event
417 r{num_raw_hex}          { return str(yyscanner !! 366          */
418 {num_dec}               { return value(_parse_ !! 367 cycles-ct                               |
419 {num_hex}               { return value(_parse_ !! 368 cycles-t                                |
                                                   >> 369 mem-loads                               |
                                                   >> 370 mem-loads-aux                           |
                                                   >> 371 mem-stores                              |
                                                   >> 372 topdown-[a-z-]+                         |
                                                   >> 373 tx-capacity-[a-z-]+                     |
                                                   >> 374 el-capacity-[a-z-]+                     { return str(yyscanner, PE_KERNEL_PMU_EVENT); }
                                                   >> 375 
                                                   >> 376 L1-dcache|l1-d|l1d|L1-data              |
                                                   >> 377 L1-icache|l1-i|l1i|L1-instruction       |
                                                   >> 378 LLC|L2                                  |
                                                   >> 379 dTLB|d-tlb|Data-TLB                     |
                                                   >> 380 iTLB|i-tlb|Instruction-TLB              |
                                                   >> 381 branch|branches|bpu|btb|bpc             |
                                                   >> 382 node                                    { return str(yyscanner, PE_NAME_CACHE_TYPE); }
                                                   >> 383 
                                                   >> 384 load|loads|read                         |
                                                   >> 385 store|stores|write                      |
                                                   >> 386 prefetch|prefetches                     |
                                                   >> 387 speculative-read|speculative-load       |
                                                   >> 388 refs|Reference|ops|access               |
                                                   >> 389 misses|miss                             { return str(yyscanner, PE_NAME_CACHE_OP_RESULT); }
420                                                   390 
421 {modifier_event}        { return modifiers(_pa !! 391 mem:                    { BEGIN(mem); return PE_PREFIX_MEM; }
422 {name}                  { return str(yyscanner !! 392 r{num_raw_hex}          { return raw(yyscanner); }
                                                   >> 393 {num_dec}               { return value(yyscanner, 10); }
                                                   >> 394 {num_hex}               { return value(yyscanner, 16); }
                                                   >> 395 
                                                   >> 396 {modifier_event}        { return str(yyscanner, PE_MODIFIER_EVENT); }
                                                   >> 397 {bpf_object}            { if (!isbpf(yyscanner)) { USER_REJECT }; return str(yyscanner, PE_BPF_OBJECT); }
                                                   >> 398 {bpf_source}            { if (!isbpf(yyscanner)) { USER_REJECT }; return str(yyscanner, PE_BPF_SOURCE); }
                                                   >> 399 {name}                  { return pmu_str_check(yyscanner, _parse_state); }
423 {name_tag}              { return str(yyscanner    400 {name_tag}              { return str(yyscanner, PE_NAME); }
424 "/"                     { BEGIN(config); retur    401 "/"                     { BEGIN(config); return '/'; }
                                                   >> 402 -                       { return '-'; }
425 ,                       { BEGIN(event); return    403 ,                       { BEGIN(event); return ','; }
426 :                       { return ':'; }           404 :                       { return ':'; }
427 "{"                     { BEGIN(event); return    405 "{"                     { BEGIN(event); return '{'; }
428 "}"                     { return '}'; }           406 "}"                     { return '}'; }
429 =                       { return '='; }           407 =                       { return '='; }
430 \n                      { }                       408 \n                      { }
431 .                       { }                       409 .                       { }
432                                                   410 
433 %%                                                411 %%
434                                                   412 
435 int parse_events_wrap(void *scanner __maybe_un    413 int parse_events_wrap(void *scanner __maybe_unused)
436 {                                                 414 {
437         return 1;                                 415         return 1;
438 }                                                 416 }
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php