.. | .. |
---|
7 | 7 | #include <linux/refcount.h> |
---|
8 | 8 | #include <linux/list.h> |
---|
9 | 9 | #include <api/fd/array.h> |
---|
10 | | -#include <stdio.h> |
---|
11 | | -#include "../perf.h" |
---|
12 | | -#include "event.h" |
---|
| 10 | +#include <internal/evlist.h> |
---|
| 11 | +#include <internal/evsel.h> |
---|
| 12 | +#include "events_stats.h" |
---|
13 | 13 | #include "evsel.h" |
---|
14 | | -#include "mmap.h" |
---|
15 | | -#include "util.h" |
---|
| 14 | +#include <pthread.h> |
---|
16 | 15 | #include <signal.h> |
---|
17 | 16 | #include <unistd.h> |
---|
18 | 17 | |
---|
19 | 18 | struct pollfd; |
---|
20 | 19 | struct thread_map; |
---|
21 | | -struct cpu_map; |
---|
| 20 | +struct perf_cpu_map; |
---|
22 | 21 | struct record_opts; |
---|
23 | 22 | |
---|
24 | | -#define PERF_EVLIST__HLIST_BITS 8 |
---|
25 | | -#define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS) |
---|
| 23 | +/* |
---|
| 24 | + * State machine of bkw_mmap_state: |
---|
| 25 | + * |
---|
| 26 | + * .________________(forbid)_____________. |
---|
| 27 | + * | V |
---|
| 28 | + * NOTREADY --(0)--> RUNNING --(1)--> DATA_PENDING --(2)--> EMPTY |
---|
| 29 | + * ^ ^ | ^ | |
---|
| 30 | + * | |__(forbid)____/ |___(forbid)___/| |
---|
| 31 | + * | | |
---|
| 32 | + * \_________________(3)_______________/ |
---|
| 33 | + * |
---|
| 34 | + * NOTREADY : Backward ring buffers are not ready |
---|
| 35 | + * RUNNING : Backward ring buffers are recording |
---|
| 36 | + * DATA_PENDING : We are required to collect data from backward ring buffers |
---|
| 37 | + * EMPTY : We have collected data from backward ring buffers. |
---|
| 38 | + * |
---|
| 39 | + * (0): Setup backward ring buffer |
---|
| 40 | + * (1): Pause ring buffers for reading |
---|
| 41 | + * (2): Read from ring buffers |
---|
| 42 | + * (3): Resume ring buffers for recording |
---|
| 43 | + */ |
---|
| 44 | +enum bkw_mmap_state { |
---|
| 45 | + BKW_MMAP_NOTREADY, |
---|
| 46 | + BKW_MMAP_RUNNING, |
---|
| 47 | + BKW_MMAP_DATA_PENDING, |
---|
| 48 | + BKW_MMAP_EMPTY, |
---|
| 49 | +}; |
---|
26 | 50 | |
---|
27 | | -struct perf_evlist { |
---|
28 | | - struct list_head entries; |
---|
29 | | - struct hlist_head heads[PERF_EVLIST__HLIST_SIZE]; |
---|
30 | | - int nr_entries; |
---|
| 51 | +struct evlist { |
---|
| 52 | + struct perf_evlist core; |
---|
31 | 53 | int nr_groups; |
---|
32 | | - int nr_mmaps; |
---|
33 | 54 | bool enabled; |
---|
34 | | - bool has_user_cpus; |
---|
35 | | - size_t mmap_len; |
---|
36 | 55 | int id_pos; |
---|
37 | 56 | int is_pos; |
---|
38 | 57 | u64 combined_sample_type; |
---|
.. | .. |
---|
41 | 60 | int cork_fd; |
---|
42 | 61 | pid_t pid; |
---|
43 | 62 | } workload; |
---|
44 | | - struct fdarray pollfd; |
---|
45 | | - struct perf_mmap *mmap; |
---|
46 | | - struct perf_mmap *overwrite_mmap; |
---|
47 | | - struct thread_map *threads; |
---|
48 | | - struct cpu_map *cpus; |
---|
49 | | - struct perf_evsel *selected; |
---|
| 63 | + struct mmap *mmap; |
---|
| 64 | + struct mmap *overwrite_mmap; |
---|
| 65 | + struct evsel *selected; |
---|
50 | 66 | struct events_stats stats; |
---|
51 | 67 | struct perf_env *env; |
---|
| 68 | + void (*trace_event_sample_raw)(struct evlist *evlist, |
---|
| 69 | + union perf_event *event, |
---|
| 70 | + struct perf_sample *sample); |
---|
52 | 71 | u64 first_sample_time; |
---|
53 | 72 | u64 last_sample_time; |
---|
| 73 | + struct { |
---|
| 74 | + pthread_t th; |
---|
| 75 | + volatile int done; |
---|
| 76 | + } thread; |
---|
| 77 | + struct { |
---|
| 78 | + int fd; /* control file descriptor */ |
---|
| 79 | + int ack; /* ack file descriptor for control commands */ |
---|
| 80 | + int pos; /* index at evlist core object to check signals */ |
---|
| 81 | + } ctl_fd; |
---|
54 | 82 | }; |
---|
55 | 83 | |
---|
56 | | -struct perf_evsel_str_handler { |
---|
| 84 | +struct evsel_str_handler { |
---|
57 | 85 | const char *name; |
---|
58 | 86 | void *handler; |
---|
59 | 87 | }; |
---|
60 | 88 | |
---|
61 | | -struct perf_evlist *perf_evlist__new(void); |
---|
62 | | -struct perf_evlist *perf_evlist__new_default(void); |
---|
63 | | -struct perf_evlist *perf_evlist__new_dummy(void); |
---|
64 | | -void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus, |
---|
65 | | - struct thread_map *threads); |
---|
66 | | -void perf_evlist__exit(struct perf_evlist *evlist); |
---|
67 | | -void perf_evlist__delete(struct perf_evlist *evlist); |
---|
| 89 | +struct evlist *evlist__new(void); |
---|
| 90 | +struct evlist *perf_evlist__new_default(void); |
---|
| 91 | +struct evlist *perf_evlist__new_dummy(void); |
---|
| 92 | +void evlist__init(struct evlist *evlist, struct perf_cpu_map *cpus, |
---|
| 93 | + struct perf_thread_map *threads); |
---|
| 94 | +void evlist__exit(struct evlist *evlist); |
---|
| 95 | +void evlist__delete(struct evlist *evlist); |
---|
68 | 96 | |
---|
69 | | -void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry); |
---|
70 | | -void perf_evlist__remove(struct perf_evlist *evlist, struct perf_evsel *evsel); |
---|
| 97 | +void evlist__add(struct evlist *evlist, struct evsel *entry); |
---|
| 98 | +void evlist__remove(struct evlist *evlist, struct evsel *evsel); |
---|
71 | 99 | |
---|
72 | | -int __perf_evlist__add_default(struct perf_evlist *evlist, bool precise); |
---|
| 100 | +int __evlist__add_default(struct evlist *evlist, bool precise); |
---|
73 | 101 | |
---|
74 | | -static inline int perf_evlist__add_default(struct perf_evlist *evlist) |
---|
| 102 | +static inline int evlist__add_default(struct evlist *evlist) |
---|
75 | 103 | { |
---|
76 | | - return __perf_evlist__add_default(evlist, true); |
---|
| 104 | + return __evlist__add_default(evlist, true); |
---|
77 | 105 | } |
---|
78 | 106 | |
---|
79 | | -int __perf_evlist__add_default_attrs(struct perf_evlist *evlist, |
---|
| 107 | +int __evlist__add_default_attrs(struct evlist *evlist, |
---|
80 | 108 | struct perf_event_attr *attrs, size_t nr_attrs); |
---|
81 | 109 | |
---|
82 | | -#define perf_evlist__add_default_attrs(evlist, array) \ |
---|
83 | | - __perf_evlist__add_default_attrs(evlist, array, ARRAY_SIZE(array)) |
---|
| 110 | +#define evlist__add_default_attrs(evlist, array) \ |
---|
| 111 | + __evlist__add_default_attrs(evlist, array, ARRAY_SIZE(array)) |
---|
84 | 112 | |
---|
85 | | -int perf_evlist__add_dummy(struct perf_evlist *evlist); |
---|
| 113 | +int evlist__add_dummy(struct evlist *evlist); |
---|
86 | 114 | |
---|
87 | | -int perf_evlist__add_newtp(struct perf_evlist *evlist, |
---|
88 | | - const char *sys, const char *name, void *handler); |
---|
| 115 | +int perf_evlist__add_sb_event(struct evlist *evlist, |
---|
| 116 | + struct perf_event_attr *attr, |
---|
| 117 | + evsel__sb_cb_t cb, |
---|
| 118 | + void *data); |
---|
| 119 | +void evlist__set_cb(struct evlist *evlist, evsel__sb_cb_t cb, void *data); |
---|
| 120 | +int perf_evlist__start_sb_thread(struct evlist *evlist, |
---|
| 121 | + struct target *target); |
---|
| 122 | +void perf_evlist__stop_sb_thread(struct evlist *evlist); |
---|
89 | 123 | |
---|
90 | | -void __perf_evlist__set_sample_bit(struct perf_evlist *evlist, |
---|
| 124 | +int evlist__add_newtp(struct evlist *evlist, const char *sys, const char *name, void *handler); |
---|
| 125 | + |
---|
| 126 | +int __evlist__set_tracepoints_handlers(struct evlist *evlist, |
---|
| 127 | + const struct evsel_str_handler *assocs, |
---|
| 128 | + size_t nr_assocs); |
---|
| 129 | + |
---|
| 130 | +#define evlist__set_tracepoints_handlers(evlist, array) \ |
---|
| 131 | + __evlist__set_tracepoints_handlers(evlist, array, ARRAY_SIZE(array)) |
---|
| 132 | + |
---|
| 133 | +void __perf_evlist__set_sample_bit(struct evlist *evlist, |
---|
91 | 134 | enum perf_event_sample_format bit); |
---|
92 | | -void __perf_evlist__reset_sample_bit(struct perf_evlist *evlist, |
---|
| 135 | +void __perf_evlist__reset_sample_bit(struct evlist *evlist, |
---|
93 | 136 | enum perf_event_sample_format bit); |
---|
94 | 137 | |
---|
95 | 138 | #define perf_evlist__set_sample_bit(evlist, bit) \ |
---|
.. | .. |
---|
98 | 141 | #define perf_evlist__reset_sample_bit(evlist, bit) \ |
---|
99 | 142 | __perf_evlist__reset_sample_bit(evlist, PERF_SAMPLE_##bit) |
---|
100 | 143 | |
---|
101 | | -int perf_evlist__set_filter(struct perf_evlist *evlist, const char *filter); |
---|
102 | | -int perf_evlist__set_filter_pid(struct perf_evlist *evlist, pid_t pid); |
---|
103 | | -int perf_evlist__set_filter_pids(struct perf_evlist *evlist, size_t npids, pid_t *pids); |
---|
| 144 | +int perf_evlist__set_tp_filter(struct evlist *evlist, const char *filter); |
---|
| 145 | +int perf_evlist__set_tp_filter_pid(struct evlist *evlist, pid_t pid); |
---|
| 146 | +int perf_evlist__set_tp_filter_pids(struct evlist *evlist, size_t npids, pid_t *pids); |
---|
104 | 147 | |
---|
105 | | -struct perf_evsel * |
---|
106 | | -perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id); |
---|
| 148 | +int perf_evlist__append_tp_filter(struct evlist *evlist, const char *filter); |
---|
107 | 149 | |
---|
108 | | -struct perf_evsel * |
---|
109 | | -perf_evlist__find_tracepoint_by_name(struct perf_evlist *evlist, |
---|
| 150 | +int perf_evlist__append_tp_filter_pid(struct evlist *evlist, pid_t pid); |
---|
| 151 | +int perf_evlist__append_tp_filter_pids(struct evlist *evlist, size_t npids, pid_t *pids); |
---|
| 152 | + |
---|
| 153 | +struct evsel * |
---|
| 154 | +perf_evlist__find_tracepoint_by_id(struct evlist *evlist, int id); |
---|
| 155 | + |
---|
| 156 | +struct evsel * |
---|
| 157 | +perf_evlist__find_tracepoint_by_name(struct evlist *evlist, |
---|
110 | 158 | const char *name); |
---|
111 | 159 | |
---|
112 | | -void perf_evlist__id_add(struct perf_evlist *evlist, struct perf_evsel *evsel, |
---|
113 | | - int cpu, int thread, u64 id); |
---|
114 | | -int perf_evlist__id_add_fd(struct perf_evlist *evlist, |
---|
115 | | - struct perf_evsel *evsel, |
---|
116 | | - int cpu, int thread, int fd); |
---|
| 160 | +int evlist__add_pollfd(struct evlist *evlist, int fd); |
---|
| 161 | +int evlist__filter_pollfd(struct evlist *evlist, short revents_and_mask); |
---|
117 | 162 | |
---|
118 | | -int perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd); |
---|
119 | | -int perf_evlist__alloc_pollfd(struct perf_evlist *evlist); |
---|
120 | | -int perf_evlist__filter_pollfd(struct perf_evlist *evlist, short revents_and_mask); |
---|
| 163 | +#ifdef HAVE_EVENTFD_SUPPORT |
---|
| 164 | +int evlist__add_wakeup_eventfd(struct evlist *evlist, int fd); |
---|
| 165 | +#endif |
---|
121 | 166 | |
---|
122 | | -int perf_evlist__poll(struct perf_evlist *evlist, int timeout); |
---|
| 167 | +int evlist__poll(struct evlist *evlist, int timeout); |
---|
123 | 168 | |
---|
124 | | -struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id); |
---|
125 | | -struct perf_evsel *perf_evlist__id2evsel_strict(struct perf_evlist *evlist, |
---|
| 169 | +struct evsel *perf_evlist__id2evsel(struct evlist *evlist, u64 id); |
---|
| 170 | +struct evsel *perf_evlist__id2evsel_strict(struct evlist *evlist, |
---|
126 | 171 | u64 id); |
---|
127 | 172 | |
---|
128 | | -struct perf_sample_id *perf_evlist__id2sid(struct perf_evlist *evlist, u64 id); |
---|
| 173 | +struct perf_sample_id *perf_evlist__id2sid(struct evlist *evlist, u64 id); |
---|
129 | 174 | |
---|
130 | | -void perf_evlist__toggle_bkw_mmap(struct perf_evlist *evlist, enum bkw_mmap_state state); |
---|
| 175 | +void perf_evlist__toggle_bkw_mmap(struct evlist *evlist, enum bkw_mmap_state state); |
---|
131 | 176 | |
---|
132 | | -void perf_evlist__mmap_consume(struct perf_evlist *evlist, int idx); |
---|
| 177 | +void evlist__mmap_consume(struct evlist *evlist, int idx); |
---|
133 | 178 | |
---|
134 | | -int perf_evlist__open(struct perf_evlist *evlist); |
---|
135 | | -void perf_evlist__close(struct perf_evlist *evlist); |
---|
| 179 | +int evlist__open(struct evlist *evlist); |
---|
| 180 | +void evlist__close(struct evlist *evlist); |
---|
136 | 181 | |
---|
137 | 182 | struct callchain_param; |
---|
138 | 183 | |
---|
139 | | -void perf_evlist__set_id_pos(struct perf_evlist *evlist); |
---|
140 | | -bool perf_can_sample_identifier(void); |
---|
141 | | -bool perf_can_record_switch_events(void); |
---|
142 | | -bool perf_can_record_cpu_wide(void); |
---|
143 | | -void perf_evlist__config(struct perf_evlist *evlist, struct record_opts *opts, |
---|
| 184 | +void perf_evlist__set_id_pos(struct evlist *evlist); |
---|
| 185 | +void perf_evlist__config(struct evlist *evlist, struct record_opts *opts, |
---|
144 | 186 | struct callchain_param *callchain); |
---|
145 | 187 | int record_opts__config(struct record_opts *opts); |
---|
146 | 188 | |
---|
147 | | -int perf_evlist__prepare_workload(struct perf_evlist *evlist, |
---|
| 189 | +int perf_evlist__prepare_workload(struct evlist *evlist, |
---|
148 | 190 | struct target *target, |
---|
149 | 191 | const char *argv[], bool pipe_output, |
---|
150 | 192 | void (*exec_error)(int signo, siginfo_t *info, |
---|
151 | 193 | void *ucontext)); |
---|
152 | | -int perf_evlist__start_workload(struct perf_evlist *evlist); |
---|
| 194 | +int perf_evlist__start_workload(struct evlist *evlist); |
---|
153 | 195 | |
---|
154 | 196 | struct option; |
---|
155 | 197 | |
---|
.. | .. |
---|
160 | 202 | |
---|
161 | 203 | unsigned long perf_event_mlock_kb_in_pages(void); |
---|
162 | 204 | |
---|
163 | | -int perf_evlist__mmap_ex(struct perf_evlist *evlist, unsigned int pages, |
---|
| 205 | +int evlist__mmap_ex(struct evlist *evlist, unsigned int pages, |
---|
164 | 206 | unsigned int auxtrace_pages, |
---|
165 | | - bool auxtrace_overwrite); |
---|
166 | | -int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages); |
---|
167 | | -void perf_evlist__munmap(struct perf_evlist *evlist); |
---|
| 207 | + bool auxtrace_overwrite, int nr_cblocks, |
---|
| 208 | + int affinity, int flush, int comp_level); |
---|
| 209 | +int evlist__mmap(struct evlist *evlist, unsigned int pages); |
---|
| 210 | +void evlist__munmap(struct evlist *evlist); |
---|
168 | 211 | |
---|
169 | | -size_t perf_evlist__mmap_size(unsigned long pages); |
---|
| 212 | +size_t evlist__mmap_size(unsigned long pages); |
---|
170 | 213 | |
---|
171 | | -void perf_evlist__disable(struct perf_evlist *evlist); |
---|
172 | | -void perf_evlist__enable(struct perf_evlist *evlist); |
---|
173 | | -void perf_evlist__toggle_enable(struct perf_evlist *evlist); |
---|
| 214 | +void evlist__disable(struct evlist *evlist); |
---|
| 215 | +void evlist__enable(struct evlist *evlist); |
---|
| 216 | +void perf_evlist__toggle_enable(struct evlist *evlist); |
---|
174 | 217 | |
---|
175 | | -int perf_evlist__enable_event_idx(struct perf_evlist *evlist, |
---|
176 | | - struct perf_evsel *evsel, int idx); |
---|
| 218 | +int perf_evlist__enable_event_idx(struct evlist *evlist, |
---|
| 219 | + struct evsel *evsel, int idx); |
---|
177 | 220 | |
---|
178 | | -void perf_evlist__set_selected(struct perf_evlist *evlist, |
---|
179 | | - struct perf_evsel *evsel); |
---|
| 221 | +void perf_evlist__set_selected(struct evlist *evlist, |
---|
| 222 | + struct evsel *evsel); |
---|
180 | 223 | |
---|
181 | | -void perf_evlist__set_maps(struct perf_evlist *evlist, struct cpu_map *cpus, |
---|
182 | | - struct thread_map *threads); |
---|
183 | | -int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target); |
---|
184 | | -int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **err_evsel); |
---|
| 224 | +int perf_evlist__create_maps(struct evlist *evlist, struct target *target); |
---|
| 225 | +int perf_evlist__apply_filters(struct evlist *evlist, struct evsel **err_evsel); |
---|
185 | 226 | |
---|
186 | 227 | void __perf_evlist__set_leader(struct list_head *list); |
---|
187 | | -void perf_evlist__set_leader(struct perf_evlist *evlist); |
---|
| 228 | +void perf_evlist__set_leader(struct evlist *evlist); |
---|
188 | 229 | |
---|
189 | | -u64 perf_evlist__read_format(struct perf_evlist *evlist); |
---|
190 | | -u64 __perf_evlist__combined_sample_type(struct perf_evlist *evlist); |
---|
191 | | -u64 perf_evlist__combined_sample_type(struct perf_evlist *evlist); |
---|
192 | | -u64 perf_evlist__combined_branch_type(struct perf_evlist *evlist); |
---|
193 | | -bool perf_evlist__sample_id_all(struct perf_evlist *evlist); |
---|
194 | | -u16 perf_evlist__id_hdr_size(struct perf_evlist *evlist); |
---|
| 230 | +u64 __evlist__combined_sample_type(struct evlist *evlist); |
---|
| 231 | +u64 evlist__combined_sample_type(struct evlist *evlist); |
---|
| 232 | +u64 evlist__combined_branch_type(struct evlist *evlist); |
---|
| 233 | +bool evlist__sample_id_all(struct evlist *evlist); |
---|
| 234 | +u16 perf_evlist__id_hdr_size(struct evlist *evlist); |
---|
195 | 235 | |
---|
196 | | -int perf_evlist__parse_sample(struct perf_evlist *evlist, union perf_event *event, |
---|
| 236 | +int perf_evlist__parse_sample(struct evlist *evlist, union perf_event *event, |
---|
197 | 237 | struct perf_sample *sample); |
---|
198 | 238 | |
---|
199 | | -int perf_evlist__parse_sample_timestamp(struct perf_evlist *evlist, |
---|
| 239 | +int perf_evlist__parse_sample_timestamp(struct evlist *evlist, |
---|
200 | 240 | union perf_event *event, |
---|
201 | 241 | u64 *timestamp); |
---|
202 | 242 | |
---|
203 | | -bool perf_evlist__valid_sample_type(struct perf_evlist *evlist); |
---|
204 | | -bool perf_evlist__valid_sample_id_all(struct perf_evlist *evlist); |
---|
205 | | -bool perf_evlist__valid_read_format(struct perf_evlist *evlist); |
---|
| 243 | +bool evlist__valid_sample_type(struct evlist *evlist); |
---|
| 244 | +bool evlist__valid_sample_id_all(struct evlist *evlist); |
---|
| 245 | +bool perf_evlist__valid_read_format(struct evlist *evlist); |
---|
206 | 246 | |
---|
207 | | -void perf_evlist__splice_list_tail(struct perf_evlist *evlist, |
---|
| 247 | +void perf_evlist__splice_list_tail(struct evlist *evlist, |
---|
208 | 248 | struct list_head *list); |
---|
209 | 249 | |
---|
210 | | -static inline bool perf_evlist__empty(struct perf_evlist *evlist) |
---|
| 250 | +static inline bool perf_evlist__empty(struct evlist *evlist) |
---|
211 | 251 | { |
---|
212 | | - return list_empty(&evlist->entries); |
---|
| 252 | + return list_empty(&evlist->core.entries); |
---|
213 | 253 | } |
---|
214 | 254 | |
---|
215 | | -static inline struct perf_evsel *perf_evlist__first(struct perf_evlist *evlist) |
---|
| 255 | +static inline struct evsel *evlist__first(struct evlist *evlist) |
---|
216 | 256 | { |
---|
217 | | - return list_entry(evlist->entries.next, struct perf_evsel, node); |
---|
| 257 | + struct perf_evsel *evsel = perf_evlist__first(&evlist->core); |
---|
| 258 | + |
---|
| 259 | + return container_of(evsel, struct evsel, core); |
---|
218 | 260 | } |
---|
219 | 261 | |
---|
220 | | -static inline struct perf_evsel *perf_evlist__last(struct perf_evlist *evlist) |
---|
| 262 | +static inline struct evsel *evlist__last(struct evlist *evlist) |
---|
221 | 263 | { |
---|
222 | | - return list_entry(evlist->entries.prev, struct perf_evsel, node); |
---|
| 264 | + struct perf_evsel *evsel = perf_evlist__last(&evlist->core); |
---|
| 265 | + |
---|
| 266 | + return container_of(evsel, struct evsel, core); |
---|
223 | 267 | } |
---|
224 | 268 | |
---|
225 | | -size_t perf_evlist__fprintf(struct perf_evlist *evlist, FILE *fp); |
---|
| 269 | +int evlist__strerror_open(struct evlist *evlist, int err, char *buf, size_t size); |
---|
| 270 | +int evlist__strerror_mmap(struct evlist *evlist, int err, char *buf, size_t size); |
---|
226 | 271 | |
---|
227 | | -int perf_evlist__strerror_open(struct perf_evlist *evlist, int err, char *buf, size_t size); |
---|
228 | | -int perf_evlist__strerror_mmap(struct perf_evlist *evlist, int err, char *buf, size_t size); |
---|
229 | | - |
---|
230 | | -bool perf_evlist__can_select_event(struct perf_evlist *evlist, const char *str); |
---|
231 | | -void perf_evlist__to_front(struct perf_evlist *evlist, |
---|
232 | | - struct perf_evsel *move_evsel); |
---|
| 272 | +bool perf_evlist__can_select_event(struct evlist *evlist, const char *str); |
---|
| 273 | +void perf_evlist__to_front(struct evlist *evlist, |
---|
| 274 | + struct evsel *move_evsel); |
---|
233 | 275 | |
---|
234 | 276 | /** |
---|
235 | 277 | * __evlist__for_each_entry - iterate thru all the evsels |
---|
.. | .. |
---|
237 | 279 | * @evsel: struct evsel iterator |
---|
238 | 280 | */ |
---|
239 | 281 | #define __evlist__for_each_entry(list, evsel) \ |
---|
240 | | - list_for_each_entry(evsel, list, node) |
---|
| 282 | + list_for_each_entry(evsel, list, core.node) |
---|
241 | 283 | |
---|
242 | 284 | /** |
---|
243 | 285 | * evlist__for_each_entry - iterate thru all the evsels |
---|
.. | .. |
---|
245 | 287 | * @evsel: struct evsel iterator |
---|
246 | 288 | */ |
---|
247 | 289 | #define evlist__for_each_entry(evlist, evsel) \ |
---|
248 | | - __evlist__for_each_entry(&(evlist)->entries, evsel) |
---|
| 290 | + __evlist__for_each_entry(&(evlist)->core.entries, evsel) |
---|
249 | 291 | |
---|
250 | 292 | /** |
---|
251 | 293 | * __evlist__for_each_entry_continue - continue iteration thru all the evsels |
---|
.. | .. |
---|
253 | 295 | * @evsel: struct evsel iterator |
---|
254 | 296 | */ |
---|
255 | 297 | #define __evlist__for_each_entry_continue(list, evsel) \ |
---|
256 | | - list_for_each_entry_continue(evsel, list, node) |
---|
| 298 | + list_for_each_entry_continue(evsel, list, core.node) |
---|
257 | 299 | |
---|
258 | 300 | /** |
---|
259 | 301 | * evlist__for_each_entry_continue - continue iteration thru all the evsels |
---|
.. | .. |
---|
261 | 303 | * @evsel: struct evsel iterator |
---|
262 | 304 | */ |
---|
263 | 305 | #define evlist__for_each_entry_continue(evlist, evsel) \ |
---|
264 | | - __evlist__for_each_entry_continue(&(evlist)->entries, evsel) |
---|
| 306 | + __evlist__for_each_entry_continue(&(evlist)->core.entries, evsel) |
---|
265 | 307 | |
---|
266 | 308 | /** |
---|
267 | 309 | * __evlist__for_each_entry_reverse - iterate thru all the evsels in reverse order |
---|
.. | .. |
---|
269 | 311 | * @evsel: struct evsel iterator |
---|
270 | 312 | */ |
---|
271 | 313 | #define __evlist__for_each_entry_reverse(list, evsel) \ |
---|
272 | | - list_for_each_entry_reverse(evsel, list, node) |
---|
| 314 | + list_for_each_entry_reverse(evsel, list, core.node) |
---|
273 | 315 | |
---|
274 | 316 | /** |
---|
275 | 317 | * evlist__for_each_entry_reverse - iterate thru all the evsels in reverse order |
---|
.. | .. |
---|
277 | 319 | * @evsel: struct evsel iterator |
---|
278 | 320 | */ |
---|
279 | 321 | #define evlist__for_each_entry_reverse(evlist, evsel) \ |
---|
280 | | - __evlist__for_each_entry_reverse(&(evlist)->entries, evsel) |
---|
| 322 | + __evlist__for_each_entry_reverse(&(evlist)->core.entries, evsel) |
---|
281 | 323 | |
---|
282 | 324 | /** |
---|
283 | 325 | * __evlist__for_each_entry_safe - safely iterate thru all the evsels |
---|
.. | .. |
---|
286 | 328 | * @evsel: struct evsel iterator |
---|
287 | 329 | */ |
---|
288 | 330 | #define __evlist__for_each_entry_safe(list, tmp, evsel) \ |
---|
289 | | - list_for_each_entry_safe(evsel, tmp, list, node) |
---|
| 331 | + list_for_each_entry_safe(evsel, tmp, list, core.node) |
---|
290 | 332 | |
---|
291 | 333 | /** |
---|
292 | 334 | * evlist__for_each_entry_safe - safely iterate thru all the evsels |
---|
.. | .. |
---|
295 | 337 | * @tmp: struct evsel temp iterator |
---|
296 | 338 | */ |
---|
297 | 339 | #define evlist__for_each_entry_safe(evlist, tmp, evsel) \ |
---|
298 | | - __evlist__for_each_entry_safe(&(evlist)->entries, tmp, evsel) |
---|
| 340 | + __evlist__for_each_entry_safe(&(evlist)->core.entries, tmp, evsel) |
---|
299 | 341 | |
---|
300 | | -void perf_evlist__set_tracking_event(struct perf_evlist *evlist, |
---|
301 | | - struct perf_evsel *tracking_evsel); |
---|
| 342 | +#define evlist__for_each_cpu(evlist, index, cpu) \ |
---|
| 343 | + evlist__cpu_iter_start(evlist); \ |
---|
| 344 | + perf_cpu_map__for_each_cpu (cpu, index, (evlist)->core.all_cpus) |
---|
302 | 345 | |
---|
303 | | -void perf_event_attr__set_max_precise_ip(struct perf_event_attr *attr); |
---|
| 346 | +struct evsel *perf_evlist__get_tracking_event(struct evlist *evlist); |
---|
| 347 | +void perf_evlist__set_tracking_event(struct evlist *evlist, |
---|
| 348 | + struct evsel *tracking_evsel); |
---|
304 | 349 | |
---|
305 | | -struct perf_evsel * |
---|
306 | | -perf_evlist__find_evsel_by_str(struct perf_evlist *evlist, const char *str); |
---|
| 350 | +void evlist__cpu_iter_start(struct evlist *evlist); |
---|
| 351 | +bool evsel__cpu_iter_skip(struct evsel *ev, int cpu); |
---|
| 352 | +bool evsel__cpu_iter_skip_no_inc(struct evsel *ev, int cpu); |
---|
307 | 353 | |
---|
308 | | -struct perf_evsel *perf_evlist__event2evsel(struct perf_evlist *evlist, |
---|
| 354 | +struct evsel * |
---|
| 355 | +perf_evlist__find_evsel_by_str(struct evlist *evlist, const char *str); |
---|
| 356 | + |
---|
| 357 | +struct evsel *perf_evlist__event2evsel(struct evlist *evlist, |
---|
309 | 358 | union perf_event *event); |
---|
310 | 359 | |
---|
311 | | -bool perf_evlist__exclude_kernel(struct perf_evlist *evlist); |
---|
| 360 | +bool perf_evlist__exclude_kernel(struct evlist *evlist); |
---|
312 | 361 | |
---|
313 | | -void perf_evlist__force_leader(struct perf_evlist *evlist); |
---|
| 362 | +void perf_evlist__force_leader(struct evlist *evlist); |
---|
314 | 363 | |
---|
| 364 | +struct evsel *perf_evlist__reset_weak_group(struct evlist *evlist, |
---|
| 365 | + struct evsel *evsel, |
---|
| 366 | + bool close); |
---|
| 367 | +#define EVLIST_CTL_CMD_ENABLE_TAG "enable" |
---|
| 368 | +#define EVLIST_CTL_CMD_DISABLE_TAG "disable" |
---|
| 369 | +#define EVLIST_CTL_CMD_ACK_TAG "ack\n" |
---|
| 370 | +#define EVLIST_CTL_CMD_SNAPSHOT_TAG "snapshot" |
---|
| 371 | + |
---|
| 372 | +#define EVLIST_CTL_CMD_MAX_LEN 64 |
---|
| 373 | + |
---|
| 374 | +enum evlist_ctl_cmd { |
---|
| 375 | + EVLIST_CTL_CMD_UNSUPPORTED = 0, |
---|
| 376 | + EVLIST_CTL_CMD_ENABLE, |
---|
| 377 | + EVLIST_CTL_CMD_DISABLE, |
---|
| 378 | + EVLIST_CTL_CMD_ACK, |
---|
| 379 | + EVLIST_CTL_CMD_SNAPSHOT, |
---|
| 380 | +}; |
---|
| 381 | + |
---|
| 382 | +int evlist__parse_control(const char *str, int *ctl_fd, int *ctl_fd_ack, bool *ctl_fd_close); |
---|
| 383 | +void evlist__close_control(int ctl_fd, int ctl_fd_ack, bool *ctl_fd_close); |
---|
| 384 | +int evlist__initialize_ctlfd(struct evlist *evlist, int ctl_fd, int ctl_fd_ack); |
---|
| 385 | +int evlist__finalize_ctlfd(struct evlist *evlist); |
---|
| 386 | +bool evlist__ctlfd_initialized(struct evlist *evlist); |
---|
| 387 | +int evlist__ctlfd_process(struct evlist *evlist, enum evlist_ctl_cmd *cmd); |
---|
| 388 | +int evlist__ctlfd_ack(struct evlist *evlist); |
---|
| 389 | + |
---|
| 390 | +#define EVLIST_ENABLED_MSG "Events enabled\n" |
---|
| 391 | +#define EVLIST_DISABLED_MSG "Events disabled\n" |
---|
| 392 | + |
---|
| 393 | +struct evsel *evlist__find_evsel(struct evlist *evlist, int idx); |
---|
315 | 394 | #endif /* __PERF_EVLIST_H */ |
---|