Lines Matching refs:evsel

17 #include "evsel.h"
58 #include <perf/evsel.h>
110 struct evsel *evsel;
112 evlist__for_each_entry(evlist, evsel)
113 evsel__set_sample_id(evsel, /*can_sample_identifier=*/false);
140 struct evsel *first = evlist__first(evlist);
148 struct evsel *evsel;
150 evlist__for_each_entry(evlist, evsel)
151 evsel__calc_id_pos(evsel);
158 struct evsel *pos, *n;
190 void evlist__add(struct evlist *evlist, struct evsel *entry)
200 void evlist__remove(struct evlist *evlist, struct evsel *evsel)
202 evsel->evlist = NULL;
203 perf_evlist__remove(&evlist->core, &evsel->core);
209 struct evsel *evsel, *temp, *leader = NULL;
211 __evlist__for_each_entry_safe(list, temp, evsel) {
212 list_del_init(&evsel->core.node);
213 evlist__add(evlist, evsel);
214 leader = evsel;
218 __evlist__for_each_entry_safe(list, temp, evsel) {
219 if (evsel__has_leader(evsel, leader)) {
220 list_del_init(&evsel->core.node);
221 evlist__add(evlist, evsel);
235 struct evsel *evsel = evlist__find_tracepoint_by_name(evlist, assocs[i].name);
236 if (evsel == NULL)
240 if (evsel->handler != NULL)
242 evsel->handler = assocs[i].handler;
255 static struct evsel *evlist__dummy_event(struct evlist *evlist)
271 struct evsel *evsel = evlist__dummy_event(evlist);
273 if (evsel == NULL)
276 evlist__add(evlist, evsel);
280 struct evsel *evlist__add_aux_dummy(struct evlist *evlist, bool system_wide)
282 struct evsel *evsel = evlist__dummy_event(evlist);
284 if (!evsel)
287 evsel->core.attr.exclude_kernel = 1;
288 evsel->core.attr.exclude_guest = 1;
289 evsel->core.attr.exclude_hv = 1;
290 evsel->core.system_wide = system_wide;
291 evsel->no_aux_samples = true;
292 evsel->name = strdup("dummy:u");
294 evlist__add(evlist, evsel);
295 return evsel;
299 struct evsel *evlist__add_sched_switch(struct evlist *evlist, bool system_wide)
301 struct evsel *evsel = evsel__newtp_idx("sched", "sched_switch", 0);
303 if (IS_ERR(evsel))
304 return evsel;
306 evsel__set_sample_bit(evsel, CPU);
307 evsel__set_sample_bit(evsel, TIME);
309 evsel->core.system_wide = system_wide;
310 evsel->no_aux_samples = true;
312 evlist__add(evlist, evsel);
313 return evsel;
319 struct evsel *evsel, *n;
324 evsel = evsel__new_idx(attrs + i, evlist->core.nr_entries + i);
325 if (evsel == NULL)
327 list_add_tail(&evsel->core.node, &head);
335 __evlist__for_each_entry_safe(&head, n, evsel)
336 evsel__delete(evsel);
360 struct evsel *evlist__find_tracepoint_by_id(struct evlist *evlist, int id)
362 struct evsel *evsel;
364 evlist__for_each_entry(evlist, evsel) {
365 if (evsel->core.attr.type == PERF_TYPE_TRACEPOINT &&
366 (int)evsel->core.attr.config == id)
367 return evsel;
373 struct evsel *evlist__find_tracepoint_by_name(struct evlist *evlist, const char *name)
375 struct evsel *evsel;
377 evlist__for_each_entry(evlist, evsel) {
378 if ((evsel->core.attr.type == PERF_TYPE_TRACEPOINT) &&
379 (strcmp(evsel->name, name) == 0))
380 return evsel;
389 struct evsel *evsel = evsel__newtp(sys, name);
391 if (IS_ERR(evsel))
394 evsel->handler = handler;
395 evlist__add(evlist, evsel);
404 .evsel = NULL,
416 itr.evsel = evlist__first(evlist);
420 itr.cpu_map_idx = perf_cpu_map__idx(itr.evsel->core.cpus, itr.cpu);
422 * If this CPU isn't in the evsel's cpu map then advance
434 while (evlist_cpu_itr->evsel != evlist__last(evlist_cpu_itr->container)) {
435 evlist_cpu_itr->evsel = evsel__next(evlist_cpu_itr->evsel);
437 perf_cpu_map__idx(evlist_cpu_itr->evsel->core.cpus,
444 evlist_cpu_itr->evsel = evlist__first(evlist_cpu_itr->container);
451 perf_cpu_map__idx(evlist_cpu_itr->evsel->core.cpus,
454 * If this CPU isn't in the evsel's cpu map then advance through
467 static int evsel__strcmp(struct evsel *pos, char *evsel_name)
478 struct evsel *pos;
492 struct evsel *pos;
507 pos = evlist_cpu_itr.evsel;
562 struct evsel *pos;
574 pos = evlist_cpu_itr.evsel;
662 struct evsel *evlist__id2evsel(struct evlist *evlist, u64 id)
671 return container_of(sid->evsel, struct evsel, core);
679 struct evsel *evlist__id2evsel_strict(struct evlist *evlist, u64 id)
688 return container_of(sid->evsel, struct evsel, core);
713 struct evsel *evlist__event2evsel(struct evlist *evlist, union perf_event *event)
715 struct evsel *first = evlist__first(evlist);
740 return container_of(sid->evsel, struct evsel, core);
838 struct evsel *evsel = container_of(_evsel, struct evsel, core);
840 auxtrace_mmap_params__set_idx(&mp->auxtrace_mp, evlist, evsel, idx);
1006 * Its value is decided by evsel's write_backward.
1088 int evlist__apply_filters(struct evlist *evlist, struct evsel **err_evsel)
1090 struct evsel *evsel;
1093 evlist__for_each_entry(evlist, evsel) {
1096 * So evlist and evsel should always be same.
1098 if (evsel->filter) {
1099 err = perf_evsel__apply_filter(&evsel->core, evsel->filter);
1101 *err_evsel = evsel;
1109 if (!list_empty(&evsel->bpf_filters)) {
1110 err = perf_bpf_filter__prepare(evsel);
1112 *err_evsel = evsel;
1123 struct evsel *evsel;
1129 evlist__for_each_entry(evlist, evsel) {
1130 if (evsel->core.attr.type != PERF_TYPE_TRACEPOINT)
1133 err = evsel__set_filter(evsel, filter);
1143 struct evsel *evsel;
1149 evlist__for_each_entry(evlist, evsel) {
1150 if (evsel->core.attr.type != PERF_TYPE_TRACEPOINT)
1153 err = evsel__append_tp_filter(evsel, filter);
1217 struct evsel *pos;
1236 struct evsel *evsel;
1241 evlist__for_each_entry(evlist, evsel)
1242 evlist->combined_sample_type |= evsel->core.attr.sample_type;
1255 struct evsel *evsel;
1258 evlist__for_each_entry(evlist, evsel)
1259 branch_type |= evsel->core.attr.branch_sample_type;
1265 struct evsel *first = evlist__first(evlist), *pos = first;
1287 struct evsel *first = evlist__first(evlist);
1294 struct evsel *first = evlist__first(evlist), *pos = first;
1306 struct evsel *first = evlist__first(evlist);
1310 void evlist__set_selected(struct evlist *evlist, struct evsel *evsel)
1312 evlist->selected = evsel;
1317 struct evsel *evsel;
1327 evlist__for_each_entry_reverse(evlist, evsel)
1328 evsel__close(evsel);
1336 perf_evsel__close_cpu(&evlist_cpu_itr.evsel->core,
1341 evlist__for_each_entry_reverse(evlist, evsel) {
1342 perf_evsel__free_fd(&evsel->core);
1343 perf_evsel__free_id(&evsel->core);
1381 struct evsel *evsel;
1396 evlist__for_each_entry(evlist, evsel) {
1397 err = evsel__open(evsel, evsel->core.cpus, evsel->core.threads);
1550 struct evsel *evsel = evlist__event2evsel(evlist, event);
1553 if (!evsel)
1555 ret = evsel__parse_sample(evsel, event, sample);
1571 struct evsel *evsel = evlist__event2evsel(evlist, event);
1573 if (!evsel)
1575 return evsel__parse_sample_timestamp(evsel, event, timestamp);
1606 struct evsel *first = evlist__first(evlist);
1662 void evlist__to_front(struct evlist *evlist, struct evsel *move_evsel)
1664 struct evsel *evsel, *n;
1670 evlist__for_each_entry_safe(evlist, n, evsel) {
1671 if (evsel__leader(evsel) == evsel__leader(move_evsel))
1672 list_move_tail(&evsel->core.node, &move);
1678 struct evsel *evlist__get_tracking_event(struct evlist *evlist)
1680 struct evsel *evsel;
1682 evlist__for_each_entry(evlist, evsel) {
1683 if (evsel->tracking)
1684 return evsel;
1690 void evlist__set_tracking_event(struct evlist *evlist, struct evsel *tracking_evsel)
1692 struct evsel *evsel;
1697 evlist__for_each_entry(evlist, evsel) {
1698 if (evsel != tracking_evsel)
1699 evsel->tracking = false;
1705 struct evsel *evlist__findnew_tracking_event(struct evlist *evlist, bool system_wide)
1707 struct evsel *evsel;
1709 evsel = evlist__get_tracking_event(evlist);
1710 if (!evsel__is_dummy_event(evsel)) {
1711 evsel = evlist__add_aux_dummy(evlist, system_wide);
1712 if (!evsel)
1715 evlist__set_tracking_event(evlist, evsel);
1717 perf_evlist__go_system_wide(&evlist->core, &evsel->core);
1720 return evsel;
1723 struct evsel *evlist__find_evsel_by_str(struct evlist *evlist, const char *str)
1725 struct evsel *evsel;
1727 evlist__for_each_entry(evlist, evsel) {
1728 if (!evsel->name)
1730 if (evsel__name_is(evsel, str))
1731 return evsel;
1796 struct evsel *evsel;
1798 evlist__for_each_entry(evlist, evsel) {
1799 if (!evsel->core.attr.exclude_kernel)
1814 struct evsel *leader = evlist__first(evlist);
1821 struct evsel *evlist__reset_weak_group(struct evlist *evsel_list, struct evsel *evsel, bool close)
1823 struct evsel *c2, *leader;
1826 leader = evsel__leader(evsel);
1836 if (c2 == evsel)
2086 struct evsel *evsel;
2100 evsel = evlist__find_evsel_by_str(evlist, name);
2101 if (evsel) {
2106 pr_info("Event %s %s\n", evsel->name,
2127 struct evsel *evsel;
2152 evlist__for_each_entry(evlist, evsel)
2153 evsel__fprintf(evsel, &details, stderr);
2435 struct evsel *evlist__find_evsel(struct evlist *evlist, int idx)
2437 struct evsel *evsel;
2439 evlist__for_each_entry(evlist, evsel) {
2440 if (evsel->core.idx == idx)
2441 return evsel;
2448 struct evsel *evsel;
2451 evlist__for_each_entry(evlist, evsel) {
2452 if (evsel__is_dummy_event(evsel))
2454 if (size > (strlen(evsel__name(evsel)) + (printed ? 2 : 1))) {
2455 printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "," : "", evsel__name(evsel));
2467 struct evsel *leader, *evsel, *pos;
2476 evlist__for_each_entry(evlist, evsel) {
2477 leader = evsel__leader(evsel);
2478 if (leader == evsel)
2491 * evlist__warn_user_requested_cpus() - Check each evsel against requested CPUs
2502 struct evsel *pos;
2532 struct evsel *pos;