Commit | Line | Data |
---|---|---|
8b40f521 JK |
1 | #ifndef __PERF_PARSE_EVENTS_H |
2 | #define __PERF_PARSE_EVENTS_H | |
5242519b IM |
3 | /* |
4 | * Parse symbolic events/counts passed in as options: | |
5 | */ | |
6 | ||
f50246e2 | 7 | #include <linux/list.h> |
c651214e | 8 | #include <stdbool.h> |
d944c4ee | 9 | #include <linux/types.h> |
d2709c7c | 10 | #include <linux/perf_event.h> |
69aad6f1 ACM |
11 | |
12 | struct list_head; | |
13 | struct perf_evsel; | |
f120f9d5 | 14 | struct perf_evlist; |
b39b8393 | 15 | struct parse_events_error; |
69aad6f1 | 16 | |
5beeded1 JB |
17 | struct option; |
18 | ||
1ef2ed10 FW |
19 | struct tracepoint_path { |
20 | char *system; | |
21 | char *name; | |
22 | struct tracepoint_path *next; | |
23 | }; | |
24 | ||
25 | extern struct tracepoint_path *tracepoint_id_to_path(u64 config); | |
e7c93f09 | 26 | extern struct tracepoint_path *tracepoint_name_to_path(const char *name); |
5c7a6682 | 27 | extern bool have_tracepoints(struct list_head *evlist); |
1ef2ed10 | 28 | |
1424dc96 | 29 | const char *event_type(int type); |
8ad8db37 | 30 | |
f120f9d5 JO |
31 | extern int parse_events_option(const struct option *opt, const char *str, |
32 | int unset); | |
b39b8393 JO |
33 | extern int parse_events(struct perf_evlist *evlist, const char *str, |
34 | struct parse_events_error *error); | |
90e2b22d | 35 | extern int parse_events_terms(struct list_head *terms, const char *str); |
c171b552 | 36 | extern int parse_filter(const struct option *opt, const char *str, int unset); |
4ba1faa1 | 37 | extern int exclude_perf(const struct option *opt, const char *arg, int unset); |
8ad8db37 IM |
38 | |
39 | #define EVENTS_HELP_MAX (128*1024) | |
40 | ||
dcb4e102 KL |
41 | enum perf_pmu_event_symbol_type { |
42 | PMU_EVENT_SYMBOL_ERR, /* not a PMU EVENT */ | |
43 | PMU_EVENT_SYMBOL, /* normal style PMU event */ | |
44 | PMU_EVENT_SYMBOL_PREFIX, /* prefix of pre-suf style event */ | |
45 | PMU_EVENT_SYMBOL_SUFFIX, /* suffix of pre-suf style event */ | |
46 | }; | |
47 | ||
48 | struct perf_pmu_event_symbol { | |
49 | char *symbol; | |
50 | enum perf_pmu_event_symbol_type type; | |
51 | }; | |
52 | ||
8f707d84 | 53 | enum { |
16fa7e82 JO |
54 | PARSE_EVENTS__TERM_TYPE_NUM, |
55 | PARSE_EVENTS__TERM_TYPE_STR, | |
56 | }; | |
57 | ||
58 | enum { | |
59 | PARSE_EVENTS__TERM_TYPE_USER, | |
8f707d84 JO |
60 | PARSE_EVENTS__TERM_TYPE_CONFIG, |
61 | PARSE_EVENTS__TERM_TYPE_CONFIG1, | |
62 | PARSE_EVENTS__TERM_TYPE_CONFIG2, | |
6b5fc39b | 63 | PARSE_EVENTS__TERM_TYPE_NAME, |
8f707d84 | 64 | PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD, |
09af2a55 | 65 | PARSE_EVENTS__TERM_TYPE_SAMPLE_FREQ, |
8f707d84 | 66 | PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE, |
32067712 | 67 | PARSE_EVENTS__TERM_TYPE_TIME, |
d457c963 KL |
68 | PARSE_EVENTS__TERM_TYPE_CALLGRAPH, |
69 | PARSE_EVENTS__TERM_TYPE_STACKSIZE, | |
374ce938 | 70 | PARSE_EVENTS__TERM_TYPE_NOINHERIT, |
17cb5f84 WN |
71 | PARSE_EVENTS__TERM_TYPE_INHERIT, |
72 | __PARSE_EVENTS__TERM_TYPE_NR, | |
8f707d84 JO |
73 | }; |
74 | ||
6cee6cd3 | 75 | struct parse_events_term { |
8f707d84 JO |
76 | char *config; |
77 | union { | |
78 | char *str; | |
b527bab5 | 79 | u64 num; |
8f707d84 | 80 | } val; |
16fa7e82 JO |
81 | int type_val; |
82 | int type_term; | |
8f707d84 | 83 | struct list_head list; |
688d4dfc | 84 | bool used; |
cecf3a2e JO |
85 | |
86 | /* error string indexes for within parsed string */ | |
87 | int err_term; | |
88 | int err_val; | |
8f707d84 JO |
89 | }; |
90 | ||
b39b8393 JO |
91 | struct parse_events_error { |
92 | int idx; /* index in the parsed string */ | |
93 | char *str; /* string to display at the index */ | |
94 | char *help; /* optional help string */ | |
95 | }; | |
96 | ||
23b6339b | 97 | struct parse_events_evlist { |
b39b8393 JO |
98 | struct list_head list; |
99 | int idx; | |
100 | int nr_groups; | |
101 | struct parse_events_error *error; | |
46010ab2 JO |
102 | }; |
103 | ||
23b6339b | 104 | struct parse_events_terms { |
90e2b22d JO |
105 | struct list_head *terms; |
106 | }; | |
107 | ||
6cee6cd3 | 108 | int parse_events__is_hardcoded_term(struct parse_events_term *term); |
bb78ce7d AH |
109 | int parse_events_term__num(struct parse_events_term **term, |
110 | int type_term, char *config, u64 num, | |
111 | void *loc_term, void *loc_val); | |
112 | int parse_events_term__str(struct parse_events_term **term, | |
113 | int type_term, char *config, char *str, | |
114 | void *loc_term, void *loc_val); | |
6cee6cd3 | 115 | int parse_events_term__sym_hw(struct parse_events_term **term, |
1d33d6dc | 116 | char *config, unsigned idx); |
6cee6cd3 ACM |
117 | int parse_events_term__clone(struct parse_events_term **new, |
118 | struct parse_events_term *term); | |
2146afc6 | 119 | void parse_events_terms__delete(struct list_head *terms); |
fc0a2c1d | 120 | void parse_events_terms__purge(struct list_head *terms); |
f5b1135b | 121 | int parse_events__modifier_event(struct list_head *list, char *str, bool add); |
89efb029 | 122 | int parse_events__modifier_group(struct list_head *list, char *event_mod); |
ac2ba9f3 | 123 | int parse_events_name(struct list_head *list, char *name); |
c5cd8ac0 | 124 | int parse_events_add_tracepoint(struct list_head *list, int *idx, |
e2f9f8ea | 125 | char *sys, char *event, |
e637d177 HK |
126 | struct parse_events_error *error, |
127 | struct list_head *head_config); | |
84c86ca1 WN |
128 | int parse_events_load_bpf(struct parse_events_evlist *data, |
129 | struct list_head *list, | |
d509db04 WN |
130 | char *bpf_file_name, |
131 | bool source); | |
84c86ca1 WN |
132 | /* Provide this function for perf test */ |
133 | struct bpf_object; | |
134 | int parse_events_load_bpf_obj(struct parse_events_evlist *data, | |
135 | struct list_head *list, | |
136 | struct bpf_object *obj); | |
87d650be JO |
137 | int parse_events_add_numeric(struct parse_events_evlist *data, |
138 | struct list_head *list, | |
b527bab5 | 139 | u32 type, u64 config, |
8f707d84 | 140 | struct list_head *head_config); |
c5cd8ac0 | 141 | int parse_events_add_cache(struct list_head *list, int *idx, |
89812fc8 | 142 | char *type, char *op_result1, char *op_result2); |
c5cd8ac0 | 143 | int parse_events_add_breakpoint(struct list_head *list, int *idx, |
3741eb9f | 144 | void *ptr, char *type, u64 len); |
36adec85 JO |
145 | int parse_events_add_pmu(struct parse_events_evlist *data, |
146 | struct list_head *list, char *name, | |
147 | struct list_head *head_config); | |
dcb4e102 KL |
148 | enum perf_pmu_event_symbol_type |
149 | perf_pmu__parse_check(const char *name); | |
63dab225 | 150 | void parse_events__set_leader(char *name, struct list_head *list); |
5d7be90e JO |
151 | void parse_events_update_lists(struct list_head *list_event, |
152 | struct list_head *list_all); | |
b39b8393 JO |
153 | void parse_events_evlist_error(struct parse_events_evlist *data, |
154 | int idx, const char *str); | |
89812fc8 | 155 | |
a3277d2d | 156 | void print_events(const char *event_glob, bool name_only); |
705750f2 YS |
157 | |
158 | struct event_symbol { | |
159 | const char *symbol; | |
160 | const char *alias; | |
161 | }; | |
162 | extern struct event_symbol event_symbols_hw[]; | |
163 | extern struct event_symbol event_symbols_sw[]; | |
164 | void print_symbol_events(const char *event_glob, unsigned type, | |
165 | struct event_symbol *syms, unsigned max, | |
166 | bool name_only); | |
a3277d2d FW |
167 | void print_tracepoint_events(const char *subsys_glob, const char *event_glob, |
168 | bool name_only); | |
169 | int print_hwcache_events(const char *event_glob, bool name_only); | |
20c457b8 | 170 | extern int is_valid_tracepoint(const char *event_string); |
8ad8db37 | 171 | |
23773ca1 | 172 | int valid_event_mount(const char *eventfs); |
ffeb883e | 173 | char *parse_events_formats_error_string(char *additional_terms); |
5beeded1 | 174 | |
8b40f521 | 175 | #endif /* __PERF_PARSE_EVENTS_H */ |