| .. | .. |
|---|
| 12 | 12 | #include <string.h> |
|---|
| 13 | 13 | |
|---|
| 14 | 14 | struct list_head; |
|---|
| 15 | | -struct perf_evsel; |
|---|
| 16 | | -struct perf_evlist; |
|---|
| 15 | +struct evsel; |
|---|
| 16 | +struct evlist; |
|---|
| 17 | 17 | struct parse_events_error; |
|---|
| 18 | 18 | |
|---|
| 19 | 19 | struct option; |
|---|
| 20 | +struct perf_pmu; |
|---|
| 20 | 21 | |
|---|
| 21 | 22 | struct tracepoint_path { |
|---|
| 22 | 23 | char *system; |
|---|
| .. | .. |
|---|
| 31 | 32 | const char *event_type(int type); |
|---|
| 32 | 33 | |
|---|
| 33 | 34 | int parse_events_option(const struct option *opt, const char *str, int unset); |
|---|
| 34 | | -int parse_events(struct perf_evlist *evlist, const char *str, |
|---|
| 35 | | - struct parse_events_error *error); |
|---|
| 35 | +int parse_events_option_new_evlist(const struct option *opt, const char *str, int unset); |
|---|
| 36 | +int __parse_events(struct evlist *evlist, const char *str, struct parse_events_error *error, |
|---|
| 37 | + struct perf_pmu *fake_pmu); |
|---|
| 38 | + |
|---|
| 39 | +static inline int parse_events(struct evlist *evlist, const char *str, |
|---|
| 40 | + struct parse_events_error *err) |
|---|
| 41 | +{ |
|---|
| 42 | + return __parse_events(evlist, str, err, NULL); |
|---|
| 43 | +} |
|---|
| 44 | + |
|---|
| 36 | 45 | int parse_events_terms(struct list_head *terms, const char *str); |
|---|
| 37 | 46 | int parse_filter(const struct option *opt, const char *str, int unset); |
|---|
| 38 | 47 | int exclude_perf(const struct option *opt, const char *arg, int unset); |
|---|
| .. | .. |
|---|
| 71 | 80 | PARSE_EVENTS__TERM_TYPE_NOINHERIT, |
|---|
| 72 | 81 | PARSE_EVENTS__TERM_TYPE_INHERIT, |
|---|
| 73 | 82 | PARSE_EVENTS__TERM_TYPE_MAX_STACK, |
|---|
| 83 | + PARSE_EVENTS__TERM_TYPE_MAX_EVENTS, |
|---|
| 74 | 84 | PARSE_EVENTS__TERM_TYPE_NOOVERWRITE, |
|---|
| 75 | 85 | PARSE_EVENTS__TERM_TYPE_OVERWRITE, |
|---|
| 76 | 86 | PARSE_EVENTS__TERM_TYPE_DRV_CFG, |
|---|
| 87 | + PARSE_EVENTS__TERM_TYPE_PERCORE, |
|---|
| 88 | + PARSE_EVENTS__TERM_TYPE_AUX_OUTPUT, |
|---|
| 89 | + PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE, |
|---|
| 77 | 90 | __PARSE_EVENTS__TERM_TYPE_NR, |
|---|
| 78 | 91 | }; |
|---|
| 79 | 92 | |
|---|
| .. | .. |
|---|
| 107 | 120 | }; |
|---|
| 108 | 121 | |
|---|
| 109 | 122 | struct parse_events_error { |
|---|
| 123 | + int num_errors; /* number of errors encountered */ |
|---|
| 110 | 124 | int idx; /* index in the parsed string */ |
|---|
| 111 | 125 | char *str; /* string to display at the index */ |
|---|
| 112 | 126 | char *help; /* optional help string */ |
|---|
| 127 | + int first_idx;/* as above, but for the first encountered error */ |
|---|
| 128 | + char *first_str; |
|---|
| 129 | + char *first_help; |
|---|
| 113 | 130 | }; |
|---|
| 114 | 131 | |
|---|
| 115 | 132 | struct parse_events_state { |
|---|
| .. | .. |
|---|
| 117 | 134 | int idx; |
|---|
| 118 | 135 | int nr_groups; |
|---|
| 119 | 136 | struct parse_events_error *error; |
|---|
| 120 | | - struct perf_evlist *evlist; |
|---|
| 137 | + struct evlist *evlist; |
|---|
| 121 | 138 | struct list_head *terms; |
|---|
| 139 | + int stoken; |
|---|
| 140 | + struct perf_pmu *fake_pmu; |
|---|
| 122 | 141 | }; |
|---|
| 123 | 142 | |
|---|
| 143 | +void parse_events__handle_error(struct parse_events_error *err, int idx, |
|---|
| 144 | + char *str, char *help); |
|---|
| 124 | 145 | void parse_events__shrink_config_terms(void); |
|---|
| 125 | 146 | int parse_events__is_hardcoded_term(struct parse_events_term *term); |
|---|
| 126 | 147 | int parse_events_term__num(struct parse_events_term **term, |
|---|
| .. | .. |
|---|
| 134 | 155 | char *config, unsigned idx); |
|---|
| 135 | 156 | int parse_events_term__clone(struct parse_events_term **new, |
|---|
| 136 | 157 | struct parse_events_term *term); |
|---|
| 158 | +void parse_events_term__delete(struct parse_events_term *term); |
|---|
| 137 | 159 | void parse_events_terms__delete(struct list_head *terms); |
|---|
| 138 | 160 | void parse_events_terms__purge(struct list_head *terms); |
|---|
| 139 | 161 | void parse_events__clear_array(struct parse_events_array *a); |
|---|
| .. | .. |
|---|
| 159 | 181 | struct list_head *list, |
|---|
| 160 | 182 | u32 type, u64 config, |
|---|
| 161 | 183 | struct list_head *head_config); |
|---|
| 184 | +enum perf_tool_event; |
|---|
| 185 | +int parse_events_add_tool(struct parse_events_state *parse_state, |
|---|
| 186 | + struct list_head *list, |
|---|
| 187 | + enum perf_tool_event tool_event); |
|---|
| 162 | 188 | int parse_events_add_cache(struct list_head *list, int *idx, |
|---|
| 163 | 189 | char *type, char *op_result1, char *op_result2, |
|---|
| 164 | 190 | struct parse_events_error *error, |
|---|
| 165 | 191 | struct list_head *head_config); |
|---|
| 166 | 192 | int parse_events_add_breakpoint(struct list_head *list, int *idx, |
|---|
| 167 | | - void *ptr, char *type, u64 len); |
|---|
| 193 | + u64 addr, char *type, u64 len); |
|---|
| 168 | 194 | int parse_events_add_pmu(struct parse_events_state *parse_state, |
|---|
| 169 | 195 | struct list_head *list, char *name, |
|---|
| 170 | 196 | struct list_head *head_config, |
|---|
| 171 | 197 | bool auto_merge_stats, |
|---|
| 172 | 198 | bool use_alias); |
|---|
| 199 | + |
|---|
| 200 | +struct evsel *parse_events__add_event(int idx, struct perf_event_attr *attr, |
|---|
| 201 | + char *name, struct perf_pmu *pmu); |
|---|
| 173 | 202 | |
|---|
| 174 | 203 | int parse_events_multi_pmu_add(struct parse_events_state *parse_state, |
|---|
| 175 | 204 | char *str, |
|---|
| .. | .. |
|---|
| 188 | 217 | int idx, const char *str); |
|---|
| 189 | 218 | |
|---|
| 190 | 219 | void print_events(const char *event_glob, bool name_only, bool quiet, |
|---|
| 191 | | - bool long_desc, bool details_flag); |
|---|
| 220 | + bool long_desc, bool details_flag, bool deprecated); |
|---|
| 192 | 221 | |
|---|
| 193 | 222 | struct event_symbol { |
|---|
| 194 | 223 | const char *symbol; |
|---|
| .. | .. |
|---|
| 199 | 228 | void print_symbol_events(const char *event_glob, unsigned type, |
|---|
| 200 | 229 | struct event_symbol *syms, unsigned max, |
|---|
| 201 | 230 | bool name_only); |
|---|
| 231 | +void print_tool_events(const char *event_glob, bool name_only); |
|---|
| 202 | 232 | void print_tracepoint_events(const char *subsys_glob, const char *event_glob, |
|---|
| 203 | 233 | bool name_only); |
|---|
| 204 | 234 | int print_hwcache_events(const char *event_glob, bool name_only); |
|---|
| .. | .. |
|---|
| 231 | 261 | } |
|---|
| 232 | 262 | #endif /* HAVE_LIBELF_SUPPORT */ |
|---|
| 233 | 263 | |
|---|
| 264 | +int perf_pmu__test_parse_init(void); |
|---|
| 265 | + |
|---|
| 234 | 266 | #endif /* __PERF_PARSE_EVENTS_H */ |
|---|