Lines Matching refs:evlist

64 void evlist__init(struct evlist *evlist, struct perf_cpu_map *cpus,  in evlist__init()  argument
67 perf_evlist__init(&evlist->core); in evlist__init()
68 perf_evlist__set_maps(&evlist->core, cpus, threads); in evlist__init()
69 evlist->workload.pid = -1; in evlist__init()
70 evlist->bkw_mmap_state = BKW_MMAP_NOTREADY; in evlist__init()
71 evlist->ctl_fd.fd = -1; in evlist__init()
72 evlist->ctl_fd.ack = -1; in evlist__init()
73 evlist->ctl_fd.pos = -1; in evlist__init()
76 struct evlist *evlist__new(void) in evlist__new()
78 struct evlist *evlist = zalloc(sizeof(*evlist)); in evlist__new() local
80 if (evlist != NULL) in evlist__new()
81 evlist__init(evlist, NULL, NULL); in evlist__new()
83 return evlist; in evlist__new()
86 struct evlist *evlist__new_default(void) in evlist__new_default()
88 struct evlist *evlist = evlist__new(); in evlist__new_default() local
90 if (evlist && evlist__add_default(evlist)) { in evlist__new_default()
91 evlist__delete(evlist); in evlist__new_default()
92 evlist = NULL; in evlist__new_default()
95 return evlist; in evlist__new_default()
98 struct evlist *evlist__new_dummy(void) in evlist__new_dummy()
100 struct evlist *evlist = evlist__new(); in evlist__new_dummy() local
102 if (evlist && evlist__add_dummy(evlist)) { in evlist__new_dummy()
103 evlist__delete(evlist); in evlist__new_dummy()
104 evlist = NULL; in evlist__new_dummy()
107 return evlist; in evlist__new_dummy()
117 void evlist__set_id_pos(struct evlist *evlist) in evlist__set_id_pos() argument
119 struct evsel *first = evlist__first(evlist); in evlist__set_id_pos()
121 evlist->id_pos = first->id_pos; in evlist__set_id_pos()
122 evlist->is_pos = first->is_pos; in evlist__set_id_pos()
125 static void evlist__update_id_pos(struct evlist *evlist) in evlist__update_id_pos() argument
129 evlist__for_each_entry(evlist, evsel) in evlist__update_id_pos()
132 evlist__set_id_pos(evlist); in evlist__update_id_pos()
135 static void evlist__purge(struct evlist *evlist) in evlist__purge() argument
139 evlist__for_each_entry_safe(evlist, n, pos) { in evlist__purge()
141 pos->evlist = NULL; in evlist__purge()
145 evlist->core.nr_entries = 0; in evlist__purge()
148 void evlist__exit(struct evlist *evlist) in evlist__exit() argument
150 zfree(&evlist->mmap); in evlist__exit()
151 zfree(&evlist->overwrite_mmap); in evlist__exit()
152 perf_evlist__exit(&evlist->core); in evlist__exit()
155 void evlist__delete(struct evlist *evlist) in evlist__delete() argument
157 if (evlist == NULL) in evlist__delete()
160 evlist__munmap(evlist); in evlist__delete()
161 evlist__close(evlist); in evlist__delete()
162 evlist__purge(evlist); in evlist__delete()
163 evlist__exit(evlist); in evlist__delete()
164 free(evlist); in evlist__delete()
167 void evlist__add(struct evlist *evlist, struct evsel *entry) in evlist__add() argument
169 perf_evlist__add(&evlist->core, &entry->core); in evlist__add()
170 entry->evlist = evlist; in evlist__add()
173 if (evlist->core.nr_entries == 1) in evlist__add()
174 evlist__set_id_pos(evlist); in evlist__add()
177 void evlist__remove(struct evlist *evlist, struct evsel *evsel) in evlist__remove() argument
179 evsel->evlist = NULL; in evlist__remove()
180 perf_evlist__remove(&evlist->core, &evsel->core); in evlist__remove()
183 void evlist__splice_list_tail(struct evlist *evlist, struct list_head *list) in evlist__splice_list_tail() argument
190 evlist__add(evlist, evsel); in evlist__splice_list_tail()
198 evlist__add(evlist, evsel); in evlist__splice_list_tail()
204 int __evlist__set_tracepoints_handlers(struct evlist *evlist, in __evlist__set_tracepoints_handlers() argument
212 struct evsel *evsel = evlist__find_tracepoint_by_name(evlist, assocs[i].name); in __evlist__set_tracepoints_handlers()
227 void evlist__set_leader(struct evlist *evlist) in evlist__set_leader() argument
229 perf_evlist__set_leader(&evlist->core); in evlist__set_leader()
232 int __evlist__add_default(struct evlist *evlist, bool precise) in __evlist__add_default() argument
241 evlist__add(evlist, evsel); in __evlist__add_default()
245 int evlist__add_dummy(struct evlist *evlist) in evlist__add_dummy() argument
252 struct evsel *evsel = evsel__new_idx(&attr, evlist->core.nr_entries); in evlist__add_dummy()
257 evlist__add(evlist, evsel); in evlist__add_dummy()
261 static int evlist__add_attrs(struct evlist *evlist, struct perf_event_attr *attrs, size_t nr_attrs) in evlist__add_attrs() argument
268 evsel = evsel__new_idx(attrs + i, evlist->core.nr_entries + i); in evlist__add_attrs()
274 evlist__splice_list_tail(evlist, &head); in evlist__add_attrs()
284 int __evlist__add_default_attrs(struct evlist *evlist, struct perf_event_attr *attrs, size_t nr_att… in __evlist__add_default_attrs() argument
291 return evlist__add_attrs(evlist, attrs, nr_attrs); in __evlist__add_default_attrs()
294 __weak int arch_evlist__add_default_attrs(struct evlist *evlist __maybe_unused) in arch_evlist__add_default_attrs()
299 struct evsel *evlist__find_tracepoint_by_id(struct evlist *evlist, int id) in evlist__find_tracepoint_by_id() argument
303 evlist__for_each_entry(evlist, evsel) { in evlist__find_tracepoint_by_id()
312 struct evsel *evlist__find_tracepoint_by_name(struct evlist *evlist, const char *name) in evlist__find_tracepoint_by_name() argument
316 evlist__for_each_entry(evlist, evsel) { in evlist__find_tracepoint_by_name()
325 int evlist__add_newtp(struct evlist *evlist, const char *sys, const char *name, void *handler) in evlist__add_newtp() argument
333 evlist__add(evlist, evsel); in evlist__add_newtp()
337 static int evlist__nr_threads(struct evlist *evlist, struct evsel *evsel) in evlist__nr_threads() argument
342 return perf_thread_map__nr(evlist->core.threads); in evlist__nr_threads()
345 void evlist__cpu_iter_start(struct evlist *evlist) in evlist__cpu_iter_start() argument
355 evlist__for_each_entry(evlist, pos) in evlist__cpu_iter_start()
386 static int evlist__is_enabled(struct evlist *evlist) in evlist__is_enabled() argument
390 evlist__for_each_entry(evlist, pos) { in evlist__is_enabled()
400 static void __evlist__disable(struct evlist *evlist, char *evsel_name) in __evlist__disable() argument
412 evlist__for_each_cpu(evlist, i, cpu) { in __evlist__disable()
415 evlist__for_each_entry(evlist, pos) { in __evlist__disable()
434 evlist__for_each_entry(evlist, pos) { in __evlist__disable()
447 evlist->enabled = evlist__is_enabled(evlist); in __evlist__disable()
449 evlist->enabled = false; in __evlist__disable()
452 void evlist__disable(struct evlist *evlist) in evlist__disable() argument
454 __evlist__disable(evlist, NULL); in evlist__disable()
457 void evlist__disable_evsel(struct evlist *evlist, char *evsel_name) in evlist__disable_evsel() argument
459 __evlist__disable(evlist, evsel_name); in evlist__disable_evsel()
462 static void __evlist__enable(struct evlist *evlist, char *evsel_name) in __evlist__enable() argument
471 evlist__for_each_cpu(evlist, i, cpu) { in __evlist__enable()
474 evlist__for_each_entry(evlist, pos) { in __evlist__enable()
485 evlist__for_each_entry(evlist, pos) { in __evlist__enable()
498 evlist->enabled = true; in __evlist__enable()
501 void evlist__enable(struct evlist *evlist) in evlist__enable() argument
503 __evlist__enable(evlist, NULL); in evlist__enable()
506 void evlist__enable_evsel(struct evlist *evlist, char *evsel_name) in evlist__enable_evsel() argument
508 __evlist__enable(evlist, evsel_name); in evlist__enable_evsel()
511 void evlist__toggle_enable(struct evlist *evlist) in evlist__toggle_enable() argument
513 (evlist->enabled ? evlist__disable : evlist__enable)(evlist); in evlist__toggle_enable()
516 static int evlist__enable_event_cpu(struct evlist *evlist, struct evsel *evsel, int cpu) in evlist__enable_event_cpu() argument
519 int nr_threads = evlist__nr_threads(evlist, evsel); in evlist__enable_event_cpu()
532 static int evlist__enable_event_thread(struct evlist *evlist, struct evsel *evsel, int thread) in evlist__enable_event_thread() argument
535 int nr_cpus = perf_cpu_map__nr(evlist->core.cpus); in evlist__enable_event_thread()
548 int evlist__enable_event_idx(struct evlist *evlist, struct evsel *evsel, int idx) in evlist__enable_event_idx() argument
550 bool per_cpu_mmaps = !perf_cpu_map__empty(evlist->core.cpus); in evlist__enable_event_idx()
553 return evlist__enable_event_cpu(evlist, evsel, idx); in evlist__enable_event_idx()
555 return evlist__enable_event_thread(evlist, evsel, idx); in evlist__enable_event_idx()
558 int evlist__add_pollfd(struct evlist *evlist, int fd) in evlist__add_pollfd() argument
560 return perf_evlist__add_pollfd(&evlist->core, fd, NULL, POLLIN, fdarray_flag__default); in evlist__add_pollfd()
563 int evlist__filter_pollfd(struct evlist *evlist, short revents_and_mask) in evlist__filter_pollfd() argument
565 return perf_evlist__filter_pollfd(&evlist->core, revents_and_mask); in evlist__filter_pollfd()
569 int evlist__add_wakeup_eventfd(struct evlist *evlist, int fd) in evlist__add_wakeup_eventfd() argument
571 return perf_evlist__add_pollfd(&evlist->core, fd, NULL, POLLIN, in evlist__add_wakeup_eventfd()
576 int evlist__poll(struct evlist *evlist, int timeout) in evlist__poll() argument
578 return perf_evlist__poll(&evlist->core, timeout); in evlist__poll()
581 struct perf_sample_id *evlist__id2sid(struct evlist *evlist, u64 id) in evlist__id2sid() argument
588 head = &evlist->core.heads[hash]; in evlist__id2sid()
597 struct evsel *evlist__id2evsel(struct evlist *evlist, u64 id) in evlist__id2evsel() argument
601 if (evlist->core.nr_entries == 1 || !id) in evlist__id2evsel()
602 return evlist__first(evlist); in evlist__id2evsel()
604 sid = evlist__id2sid(evlist, id); in evlist__id2evsel()
608 if (!evlist__sample_id_all(evlist)) in evlist__id2evsel()
609 return evlist__first(evlist); in evlist__id2evsel()
614 struct evsel *evlist__id2evsel_strict(struct evlist *evlist, u64 id) in evlist__id2evsel_strict() argument
621 sid = evlist__id2sid(evlist, id); in evlist__id2evsel_strict()
628 static int evlist__event2id(struct evlist *evlist, union perf_event *event, u64 *id) in evlist__event2id() argument
636 if (evlist->id_pos >= n) in evlist__event2id()
638 *id = array[evlist->id_pos]; in evlist__event2id()
640 if (evlist->is_pos > n) in evlist__event2id()
642 n -= evlist->is_pos; in evlist__event2id()
648 struct evsel *evlist__event2evsel(struct evlist *evlist, union perf_event *event) in evlist__event2evsel() argument
650 struct evsel *first = evlist__first(evlist); in evlist__event2evsel()
656 if (evlist->core.nr_entries == 1) in evlist__event2evsel()
663 if (evlist__event2id(evlist, event, &id)) in evlist__event2evsel()
671 head = &evlist->core.heads[hash]; in evlist__event2evsel()
680 static int evlist__set_paused(struct evlist *evlist, bool value) in evlist__set_paused() argument
684 if (!evlist->overwrite_mmap) in evlist__set_paused()
687 for (i = 0; i < evlist->core.nr_mmaps; i++) { in evlist__set_paused()
688 int fd = evlist->overwrite_mmap[i].core.fd; in evlist__set_paused()
700 static int evlist__pause(struct evlist *evlist) in evlist__pause() argument
702 return evlist__set_paused(evlist, true); in evlist__pause()
705 static int evlist__resume(struct evlist *evlist) in evlist__resume() argument
707 return evlist__set_paused(evlist, false); in evlist__resume()
710 static void evlist__munmap_nofree(struct evlist *evlist) in evlist__munmap_nofree() argument
714 if (evlist->mmap) in evlist__munmap_nofree()
715 for (i = 0; i < evlist->core.nr_mmaps; i++) in evlist__munmap_nofree()
716 perf_mmap__munmap(&evlist->mmap[i].core); in evlist__munmap_nofree()
718 if (evlist->overwrite_mmap) in evlist__munmap_nofree()
719 for (i = 0; i < evlist->core.nr_mmaps; i++) in evlist__munmap_nofree()
720 perf_mmap__munmap(&evlist->overwrite_mmap[i].core); in evlist__munmap_nofree()
723 void evlist__munmap(struct evlist *evlist) in evlist__munmap() argument
725 evlist__munmap_nofree(evlist); in evlist__munmap()
726 zfree(&evlist->mmap); in evlist__munmap()
727 zfree(&evlist->overwrite_mmap); in evlist__munmap()
737 static struct mmap *evlist__alloc_mmap(struct evlist *evlist, in evlist__alloc_mmap() argument
743 map = zalloc(evlist->core.nr_mmaps * sizeof(struct mmap)); in evlist__alloc_mmap()
747 for (i = 0; i < evlist->core.nr_mmaps; i++) { in evlist__alloc_mmap()
770 struct evlist *evlist = container_of(_evlist, struct evlist, core); in perf_evlist__mmap_cb_idx() local
773 auxtrace_mmap_params__set_idx(&mp->auxtrace_mp, evlist, idx, per_cpu); in perf_evlist__mmap_cb_idx()
779 struct evlist *evlist = container_of(_evlist, struct evlist, core); in perf_evlist__mmap_cb_get() local
782 maps = overwrite ? evlist->overwrite_mmap : evlist->mmap; in perf_evlist__mmap_cb_get()
785 maps = evlist__alloc_mmap(evlist, overwrite); in perf_evlist__mmap_cb_get()
790 evlist->overwrite_mmap = maps; in perf_evlist__mmap_cb_get()
791 if (evlist->bkw_mmap_state == BKW_MMAP_NOTREADY) in perf_evlist__mmap_cb_get()
792 evlist__toggle_bkw_mmap(evlist, BKW_MMAP_RUNNING); in perf_evlist__mmap_cb_get()
794 evlist->mmap = maps; in perf_evlist__mmap_cb_get()
932 int evlist__mmap_ex(struct evlist *evlist, unsigned int pages, in evlist__mmap_ex() argument
954 evlist->core.mmap_len = evlist__mmap_size(pages); in evlist__mmap_ex()
955 pr_debug("mmap size %zuB\n", evlist->core.mmap_len); in evlist__mmap_ex()
957 auxtrace_mmap_params__init(&mp.auxtrace_mp, evlist->core.mmap_len, in evlist__mmap_ex()
960 return perf_evlist__mmap_ops(&evlist->core, &ops, &mp.core); in evlist__mmap_ex()
963 int evlist__mmap(struct evlist *evlist, unsigned int pages) in evlist__mmap() argument
965 return evlist__mmap_ex(evlist, pages, 0, false, 0, PERF_AFFINITY_SYS, 1, 0); in evlist__mmap()
968 int evlist__create_maps(struct evlist *evlist, struct target *target) in evlist__create_maps() argument
1006 evlist->core.has_user_cpus = !!target->cpu_list && !target->hybrid; in evlist__create_maps()
1008 perf_evlist__set_maps(&evlist->core, cpus, threads); in evlist__create_maps()
1021 int evlist__apply_filters(struct evlist *evlist, struct evsel **err_evsel) in evlist__apply_filters() argument
1026 evlist__for_each_entry(evlist, evsel) { in evlist__apply_filters()
1044 int evlist__set_tp_filter(struct evlist *evlist, const char *filter) in evlist__set_tp_filter() argument
1052 evlist__for_each_entry(evlist, evsel) { in evlist__set_tp_filter()
1064 int evlist__append_tp_filter(struct evlist *evlist, const char *filter) in evlist__append_tp_filter() argument
1072 evlist__for_each_entry(evlist, evsel) { in evlist__append_tp_filter()
1110 int evlist__set_tp_filter_pids(struct evlist *evlist, size_t npids, pid_t *pids) in evlist__set_tp_filter_pids() argument
1113 int ret = evlist__set_tp_filter(evlist, filter); in evlist__set_tp_filter_pids()
1119 int evlist__set_tp_filter_pid(struct evlist *evlist, pid_t pid) in evlist__set_tp_filter_pid() argument
1121 return evlist__set_tp_filter_pids(evlist, 1, &pid); in evlist__set_tp_filter_pid()
1124 int evlist__append_tp_filter_pids(struct evlist *evlist, size_t npids, pid_t *pids) in evlist__append_tp_filter_pids() argument
1127 int ret = evlist__append_tp_filter(evlist, filter); in evlist__append_tp_filter_pids()
1133 int evlist__append_tp_filter_pid(struct evlist *evlist, pid_t pid) in evlist__append_tp_filter_pid() argument
1135 return evlist__append_tp_filter_pids(evlist, 1, &pid); in evlist__append_tp_filter_pid()
1138 bool evlist__valid_sample_type(struct evlist *evlist) in evlist__valid_sample_type() argument
1142 if (evlist->core.nr_entries == 1) in evlist__valid_sample_type()
1145 if (evlist->id_pos < 0 || evlist->is_pos < 0) in evlist__valid_sample_type()
1148 evlist__for_each_entry(evlist, pos) { in evlist__valid_sample_type()
1149 if (pos->id_pos != evlist->id_pos || in evlist__valid_sample_type()
1150 pos->is_pos != evlist->is_pos) in evlist__valid_sample_type()
1157 u64 __evlist__combined_sample_type(struct evlist *evlist) in __evlist__combined_sample_type() argument
1161 if (evlist->combined_sample_type) in __evlist__combined_sample_type()
1162 return evlist->combined_sample_type; in __evlist__combined_sample_type()
1164 evlist__for_each_entry(evlist, evsel) in __evlist__combined_sample_type()
1165 evlist->combined_sample_type |= evsel->core.attr.sample_type; in __evlist__combined_sample_type()
1167 return evlist->combined_sample_type; in __evlist__combined_sample_type()
1170 u64 evlist__combined_sample_type(struct evlist *evlist) in evlist__combined_sample_type() argument
1172 evlist->combined_sample_type = 0; in evlist__combined_sample_type()
1173 return __evlist__combined_sample_type(evlist); in evlist__combined_sample_type()
1176 u64 evlist__combined_branch_type(struct evlist *evlist) in evlist__combined_branch_type() argument
1181 evlist__for_each_entry(evlist, evsel) in evlist__combined_branch_type()
1186 bool evlist__valid_read_format(struct evlist *evlist) in evlist__valid_read_format() argument
1188 struct evsel *first = evlist__first(evlist), *pos = first; in evlist__valid_read_format()
1192 evlist__for_each_entry(evlist, pos) { in evlist__valid_read_format()
1208 u16 evlist__id_hdr_size(struct evlist *evlist) in evlist__id_hdr_size() argument
1210 struct evsel *first = evlist__first(evlist); in evlist__id_hdr_size()
1241 bool evlist__valid_sample_id_all(struct evlist *evlist) in evlist__valid_sample_id_all() argument
1243 struct evsel *first = evlist__first(evlist), *pos = first; in evlist__valid_sample_id_all()
1245 evlist__for_each_entry_continue(evlist, pos) { in evlist__valid_sample_id_all()
1253 bool evlist__sample_id_all(struct evlist *evlist) in evlist__sample_id_all() argument
1255 struct evsel *first = evlist__first(evlist); in evlist__sample_id_all()
1259 void evlist__set_selected(struct evlist *evlist, struct evsel *evsel) in evlist__set_selected() argument
1261 evlist->selected = evsel; in evlist__set_selected()
1264 void evlist__close(struct evlist *evlist) in evlist__close() argument
1274 if (!evlist->core.cpus) { in evlist__close()
1275 evlist__for_each_entry_reverse(evlist, evsel) in evlist__close()
1282 evlist__for_each_cpu(evlist, i, cpu) { in evlist__close()
1285 evlist__for_each_entry_reverse(evlist, evsel) { in evlist__close()
1292 evlist__for_each_entry_reverse(evlist, evsel) { in evlist__close()
1296 perf_evlist__reset_id_hash(&evlist->core); in evlist__close()
1299 static int evlist__create_syswide_maps(struct evlist *evlist) in evlist__create_syswide_maps() argument
1322 perf_evlist__set_maps(&evlist->core, cpus, threads); in evlist__create_syswide_maps()
1331 int evlist__open(struct evlist *evlist) in evlist__open() argument
1340 if (evlist->core.threads == NULL && evlist->core.cpus == NULL) { in evlist__open()
1341 err = evlist__create_syswide_maps(evlist); in evlist__open()
1346 evlist__update_id_pos(evlist); in evlist__open()
1348 evlist__for_each_entry(evlist, evsel) { in evlist__open()
1356 evlist__close(evlist); in evlist__open()
1361 int evlist__prepare_workload(struct evlist *evlist, struct target *target, const char *argv[], in evlist__prepare_workload() argument
1377 evlist->workload.pid = fork(); in evlist__prepare_workload()
1378 if (evlist->workload.pid < 0) { in evlist__prepare_workload()
1383 if (!evlist->workload.pid) { in evlist__prepare_workload()
1449 if (evlist->core.threads == NULL) { in evlist__prepare_workload()
1454 perf_thread_map__set_pid(evlist->core.threads, 0, evlist->workload.pid); in evlist__prepare_workload()
1468 evlist->workload.cork_fd = go_pipe[1]; in evlist__prepare_workload()
1481 int evlist__start_workload(struct evlist *evlist) in evlist__start_workload() argument
1483 if (evlist->workload.cork_fd > 0) { in evlist__start_workload()
1489 ret = write(evlist->workload.cork_fd, &bf, 1); in evlist__start_workload()
1493 close(evlist->workload.cork_fd); in evlist__start_workload()
1500 int evlist__parse_sample(struct evlist *evlist, union perf_event *event, struct perf_sample *sample) in evlist__parse_sample() argument
1502 struct evsel *evsel = evlist__event2evsel(evlist, event); in evlist__parse_sample()
1509 int evlist__parse_sample_timestamp(struct evlist *evlist, union perf_event *event, u64 *timestamp) in evlist__parse_sample_timestamp() argument
1511 struct evsel *evsel = evlist__event2evsel(evlist, event); in evlist__parse_sample_timestamp()
1518 int evlist__strerror_open(struct evlist *evlist, int err, char *buf, size_t size) in evlist__strerror_open() argument
1546 struct evsel *first = evlist__first(evlist); in evlist__strerror_open()
1571 int evlist__strerror_mmap(struct evlist *evlist, int err, char *buf, size_t size) in evlist__strerror_mmap() argument
1574 int pages_attempted = evlist->core.mmap_len / 1024, pages_max_per_user, printed = 0; in evlist__strerror_mmap()
1602 void evlist__to_front(struct evlist *evlist, struct evsel *move_evsel) in evlist__to_front() argument
1607 if (move_evsel == evlist__first(evlist)) in evlist__to_front()
1610 evlist__for_each_entry_safe(evlist, n, evsel) { in evlist__to_front()
1615 list_splice(&move, &evlist->core.entries); in evlist__to_front()
1618 struct evsel *evlist__get_tracking_event(struct evlist *evlist) in evlist__get_tracking_event() argument
1622 evlist__for_each_entry(evlist, evsel) { in evlist__get_tracking_event()
1627 return evlist__first(evlist); in evlist__get_tracking_event()
1630 void evlist__set_tracking_event(struct evlist *evlist, struct evsel *tracking_evsel) in evlist__set_tracking_event() argument
1637 evlist__for_each_entry(evlist, evsel) { in evlist__set_tracking_event()
1645 struct evsel *evlist__find_evsel_by_str(struct evlist *evlist, const char *str) in evlist__find_evsel_by_str() argument
1649 evlist__for_each_entry(evlist, evsel) { in evlist__find_evsel_by_str()
1659 void evlist__toggle_bkw_mmap(struct evlist *evlist, enum bkw_mmap_state state) in evlist__toggle_bkw_mmap() argument
1661 enum bkw_mmap_state old_state = evlist->bkw_mmap_state; in evlist__toggle_bkw_mmap()
1668 if (!evlist->overwrite_mmap) in evlist__toggle_bkw_mmap()
1698 evlist->bkw_mmap_state = state; in evlist__toggle_bkw_mmap()
1702 evlist__pause(evlist); in evlist__toggle_bkw_mmap()
1705 evlist__resume(evlist); in evlist__toggle_bkw_mmap()
1716 bool evlist__exclude_kernel(struct evlist *evlist) in evlist__exclude_kernel() argument
1720 evlist__for_each_entry(evlist, evsel) { in evlist__exclude_kernel()
1733 void evlist__force_leader(struct evlist *evlist) in evlist__force_leader() argument
1735 if (!evlist->core.nr_groups) { in evlist__force_leader()
1736 struct evsel *leader = evlist__first(evlist); in evlist__force_leader()
1738 evlist__set_leader(evlist); in evlist__force_leader()
1743 struct evsel *evlist__reset_weak_group(struct evlist *evsel_list, struct evsel *evsel, bool close) in evlist__reset_weak_group()
1860 int evlist__initialize_ctlfd(struct evlist *evlist, int fd, int ack) in evlist__initialize_ctlfd() argument
1867 evlist->ctl_fd.pos = perf_evlist__add_pollfd(&evlist->core, fd, NULL, POLLIN, in evlist__initialize_ctlfd()
1869 if (evlist->ctl_fd.pos < 0) { in evlist__initialize_ctlfd()
1870 evlist->ctl_fd.pos = -1; in evlist__initialize_ctlfd()
1875 evlist->ctl_fd.fd = fd; in evlist__initialize_ctlfd()
1876 evlist->ctl_fd.ack = ack; in evlist__initialize_ctlfd()
1881 bool evlist__ctlfd_initialized(struct evlist *evlist) in evlist__ctlfd_initialized() argument
1883 return evlist->ctl_fd.pos >= 0; in evlist__ctlfd_initialized()
1886 int evlist__finalize_ctlfd(struct evlist *evlist) in evlist__finalize_ctlfd() argument
1888 struct pollfd *entries = evlist->core.pollfd.entries; in evlist__finalize_ctlfd()
1890 if (!evlist__ctlfd_initialized(evlist)) in evlist__finalize_ctlfd()
1893 entries[evlist->ctl_fd.pos].fd = -1; in evlist__finalize_ctlfd()
1894 entries[evlist->ctl_fd.pos].events = 0; in evlist__finalize_ctlfd()
1895 entries[evlist->ctl_fd.pos].revents = 0; in evlist__finalize_ctlfd()
1897 evlist->ctl_fd.pos = -1; in evlist__finalize_ctlfd()
1898 evlist->ctl_fd.ack = -1; in evlist__finalize_ctlfd()
1899 evlist->ctl_fd.fd = -1; in evlist__finalize_ctlfd()
1904 static int evlist__ctlfd_recv(struct evlist *evlist, enum evlist_ctl_cmd *cmd, in evlist__ctlfd_recv() argument
1916 err = read(evlist->ctl_fd.fd, &c, 1); in evlist__ctlfd_recv()
1930 pr_err("Failed to read from ctlfd %d: %m\n", evlist->ctl_fd.fd); in evlist__ctlfd_recv()
1964 int evlist__ctlfd_ack(struct evlist *evlist) in evlist__ctlfd_ack() argument
1968 if (evlist->ctl_fd.ack == -1) in evlist__ctlfd_ack()
1971 err = write(evlist->ctl_fd.ack, EVLIST_CTL_CMD_ACK_TAG, in evlist__ctlfd_ack()
1974 pr_err("failed to write to ctl_ack_fd %d: %m\n", evlist->ctl_fd.ack); in evlist__ctlfd_ack()
1997 static int evlist__ctlfd_enable(struct evlist *evlist, char *cmd_data, bool enable) in evlist__ctlfd_enable() argument
2013 evsel = evlist__find_evsel_by_str(evlist, name); in evlist__ctlfd_enable()
2016 evlist__enable_evsel(evlist, name); in evlist__ctlfd_enable()
2018 evlist__disable_evsel(evlist, name); in evlist__ctlfd_enable()
2026 evlist__enable(evlist); in evlist__ctlfd_enable()
2029 evlist__disable(evlist); in evlist__ctlfd_enable()
2037 static int evlist__ctlfd_list(struct evlist *evlist, char *cmd_data) in evlist__ctlfd_list() argument
2065 evlist__for_each_entry(evlist, evsel) in evlist__ctlfd_list()
2071 int evlist__ctlfd_process(struct evlist *evlist, enum evlist_ctl_cmd *cmd) in evlist__ctlfd_process() argument
2075 int ctlfd_pos = evlist->ctl_fd.pos; in evlist__ctlfd_process()
2076 struct pollfd *entries = evlist->core.pollfd.entries; in evlist__ctlfd_process()
2078 if (!evlist__ctlfd_initialized(evlist) || !entries[ctlfd_pos].revents) in evlist__ctlfd_process()
2082 err = evlist__ctlfd_recv(evlist, cmd, cmd_data, in evlist__ctlfd_process()
2088 err = evlist__ctlfd_enable(evlist, cmd_data, in evlist__ctlfd_process()
2092 err = evlist__ctlfd_list(evlist, cmd_data); in evlist__ctlfd_process()
2106 evlist__ctlfd_ack(evlist); in evlist__ctlfd_process()
2111 evlist__finalize_ctlfd(evlist); in evlist__ctlfd_process()
2118 struct evsel *evlist__find_evsel(struct evlist *evlist, int idx) in evlist__find_evsel() argument
2122 evlist__for_each_entry(evlist, evsel) { in evlist__find_evsel()
2129 int evlist__scnprintf_evsels(struct evlist *evlist, size_t size, char *bf) in evlist__scnprintf_evsels() argument
2134 evlist__for_each_entry(evlist, evsel) { in evlist__scnprintf_evsels()
2148 void evlist__check_mem_load_aux(struct evlist *evlist) in evlist__check_mem_load_aux() argument
2159 evlist__for_each_entry(evlist, evsel) { in evlist__check_mem_load_aux()