2 %name-prefix "parse_events_"
3 %parse-param {struct list_head *list_all}
4 %parse-param {struct list_head *list_event}
5 %parse-param {int *idx}
11 #include <linux/compiler.h>
12 #include <linux/list.h>
15 #include "parse-events.h"
17 extern int parse_events_lex (void);
19 #define ABORT_ON(val) \
27 %token PE_VALUE PE_VALUE_SYM PE_RAW PE_TERM
29 %token PE_MODIFIER_EVENT PE_MODIFIER_BP
30 %token PE_NAME_CACHE_TYPE PE_NAME_CACHE_OP_RESULT
31 %token PE_PREFIX_MEM PE_PREFIX_RAW
34 %type <num> PE_VALUE_SYM
38 %type <str> PE_NAME_CACHE_TYPE
39 %type <str> PE_NAME_CACHE_OP_RESULT
40 %type <str> PE_MODIFIER_EVENT
41 %type <str> PE_MODIFIER_BP
42 %type <head> event_config
43 %type <term> event_term
49 struct list_head *head;
50 struct parse_events__term *term;
55 events ',' event | event
58 event_def PE_MODIFIER_EVENT
61 * Apply modifier on all events added by single event definition
62 * (there could be more events added for multiple tracepoint
63 * definitions via '*?'.
65 ABORT_ON(parse_events_modifier(list_event, $2));
66 parse_events_update_lists(list_event, list_all);
71 parse_events_update_lists(list_event, list_all);
74 event_def: event_pmu |
76 event_legacy_cache sep_dc |
78 event_legacy_tracepoint sep_dc |
79 event_legacy_numeric sep_dc |
80 event_legacy_raw sep_dc
83 PE_NAME '/' event_config '/'
85 ABORT_ON(parse_events_add_pmu(list_event, idx, $1, $3));
86 parse_events__free_terms($3);
90 PE_VALUE_SYM '/' event_config '/'
93 int config = $1 & 255;
95 ABORT_ON(parse_events_add_numeric(list_event, idx, type, config, $3));
96 parse_events__free_terms($3);
99 PE_VALUE_SYM sep_slash_dc
102 int config = $1 & 255;
104 ABORT_ON(parse_events_add_numeric(list_event, idx, type, config, NULL));
108 PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT
110 ABORT_ON(parse_events_add_cache(list_event, idx, $1, $3, $5));
113 PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT
115 ABORT_ON(parse_events_add_cache(list_event, idx, $1, $3, NULL));
120 ABORT_ON(parse_events_add_cache(list_event, idx, $1, NULL, NULL));
124 PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc
126 ABORT_ON(parse_events_add_breakpoint(list_event, idx, (void *) $2, $4));
129 PE_PREFIX_MEM PE_VALUE sep_dc
131 ABORT_ON(parse_events_add_breakpoint(list_event, idx, (void *) $2, NULL));
134 event_legacy_tracepoint:
137 ABORT_ON(parse_events_add_tracepoint(list_event, idx, $1, $3));
140 event_legacy_numeric:
141 PE_VALUE ':' PE_VALUE
143 ABORT_ON(parse_events_add_numeric(list_event, idx, $1, $3, NULL));
149 ABORT_ON(parse_events_add_numeric(list_event, idx, PERF_TYPE_RAW, $1, NULL));
153 event_config ',' event_term
155 struct list_head *head = $1;
156 struct parse_events__term *term = $3;
159 list_add_tail(&term->list, head);
165 struct list_head *head = malloc(sizeof(*head));
166 struct parse_events__term *term = $1;
169 INIT_LIST_HEAD(head);
170 list_add_tail(&term->list, head);
177 struct parse_events__term *term;
179 ABORT_ON(parse_events__term_str(&term, PARSE_EVENTS__TERM_TYPE_USER,
186 struct parse_events__term *term;
188 ABORT_ON(parse_events__term_num(&term, PARSE_EVENTS__TERM_TYPE_USER,
195 struct parse_events__term *term;
197 ABORT_ON(parse_events__term_num(&term, PARSE_EVENTS__TERM_TYPE_USER,
204 struct parse_events__term *term;
206 ABORT_ON(parse_events__term_num(&term, $1, NULL, $3));
212 struct parse_events__term *term;
214 ABORT_ON(parse_events__term_num(&term, $1, NULL, 1));
220 sep_slash_dc: '/' | ':' |
224 void parse_events_error(struct list_head *list_all __used,
225 struct list_head *list_event __used,
227 char const *msg __used)