Zheng Yan | ac20de6f | 2012-06-15 14:31:39 +0800 | [diff] [blame] | 1 | %pure-parser |
Jiri Olsa | 46010ab | 2012-06-15 14:31:38 +0800 | [diff] [blame] | 2 | %parse-param {void *_data} |
Zheng Yan | ac20de6f | 2012-06-15 14:31:39 +0800 | [diff] [blame] | 3 | %parse-param {void *scanner} |
| 4 | %lex-param {void* scanner} |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 5 | |
| 6 | %{ |
| 7 | |
| 8 | #define YYDEBUG 1 |
| 9 | |
| 10 | #include <linux/compiler.h> |
| 11 | #include <linux/list.h> |
Borislav Petkov | d944c4e | 2014-04-25 21:31:02 +0200 | [diff] [blame] | 12 | #include <linux/types.h> |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 13 | #include "util.h" |
| 14 | #include "parse-events.h" |
Zheng Yan | ac20de6f | 2012-06-15 14:31:39 +0800 | [diff] [blame] | 15 | #include "parse-events-bison.h" |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 16 | |
Zheng Yan | ac20de6f | 2012-06-15 14:31:39 +0800 | [diff] [blame] | 17 | extern int parse_events_lex (YYSTYPE* lvalp, void* scanner); |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 18 | |
| 19 | #define ABORT_ON(val) \ |
| 20 | do { \ |
| 21 | if (val) \ |
| 22 | YYABORT; \ |
| 23 | } while (0) |
| 24 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 25 | #define ALLOC_LIST(list) \ |
| 26 | do { \ |
| 27 | list = malloc(sizeof(*list)); \ |
| 28 | ABORT_ON(!list); \ |
| 29 | INIT_LIST_HEAD(list); \ |
| 30 | } while (0) |
| 31 | |
Namhyung Kim | 97f63e4 | 2013-01-22 18:09:29 +0900 | [diff] [blame] | 32 | static inc_group_count(struct list_head *list, |
| 33 | struct parse_events_evlist *data) |
| 34 | { |
| 35 | /* Count groups only have more than 1 members */ |
| 36 | if (!list_is_last(list->next, list)) |
| 37 | data->nr_groups++; |
| 38 | } |
| 39 | |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 40 | %} |
| 41 | |
Jiri Olsa | 90e2b22 | 2012-06-15 14:31:40 +0800 | [diff] [blame] | 42 | %token PE_START_EVENTS PE_START_TERMS |
Jiri Olsa | cf3506d | 2012-07-04 00:00:43 +0200 | [diff] [blame] | 43 | %token PE_VALUE PE_VALUE_SYM_HW PE_VALUE_SYM_SW PE_RAW PE_TERM |
Robert Richter | ac2ba9f | 2012-08-16 21:10:21 +0200 | [diff] [blame] | 44 | %token PE_EVENT_NAME |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 45 | %token PE_NAME |
| 46 | %token PE_MODIFIER_EVENT PE_MODIFIER_BP |
| 47 | %token PE_NAME_CACHE_TYPE PE_NAME_CACHE_OP_RESULT |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 48 | %token PE_PREFIX_MEM PE_PREFIX_RAW PE_PREFIX_GROUP |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 49 | %token PE_ERROR |
Kan Liang | ba32a45 | 2014-10-07 11:08:51 -0400 | [diff] [blame] | 50 | %token PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 51 | %type <num> PE_VALUE |
Jiri Olsa | cf3506d | 2012-07-04 00:00:43 +0200 | [diff] [blame] | 52 | %type <num> PE_VALUE_SYM_HW |
| 53 | %type <num> PE_VALUE_SYM_SW |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 54 | %type <num> PE_RAW |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 55 | %type <num> PE_TERM |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 56 | %type <str> PE_NAME |
| 57 | %type <str> PE_NAME_CACHE_TYPE |
| 58 | %type <str> PE_NAME_CACHE_OP_RESULT |
| 59 | %type <str> PE_MODIFIER_EVENT |
| 60 | %type <str> PE_MODIFIER_BP |
Robert Richter | ac2ba9f | 2012-08-16 21:10:21 +0200 | [diff] [blame] | 61 | %type <str> PE_EVENT_NAME |
Kan Liang | ba32a45 | 2014-10-07 11:08:51 -0400 | [diff] [blame] | 62 | %type <str> PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT |
Jiri Olsa | cf3506d | 2012-07-04 00:00:43 +0200 | [diff] [blame] | 63 | %type <num> value_sym |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 64 | %type <head> event_config |
| 65 | %type <term> event_term |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 66 | %type <head> event_pmu |
| 67 | %type <head> event_legacy_symbol |
| 68 | %type <head> event_legacy_cache |
| 69 | %type <head> event_legacy_mem |
| 70 | %type <head> event_legacy_tracepoint |
| 71 | %type <head> event_legacy_numeric |
| 72 | %type <head> event_legacy_raw |
| 73 | %type <head> event_def |
Robert Richter | ac2ba9f | 2012-08-16 21:10:21 +0200 | [diff] [blame] | 74 | %type <head> event_mod |
| 75 | %type <head> event_name |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 76 | %type <head> event |
| 77 | %type <head> events |
| 78 | %type <head> group_def |
| 79 | %type <head> group |
| 80 | %type <head> groups |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 81 | |
| 82 | %union |
| 83 | { |
| 84 | char *str; |
Robert Richter | b527bab | 2012-08-07 19:43:13 +0200 | [diff] [blame] | 85 | u64 num; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 86 | struct list_head *head; |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 87 | struct parse_events_term *term; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 88 | } |
| 89 | %% |
| 90 | |
Jiri Olsa | 90e2b22 | 2012-06-15 14:31:40 +0800 | [diff] [blame] | 91 | start: |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 92 | PE_START_EVENTS start_events |
Jiri Olsa | 90e2b22 | 2012-06-15 14:31:40 +0800 | [diff] [blame] | 93 | | |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 94 | PE_START_TERMS start_terms |
| 95 | |
| 96 | start_events: groups |
| 97 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 98 | struct parse_events_evlist *data = _data; |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 99 | |
| 100 | parse_events_update_lists($1, &data->list); |
| 101 | } |
| 102 | |
| 103 | groups: |
| 104 | groups ',' group |
| 105 | { |
| 106 | struct list_head *list = $1; |
| 107 | struct list_head *group = $3; |
| 108 | |
| 109 | parse_events_update_lists(group, list); |
| 110 | $$ = list; |
| 111 | } |
| 112 | | |
| 113 | groups ',' event |
| 114 | { |
| 115 | struct list_head *list = $1; |
| 116 | struct list_head *event = $3; |
| 117 | |
| 118 | parse_events_update_lists(event, list); |
| 119 | $$ = list; |
| 120 | } |
| 121 | | |
| 122 | group |
| 123 | | |
| 124 | event |
| 125 | |
| 126 | group: |
| 127 | group_def ':' PE_MODIFIER_EVENT |
| 128 | { |
| 129 | struct list_head *list = $1; |
| 130 | |
| 131 | ABORT_ON(parse_events__modifier_group(list, $3)); |
| 132 | $$ = list; |
| 133 | } |
| 134 | | |
| 135 | group_def |
| 136 | |
| 137 | group_def: |
| 138 | PE_NAME '{' events '}' |
| 139 | { |
| 140 | struct list_head *list = $3; |
| 141 | |
Namhyung Kim | 97f63e4 | 2013-01-22 18:09:29 +0900 | [diff] [blame] | 142 | inc_group_count(list, _data); |
Arnaldo Carvalho de Melo | 63dab22 | 2012-08-14 16:35:48 -0300 | [diff] [blame] | 143 | parse_events__set_leader($1, list); |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 144 | $$ = list; |
| 145 | } |
| 146 | | |
| 147 | '{' events '}' |
| 148 | { |
| 149 | struct list_head *list = $2; |
| 150 | |
Namhyung Kim | 97f63e4 | 2013-01-22 18:09:29 +0900 | [diff] [blame] | 151 | inc_group_count(list, _data); |
Arnaldo Carvalho de Melo | 63dab22 | 2012-08-14 16:35:48 -0300 | [diff] [blame] | 152 | parse_events__set_leader(NULL, list); |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 153 | $$ = list; |
| 154 | } |
Jiri Olsa | 90e2b22 | 2012-06-15 14:31:40 +0800 | [diff] [blame] | 155 | |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 156 | events: |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 157 | events ',' event |
| 158 | { |
| 159 | struct list_head *event = $3; |
| 160 | struct list_head *list = $1; |
| 161 | |
| 162 | parse_events_update_lists(event, list); |
| 163 | $$ = list; |
| 164 | } |
| 165 | | |
| 166 | event |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 167 | |
Robert Richter | ac2ba9f | 2012-08-16 21:10:21 +0200 | [diff] [blame] | 168 | event: event_mod |
| 169 | |
| 170 | event_mod: |
| 171 | event_name PE_MODIFIER_EVENT |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 172 | { |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 173 | struct list_head *list = $1; |
Jiri Olsa | 46010ab | 2012-06-15 14:31:38 +0800 | [diff] [blame] | 174 | |
Jiri Olsa | 5d7be90 | 2012-03-20 19:15:40 +0100 | [diff] [blame] | 175 | /* |
| 176 | * Apply modifier on all events added by single event definition |
| 177 | * (there could be more events added for multiple tracepoint |
| 178 | * definitions via '*?'. |
| 179 | */ |
Jiri Olsa | f5b1135 | 2012-08-08 12:21:54 +0200 | [diff] [blame] | 180 | ABORT_ON(parse_events__modifier_event(list, $2, false)); |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 181 | $$ = list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 182 | } |
| 183 | | |
Robert Richter | ac2ba9f | 2012-08-16 21:10:21 +0200 | [diff] [blame] | 184 | event_name |
| 185 | |
| 186 | event_name: |
| 187 | PE_EVENT_NAME event_def |
| 188 | { |
| 189 | ABORT_ON(parse_events_name($2, $1)); |
| 190 | free($1); |
| 191 | $$ = $2; |
| 192 | } |
| 193 | | |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 194 | event_def |
| 195 | |
Jiri Olsa | 5f537a2 | 2012-03-15 20:09:18 +0100 | [diff] [blame] | 196 | event_def: event_pmu | |
| 197 | event_legacy_symbol | |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 198 | event_legacy_cache sep_dc | |
| 199 | event_legacy_mem | |
| 200 | event_legacy_tracepoint sep_dc | |
| 201 | event_legacy_numeric sep_dc | |
| 202 | event_legacy_raw sep_dc |
| 203 | |
Jiri Olsa | 5f537a2 | 2012-03-15 20:09:18 +0100 | [diff] [blame] | 204 | event_pmu: |
| 205 | PE_NAME '/' event_config '/' |
| 206 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 207 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 208 | struct list_head *list; |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 209 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 210 | ALLOC_LIST(list); |
| 211 | ABORT_ON(parse_events_add_pmu(list, &data->idx, $1, $3)); |
Jiri Olsa | 5f537a2 | 2012-03-15 20:09:18 +0100 | [diff] [blame] | 212 | parse_events__free_terms($3); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 213 | $$ = list; |
Jiri Olsa | 5f537a2 | 2012-03-15 20:09:18 +0100 | [diff] [blame] | 214 | } |
Adrian Hunter | ad96227 | 2014-08-15 22:08:40 +0300 | [diff] [blame] | 215 | | |
| 216 | PE_NAME '/' '/' |
| 217 | { |
| 218 | struct parse_events_evlist *data = _data; |
| 219 | struct list_head *list; |
| 220 | |
| 221 | ALLOC_LIST(list); |
| 222 | ABORT_ON(parse_events_add_pmu(list, &data->idx, $1, NULL)); |
| 223 | $$ = list; |
| 224 | } |
Kan Liang | ba32a45 | 2014-10-07 11:08:51 -0400 | [diff] [blame] | 225 | | |
| 226 | PE_KERNEL_PMU_EVENT sep_dc |
| 227 | { |
| 228 | struct parse_events_evlist *data = _data; |
| 229 | struct list_head *head; |
| 230 | struct parse_events_term *term; |
| 231 | struct list_head *list; |
| 232 | |
| 233 | ALLOC_LIST(head); |
| 234 | ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, |
| 235 | $1, 1)); |
| 236 | list_add_tail(&term->list, head); |
| 237 | |
| 238 | ALLOC_LIST(list); |
| 239 | ABORT_ON(parse_events_add_pmu(list, &data->idx, "cpu", head)); |
| 240 | parse_events__free_terms(head); |
| 241 | $$ = list; |
| 242 | } |
| 243 | | |
| 244 | PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc |
| 245 | { |
| 246 | struct parse_events_evlist *data = _data; |
| 247 | struct list_head *head; |
| 248 | struct parse_events_term *term; |
| 249 | struct list_head *list; |
| 250 | char pmu_name[128]; |
| 251 | snprintf(&pmu_name, 128, "%s-%s", $1, $3); |
| 252 | |
| 253 | ALLOC_LIST(head); |
| 254 | ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, |
| 255 | &pmu_name, 1)); |
| 256 | list_add_tail(&term->list, head); |
| 257 | |
| 258 | ALLOC_LIST(list); |
| 259 | ABORT_ON(parse_events_add_pmu(list, &data->idx, "cpu", head)); |
| 260 | parse_events__free_terms(head); |
| 261 | $$ = list; |
| 262 | } |
Jiri Olsa | 5f537a2 | 2012-03-15 20:09:18 +0100 | [diff] [blame] | 263 | |
Jiri Olsa | cf3506d | 2012-07-04 00:00:43 +0200 | [diff] [blame] | 264 | value_sym: |
| 265 | PE_VALUE_SYM_HW |
| 266 | | |
| 267 | PE_VALUE_SYM_SW |
| 268 | |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 269 | event_legacy_symbol: |
Jiri Olsa | cf3506d | 2012-07-04 00:00:43 +0200 | [diff] [blame] | 270 | value_sym '/' event_config '/' |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 271 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 272 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 273 | struct list_head *list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 274 | int type = $1 >> 16; |
| 275 | int config = $1 & 255; |
| 276 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 277 | ALLOC_LIST(list); |
| 278 | ABORT_ON(parse_events_add_numeric(list, &data->idx, |
Jiri Olsa | 46010ab | 2012-06-15 14:31:38 +0800 | [diff] [blame] | 279 | type, config, $3)); |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 280 | parse_events__free_terms($3); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 281 | $$ = list; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 282 | } |
| 283 | | |
Jiri Olsa | cf3506d | 2012-07-04 00:00:43 +0200 | [diff] [blame] | 284 | value_sym sep_slash_dc |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 285 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 286 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 287 | struct list_head *list; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 288 | int type = $1 >> 16; |
| 289 | int config = $1 & 255; |
| 290 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 291 | ALLOC_LIST(list); |
| 292 | ABORT_ON(parse_events_add_numeric(list, &data->idx, |
Jiri Olsa | 46010ab | 2012-06-15 14:31:38 +0800 | [diff] [blame] | 293 | type, config, NULL)); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 294 | $$ = list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 295 | } |
| 296 | |
| 297 | event_legacy_cache: |
| 298 | PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT |
| 299 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 300 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 301 | struct list_head *list; |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 302 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 303 | ALLOC_LIST(list); |
| 304 | ABORT_ON(parse_events_add_cache(list, &data->idx, $1, $3, $5)); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 305 | $$ = list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 306 | } |
| 307 | | |
| 308 | PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT |
| 309 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 310 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 311 | struct list_head *list; |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 312 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 313 | ALLOC_LIST(list); |
| 314 | ABORT_ON(parse_events_add_cache(list, &data->idx, $1, $3, NULL)); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 315 | $$ = list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 316 | } |
| 317 | | |
| 318 | PE_NAME_CACHE_TYPE |
| 319 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 320 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 321 | struct list_head *list; |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 322 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 323 | ALLOC_LIST(list); |
| 324 | ABORT_ON(parse_events_add_cache(list, &data->idx, $1, NULL, NULL)); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 325 | $$ = list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 326 | } |
| 327 | |
| 328 | event_legacy_mem: |
Jacob Shin | 3741eb9 | 2014-05-29 17:26:51 +0200 | [diff] [blame] | 329 | PE_PREFIX_MEM PE_VALUE '/' PE_VALUE ':' PE_MODIFIER_BP sep_dc |
| 330 | { |
| 331 | struct parse_events_evlist *data = _data; |
| 332 | struct list_head *list; |
| 333 | |
| 334 | ALLOC_LIST(list); |
| 335 | ABORT_ON(parse_events_add_breakpoint(list, &data->idx, |
| 336 | (void *) $2, $6, $4)); |
| 337 | $$ = list; |
| 338 | } |
| 339 | | |
| 340 | PE_PREFIX_MEM PE_VALUE '/' PE_VALUE sep_dc |
| 341 | { |
| 342 | struct parse_events_evlist *data = _data; |
| 343 | struct list_head *list; |
| 344 | |
| 345 | ALLOC_LIST(list); |
| 346 | ABORT_ON(parse_events_add_breakpoint(list, &data->idx, |
| 347 | (void *) $2, NULL, $4)); |
| 348 | $$ = list; |
| 349 | } |
| 350 | | |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 351 | PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc |
| 352 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 353 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 354 | struct list_head *list; |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 355 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 356 | ALLOC_LIST(list); |
| 357 | ABORT_ON(parse_events_add_breakpoint(list, &data->idx, |
Jacob Shin | 3741eb9 | 2014-05-29 17:26:51 +0200 | [diff] [blame] | 358 | (void *) $2, $4, 0)); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 359 | $$ = list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 360 | } |
| 361 | | |
| 362 | PE_PREFIX_MEM PE_VALUE sep_dc |
| 363 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 364 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 365 | struct list_head *list; |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 366 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 367 | ALLOC_LIST(list); |
| 368 | ABORT_ON(parse_events_add_breakpoint(list, &data->idx, |
Jacob Shin | 3741eb9 | 2014-05-29 17:26:51 +0200 | [diff] [blame] | 369 | (void *) $2, NULL, 0)); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 370 | $$ = list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 371 | } |
| 372 | |
| 373 | event_legacy_tracepoint: |
Alexander Yarygin | 2b9032e | 2014-04-25 17:34:05 +0200 | [diff] [blame] | 374 | PE_NAME '-' PE_NAME ':' PE_NAME |
| 375 | { |
| 376 | struct parse_events_evlist *data = _data; |
| 377 | struct list_head *list; |
| 378 | char sys_name[128]; |
| 379 | snprintf(&sys_name, 128, "%s-%s", $1, $3); |
| 380 | |
| 381 | ALLOC_LIST(list); |
| 382 | ABORT_ON(parse_events_add_tracepoint(list, &data->idx, &sys_name, $5)); |
| 383 | $$ = list; |
| 384 | } |
| 385 | | |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 386 | PE_NAME ':' PE_NAME |
| 387 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 388 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 389 | struct list_head *list; |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 390 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 391 | ALLOC_LIST(list); |
| 392 | ABORT_ON(parse_events_add_tracepoint(list, &data->idx, $1, $3)); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 393 | $$ = list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 394 | } |
| 395 | |
| 396 | event_legacy_numeric: |
| 397 | PE_VALUE ':' PE_VALUE |
| 398 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 399 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 400 | struct list_head *list; |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 401 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 402 | ALLOC_LIST(list); |
| 403 | ABORT_ON(parse_events_add_numeric(list, &data->idx, (u32)$1, $3, NULL)); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 404 | $$ = list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 405 | } |
| 406 | |
| 407 | event_legacy_raw: |
| 408 | PE_RAW |
| 409 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 410 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 411 | struct list_head *list; |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 412 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 413 | ALLOC_LIST(list); |
| 414 | ABORT_ON(parse_events_add_numeric(list, &data->idx, |
Jiri Olsa | 46010ab | 2012-06-15 14:31:38 +0800 | [diff] [blame] | 415 | PERF_TYPE_RAW, $1, NULL)); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 416 | $$ = list; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 417 | } |
| 418 | |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 419 | start_terms: event_config |
Jiri Olsa | 90e2b22 | 2012-06-15 14:31:40 +0800 | [diff] [blame] | 420 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 421 | struct parse_events_terms *data = _data; |
Jiri Olsa | 90e2b22 | 2012-06-15 14:31:40 +0800 | [diff] [blame] | 422 | data->terms = $1; |
| 423 | } |
| 424 | |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 425 | event_config: |
| 426 | event_config ',' event_term |
| 427 | { |
| 428 | struct list_head *head = $1; |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 429 | struct parse_events_term *term = $3; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 430 | |
| 431 | ABORT_ON(!head); |
| 432 | list_add_tail(&term->list, head); |
| 433 | $$ = $1; |
| 434 | } |
| 435 | | |
| 436 | event_term |
| 437 | { |
| 438 | struct list_head *head = malloc(sizeof(*head)); |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 439 | struct parse_events_term *term = $1; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 440 | |
| 441 | ABORT_ON(!head); |
| 442 | INIT_LIST_HEAD(head); |
| 443 | list_add_tail(&term->list, head); |
| 444 | $$ = head; |
| 445 | } |
| 446 | |
| 447 | event_term: |
| 448 | PE_NAME '=' PE_NAME |
| 449 | { |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 450 | struct parse_events_term *term; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 451 | |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 452 | ABORT_ON(parse_events_term__str(&term, PARSE_EVENTS__TERM_TYPE_USER, |
Jiri Olsa | 16fa7e8 | 2012-04-25 18:24:57 +0200 | [diff] [blame] | 453 | $1, $3)); |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 454 | $$ = term; |
| 455 | } |
| 456 | | |
| 457 | PE_NAME '=' PE_VALUE |
| 458 | { |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 459 | struct parse_events_term *term; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 460 | |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 461 | ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, |
Jiri Olsa | 16fa7e8 | 2012-04-25 18:24:57 +0200 | [diff] [blame] | 462 | $1, $3)); |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 463 | $$ = term; |
| 464 | } |
| 465 | | |
Jiri Olsa | 1d33d6d | 2012-10-10 14:53:17 +0200 | [diff] [blame] | 466 | PE_NAME '=' PE_VALUE_SYM_HW |
| 467 | { |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 468 | struct parse_events_term *term; |
Jiri Olsa | 1d33d6d | 2012-10-10 14:53:17 +0200 | [diff] [blame] | 469 | int config = $3 & 255; |
| 470 | |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 471 | ABORT_ON(parse_events_term__sym_hw(&term, $1, config)); |
Jiri Olsa | 1d33d6d | 2012-10-10 14:53:17 +0200 | [diff] [blame] | 472 | $$ = term; |
| 473 | } |
| 474 | | |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 475 | PE_NAME |
| 476 | { |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 477 | struct parse_events_term *term; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 478 | |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 479 | ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, |
Jiri Olsa | 16fa7e8 | 2012-04-25 18:24:57 +0200 | [diff] [blame] | 480 | $1, 1)); |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 481 | $$ = term; |
| 482 | } |
| 483 | | |
Jiri Olsa | 1d33d6d | 2012-10-10 14:53:17 +0200 | [diff] [blame] | 484 | PE_VALUE_SYM_HW |
| 485 | { |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 486 | struct parse_events_term *term; |
Jiri Olsa | 1d33d6d | 2012-10-10 14:53:17 +0200 | [diff] [blame] | 487 | int config = $1 & 255; |
| 488 | |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 489 | ABORT_ON(parse_events_term__sym_hw(&term, NULL, config)); |
Jiri Olsa | 1d33d6d | 2012-10-10 14:53:17 +0200 | [diff] [blame] | 490 | $$ = term; |
| 491 | } |
| 492 | | |
Jiri Olsa | 6b5fc39 | 2012-05-21 09:12:53 +0200 | [diff] [blame] | 493 | PE_TERM '=' PE_NAME |
| 494 | { |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 495 | struct parse_events_term *term; |
Jiri Olsa | 6b5fc39 | 2012-05-21 09:12:53 +0200 | [diff] [blame] | 496 | |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 497 | ABORT_ON(parse_events_term__str(&term, (int)$1, NULL, $3)); |
Jiri Olsa | 6b5fc39 | 2012-05-21 09:12:53 +0200 | [diff] [blame] | 498 | $$ = term; |
| 499 | } |
| 500 | | |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 501 | PE_TERM '=' PE_VALUE |
| 502 | { |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 503 | struct parse_events_term *term; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 504 | |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 505 | ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, $3)); |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 506 | $$ = term; |
| 507 | } |
| 508 | | |
| 509 | PE_TERM |
| 510 | { |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 511 | struct parse_events_term *term; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 512 | |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 513 | ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, 1)); |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 514 | $$ = term; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 515 | } |
| 516 | |
| 517 | sep_dc: ':' | |
| 518 | |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 519 | sep_slash_dc: '/' | ':' | |
| 520 | |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 521 | %% |
| 522 | |
Irina Tirdea | 1d037ca | 2012-09-11 01:15:03 +0300 | [diff] [blame] | 523 | void parse_events_error(void *data __maybe_unused, void *scanner __maybe_unused, |
| 524 | char const *msg __maybe_unused) |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 525 | { |
| 526 | } |