hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/tools/perf/util/parse-events.h
....@@ -12,11 +12,12 @@
1212 #include <string.h>
1313
1414 struct list_head;
15
-struct perf_evsel;
16
-struct perf_evlist;
15
+struct evsel;
16
+struct evlist;
1717 struct parse_events_error;
1818
1919 struct option;
20
+struct perf_pmu;
2021
2122 struct tracepoint_path {
2223 char *system;
....@@ -31,8 +32,16 @@
3132 const char *event_type(int type);
3233
3334 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
+
3645 int parse_events_terms(struct list_head *terms, const char *str);
3746 int parse_filter(const struct option *opt, const char *str, int unset);
3847 int exclude_perf(const struct option *opt, const char *arg, int unset);
....@@ -71,9 +80,13 @@
7180 PARSE_EVENTS__TERM_TYPE_NOINHERIT,
7281 PARSE_EVENTS__TERM_TYPE_INHERIT,
7382 PARSE_EVENTS__TERM_TYPE_MAX_STACK,
83
+ PARSE_EVENTS__TERM_TYPE_MAX_EVENTS,
7484 PARSE_EVENTS__TERM_TYPE_NOOVERWRITE,
7585 PARSE_EVENTS__TERM_TYPE_OVERWRITE,
7686 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,
7790 __PARSE_EVENTS__TERM_TYPE_NR,
7891 };
7992
....@@ -107,9 +120,13 @@
107120 };
108121
109122 struct parse_events_error {
123
+ int num_errors; /* number of errors encountered */
110124 int idx; /* index in the parsed string */
111125 char *str; /* string to display at the index */
112126 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;
113130 };
114131
115132 struct parse_events_state {
....@@ -117,10 +134,14 @@
117134 int idx;
118135 int nr_groups;
119136 struct parse_events_error *error;
120
- struct perf_evlist *evlist;
137
+ struct evlist *evlist;
121138 struct list_head *terms;
139
+ int stoken;
140
+ struct perf_pmu *fake_pmu;
122141 };
123142
143
+void parse_events__handle_error(struct parse_events_error *err, int idx,
144
+ char *str, char *help);
124145 void parse_events__shrink_config_terms(void);
125146 int parse_events__is_hardcoded_term(struct parse_events_term *term);
126147 int parse_events_term__num(struct parse_events_term **term,
....@@ -134,6 +155,7 @@
134155 char *config, unsigned idx);
135156 int parse_events_term__clone(struct parse_events_term **new,
136157 struct parse_events_term *term);
158
+void parse_events_term__delete(struct parse_events_term *term);
137159 void parse_events_terms__delete(struct list_head *terms);
138160 void parse_events_terms__purge(struct list_head *terms);
139161 void parse_events__clear_array(struct parse_events_array *a);
....@@ -159,17 +181,24 @@
159181 struct list_head *list,
160182 u32 type, u64 config,
161183 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);
162188 int parse_events_add_cache(struct list_head *list, int *idx,
163189 char *type, char *op_result1, char *op_result2,
164190 struct parse_events_error *error,
165191 struct list_head *head_config);
166192 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);
168194 int parse_events_add_pmu(struct parse_events_state *parse_state,
169195 struct list_head *list, char *name,
170196 struct list_head *head_config,
171197 bool auto_merge_stats,
172198 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);
173202
174203 int parse_events_multi_pmu_add(struct parse_events_state *parse_state,
175204 char *str,
....@@ -188,7 +217,7 @@
188217 int idx, const char *str);
189218
190219 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);
192221
193222 struct event_symbol {
194223 const char *symbol;
....@@ -199,6 +228,7 @@
199228 void print_symbol_events(const char *event_glob, unsigned type,
200229 struct event_symbol *syms, unsigned max,
201230 bool name_only);
231
+void print_tool_events(const char *event_glob, bool name_only);
202232 void print_tracepoint_events(const char *subsys_glob, const char *event_glob,
203233 bool name_only);
204234 int print_hwcache_events(const char *event_glob, bool name_only);
....@@ -231,4 +261,6 @@
231261 }
232262 #endif /* HAVE_LIBELF_SUPPORT */
233263
264
+int perf_pmu__test_parse_init(void);
265
+
234266 #endif /* __PERF_PARSE_EVENTS_H */