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