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