Blame view
tools/perf/util/parse-events.h
6.81 KB
8b40f521c
|
1 2 |
#ifndef __PERF_PARSE_EVENTS_H #define __PERF_PARSE_EVENTS_H |
5242519b0
|
3 4 5 |
/* * Parse symbolic events/counts passed in as options: */ |
f50246e2e
|
6 |
#include <linux/list.h> |
c651214e9
|
7 |
#include <stdbool.h> |
d944c4eeb
|
8 |
#include <linux/types.h> |
d2709c7ce
|
9 |
#include <linux/perf_event.h> |
af9100ad1
|
10 |
#include <string.h> |
69aad6f1e
|
11 12 13 |
struct list_head; struct perf_evsel; |
f120f9d51
|
14 |
struct perf_evlist; |
b39b83930
|
15 |
struct parse_events_error; |
69aad6f1e
|
16 |
|
5beeded12
|
17 |
struct option; |
1ef2ed106
|
18 19 20 21 22 |
struct tracepoint_path { char *system; char *name; struct tracepoint_path *next; }; |
3938bad44
|
23 24 25 |
struct tracepoint_path *tracepoint_id_to_path(u64 config); struct tracepoint_path *tracepoint_name_to_path(const char *name); bool have_tracepoints(struct list_head *evlist); |
1ef2ed106
|
26 |
|
1424dc968
|
27 |
const char *event_type(int type); |
8ad8db378
|
28 |
|
3938bad44
|
29 30 31 32 33 34 |
int parse_events_option(const struct option *opt, const char *str, int unset); int parse_events(struct perf_evlist *evlist, const char *str, struct parse_events_error *error); int parse_events_terms(struct list_head *terms, const char *str); int parse_filter(const struct option *opt, const char *str, int unset); int exclude_perf(const struct option *opt, const char *arg, int unset); |
8ad8db378
|
35 36 |
#define EVENTS_HELP_MAX (128*1024) |
dcb4e1022
|
37 38 39 40 41 42 43 44 45 46 47 |
enum perf_pmu_event_symbol_type { PMU_EVENT_SYMBOL_ERR, /* not a PMU EVENT */ PMU_EVENT_SYMBOL, /* normal style PMU event */ PMU_EVENT_SYMBOL_PREFIX, /* prefix of pre-suf style event */ PMU_EVENT_SYMBOL_SUFFIX, /* suffix of pre-suf style event */ }; struct perf_pmu_event_symbol { char *symbol; enum perf_pmu_event_symbol_type type; }; |
8f707d843
|
48 |
enum { |
16fa7e820
|
49 50 51 52 53 54 |
PARSE_EVENTS__TERM_TYPE_NUM, PARSE_EVENTS__TERM_TYPE_STR, }; enum { PARSE_EVENTS__TERM_TYPE_USER, |
8f707d843
|
55 56 57 |
PARSE_EVENTS__TERM_TYPE_CONFIG, PARSE_EVENTS__TERM_TYPE_CONFIG1, PARSE_EVENTS__TERM_TYPE_CONFIG2, |
6b5fc39bd
|
58 |
PARSE_EVENTS__TERM_TYPE_NAME, |
8f707d843
|
59 |
PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD, |
09af2a553
|
60 |
PARSE_EVENTS__TERM_TYPE_SAMPLE_FREQ, |
8f707d843
|
61 |
PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE, |
320677123
|
62 |
PARSE_EVENTS__TERM_TYPE_TIME, |
d457c9639
|
63 64 |
PARSE_EVENTS__TERM_TYPE_CALLGRAPH, PARSE_EVENTS__TERM_TYPE_STACKSIZE, |
374ce938a
|
65 |
PARSE_EVENTS__TERM_TYPE_NOINHERIT, |
17cb5f84b
|
66 |
PARSE_EVENTS__TERM_TYPE_INHERIT, |
792d48b4c
|
67 |
PARSE_EVENTS__TERM_TYPE_MAX_STACK, |
626a6b784
|
68 69 |
PARSE_EVENTS__TERM_TYPE_NOOVERWRITE, PARSE_EVENTS__TERM_TYPE_OVERWRITE, |
dd60fba73
|
70 |
PARSE_EVENTS__TERM_TYPE_DRV_CFG, |
17cb5f84b
|
71 |
__PARSE_EVENTS__TERM_TYPE_NR, |
8f707d843
|
72 |
}; |
2d055bf25
|
73 74 75 76 77 78 79 |
struct parse_events_array { size_t nr_ranges; struct { unsigned int start; size_t length; } *ranges; }; |
6cee6cd31
|
80 |
struct parse_events_term { |
8f707d843
|
81 |
char *config; |
2d055bf25
|
82 |
struct parse_events_array array; |
8f707d843
|
83 84 |
union { char *str; |
b527bab59
|
85 |
u64 num; |
8f707d843
|
86 |
} val; |
16fa7e820
|
87 88 |
int type_val; int type_term; |
8f707d843
|
89 |
struct list_head list; |
688d4dfcd
|
90 |
bool used; |
99e7138eb
|
91 |
bool no_value; |
cecf3a2e1
|
92 93 94 95 |
/* error string indexes for within parsed string */ int err_term; int err_val; |
8f707d843
|
96 |
}; |
b39b83930
|
97 98 99 100 101 |
struct parse_events_error { int idx; /* index in the parsed string */ char *str; /* string to display at the index */ char *help; /* optional help string */ }; |
23b6339b9
|
102 |
struct parse_events_evlist { |
b39b83930
|
103 104 105 106 |
struct list_head list; int idx; int nr_groups; struct parse_events_error *error; |
7630b3e28
|
107 |
struct perf_evlist *evlist; |
46010ab26
|
108 |
}; |
23b6339b9
|
109 |
struct parse_events_terms { |
90e2b22de
|
110 111 |
struct list_head *terms; }; |
1669e509e
|
112 |
void parse_events__shrink_config_terms(void); |
6cee6cd31
|
113 |
int parse_events__is_hardcoded_term(struct parse_events_term *term); |
bb78ce7d0
|
114 115 |
int parse_events_term__num(struct parse_events_term **term, int type_term, char *config, u64 num, |
99e7138eb
|
116 |
bool novalue, |
bb78ce7d0
|
117 118 119 120 |
void *loc_term, void *loc_val); int parse_events_term__str(struct parse_events_term **term, int type_term, char *config, char *str, void *loc_term, void *loc_val); |
6cee6cd31
|
121 |
int parse_events_term__sym_hw(struct parse_events_term **term, |
1d33d6dce
|
122 |
char *config, unsigned idx); |
6cee6cd31
|
123 124 |
int parse_events_term__clone(struct parse_events_term **new, struct parse_events_term *term); |
2146afc6b
|
125 |
void parse_events_terms__delete(struct list_head *terms); |
fc0a2c1d5
|
126 |
void parse_events_terms__purge(struct list_head *terms); |
2d055bf25
|
127 |
void parse_events__clear_array(struct parse_events_array *a); |
f5b1135bf
|
128 |
int parse_events__modifier_event(struct list_head *list, char *str, bool add); |
89efb0295
|
129 |
int parse_events__modifier_group(struct list_head *list, char *event_mod); |
ac2ba9f36
|
130 |
int parse_events_name(struct list_head *list, char *name); |
c5cd8ac07
|
131 |
int parse_events_add_tracepoint(struct list_head *list, int *idx, |
8c619d6a3
|
132 |
const char *sys, const char *event, |
e637d1775
|
133 134 |
struct parse_events_error *error, struct list_head *head_config); |
84c86ca12
|
135 136 |
int parse_events_load_bpf(struct parse_events_evlist *data, struct list_head *list, |
d509db047
|
137 |
char *bpf_file_name, |
a34f3be70
|
138 139 |
bool source, struct list_head *head_config); |
84c86ca12
|
140 141 142 143 |
/* Provide this function for perf test */ struct bpf_object; int parse_events_load_bpf_obj(struct parse_events_evlist *data, struct list_head *list, |
95088a591
|
144 145 |
struct bpf_object *obj, struct list_head *head_config); |
87d650be1
|
146 147 |
int parse_events_add_numeric(struct parse_events_evlist *data, struct list_head *list, |
b527bab59
|
148 |
u32 type, u64 config, |
8f707d843
|
149 |
struct list_head *head_config); |
c5cd8ac07
|
150 |
int parse_events_add_cache(struct list_head *list, int *idx, |
43d0b9781
|
151 152 153 |
char *type, char *op_result1, char *op_result2, struct parse_events_error *error, struct list_head *head_config); |
c5cd8ac07
|
154 |
int parse_events_add_breakpoint(struct list_head *list, int *idx, |
3741eb9f8
|
155 |
void *ptr, char *type, u64 len); |
36adec85a
|
156 157 158 |
int parse_events_add_pmu(struct parse_events_evlist *data, struct list_head *list, char *name, struct list_head *head_config); |
2073ad332
|
159 160 161 162 |
int parse_events_multi_pmu_add(struct parse_events_evlist *data, char *str, struct list_head **listp); |
8255718f4
|
163 164 |
int parse_events_copy_term_list(struct list_head *old, struct list_head **new); |
dcb4e1022
|
165 166 |
enum perf_pmu_event_symbol_type perf_pmu__parse_check(const char *name); |
63dab225f
|
167 |
void parse_events__set_leader(char *name, struct list_head *list); |
5d7be90ed
|
168 169 |
void parse_events_update_lists(struct list_head *list_event, struct list_head *list_all); |
b39b83930
|
170 171 |
void parse_events_evlist_error(struct parse_events_evlist *data, int idx, const char *str); |
89812fc81
|
172 |
|
c8d6828a6
|
173 |
void print_events(const char *event_glob, bool name_only, bool quiet, |
bf874fcf9
|
174 |
bool long_desc, bool details_flag); |
705750f2d
|
175 176 177 178 179 180 181 182 183 184 |
struct event_symbol { const char *symbol; const char *alias; }; extern struct event_symbol event_symbols_hw[]; extern struct event_symbol event_symbols_sw[]; void print_symbol_events(const char *event_glob, unsigned type, struct event_symbol *syms, unsigned max, bool name_only); |
a3277d2d5
|
185 186 187 |
void print_tracepoint_events(const char *subsys_glob, const char *event_glob, bool name_only); int print_hwcache_events(const char *event_glob, bool name_only); |
40218daea
|
188 189 |
void print_sdt_events(const char *subsys_glob, const char *event_glob, bool name_only); |
3938bad44
|
190 |
int is_valid_tracepoint(const char *event_string); |
8ad8db378
|
191 |
|
23773ca18
|
192 |
int valid_event_mount(const char *eventfs); |
ffeb883e5
|
193 |
char *parse_events_formats_error_string(char *additional_terms); |
5beeded12
|
194 |
|
af9100ad1
|
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
#ifdef HAVE_LIBELF_SUPPORT /* * If the probe point starts with '%', * or starts with "sdt_" and has a ':' but no '=', * then it should be a SDT/cached probe point. */ static inline bool is_sdt_event(char *str) { return (str[0] == '%' || (!strncmp(str, "sdt_", 4) && !!strchr(str, ':') && !strchr(str, '='))); } #else static inline bool is_sdt_event(char *str __maybe_unused) { return false; } #endif /* HAVE_LIBELF_SUPPORT */ |
8b40f521c
|
213 |
#endif /* __PERF_PARSE_EVENTS_H */ |