Lines Matching refs:evsel
90 static int evsel__no_extra_init(struct evsel *evsel __maybe_unused) in evsel__no_extra_init()
97 static void evsel__no_extra_fini(struct evsel *evsel __maybe_unused) in evsel__no_extra_fini()
103 int (*init)(struct evsel *evsel);
104 void (*fini)(struct evsel *evsel);
106 .size = sizeof(struct evsel),
111 int evsel__object_config(size_t object_size, int (*init)(struct evsel *evsel), in evsel__object_config() argument
112 void (*fini)(struct evsel *evsel)) in evsel__object_config() argument
211 void evsel__calc_id_pos(struct evsel *evsel) in evsel__calc_id_pos() argument
213 evsel->id_pos = __perf_evsel__calc_id_pos(evsel->core.attr.sample_type); in evsel__calc_id_pos()
214 evsel->is_pos = __perf_evsel__calc_is_pos(evsel->core.attr.sample_type); in evsel__calc_id_pos()
217 void __evsel__set_sample_bit(struct evsel *evsel, in __evsel__set_sample_bit() argument
220 if (!(evsel->core.attr.sample_type & bit)) { in __evsel__set_sample_bit()
221 evsel->core.attr.sample_type |= bit; in __evsel__set_sample_bit()
222 evsel->sample_size += sizeof(u64); in __evsel__set_sample_bit()
223 evsel__calc_id_pos(evsel); in __evsel__set_sample_bit()
227 void __evsel__reset_sample_bit(struct evsel *evsel, in __evsel__reset_sample_bit() argument
230 if (evsel->core.attr.sample_type & bit) { in __evsel__reset_sample_bit()
231 evsel->core.attr.sample_type &= ~bit; in __evsel__reset_sample_bit()
232 evsel->sample_size -= sizeof(u64); in __evsel__reset_sample_bit()
233 evsel__calc_id_pos(evsel); in __evsel__reset_sample_bit()
237 void evsel__set_sample_id(struct evsel *evsel, in evsel__set_sample_id() argument
241 evsel__reset_sample_bit(evsel, ID); in evsel__set_sample_id()
242 evsel__set_sample_bit(evsel, IDENTIFIER); in evsel__set_sample_id()
244 evsel__set_sample_bit(evsel, ID); in evsel__set_sample_id()
246 evsel->core.attr.read_format |= PERF_FORMAT_ID; in evsel__set_sample_id()
257 bool evsel__is_function_event(struct evsel *evsel) in evsel__is_function_event() argument
261 return evsel->name && in evsel__is_function_event()
262 !strncmp(FUNCTION_EVENT, evsel->name, sizeof(FUNCTION_EVENT)); in evsel__is_function_event()
267 void evsel__init(struct evsel *evsel, in evsel__init() argument
270 perf_evsel__init(&evsel->core, attr, idx); in evsel__init()
271 evsel->tracking = !idx; in evsel__init()
272 evsel->unit = strdup(""); in evsel__init()
273 evsel->scale = 1.0; in evsel__init()
274 evsel->max_events = ULONG_MAX; in evsel__init()
275 evsel->evlist = NULL; in evsel__init()
276 evsel->bpf_obj = NULL; in evsel__init()
277 evsel->bpf_fd = -1; in evsel__init()
278 INIT_LIST_HEAD(&evsel->config_terms); in evsel__init()
279 INIT_LIST_HEAD(&evsel->bpf_counter_list); in evsel__init()
280 perf_evsel__object.init(evsel); in evsel__init()
281 evsel->sample_size = __evsel__sample_size(attr->sample_type); in evsel__init()
282 evsel__calc_id_pos(evsel); in evsel__init()
283 evsel->cmdline_group_boundary = false; in evsel__init()
284 evsel->metric_expr = NULL; in evsel__init()
285 evsel->metric_name = NULL; in evsel__init()
286 evsel->metric_events = NULL; in evsel__init()
287 evsel->per_pkg_mask = NULL; in evsel__init()
288 evsel->collect_stat = false; in evsel__init()
289 evsel->pmu_name = NULL; in evsel__init()
292 struct evsel *evsel__new_idx(struct perf_event_attr *attr, int idx) in evsel__new_idx()
294 struct evsel *evsel = zalloc(perf_evsel__object.size); in evsel__new_idx() local
296 if (!evsel) in evsel__new_idx()
298 evsel__init(evsel, attr, idx); in evsel__new_idx()
300 if (evsel__is_bpf_output(evsel) && !attr->sample_type) { in evsel__new_idx()
301 evsel->core.attr.sample_type = (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | in evsel__new_idx()
303 evsel->core.attr.sample_period = 1; in evsel__new_idx()
306 if (evsel__is_clock(evsel)) { in evsel__new_idx()
307 free((char *)evsel->unit); in evsel__new_idx()
308 evsel->unit = strdup("msec"); in evsel__new_idx()
309 evsel->scale = 1e-6; in evsel__new_idx()
312 return evsel; in evsel__new_idx()
320 struct evsel *evsel__new_cycles(bool precise __maybe_unused, __u32 type, __u64 config) in evsel__new_cycles()
327 struct evsel *evsel; in evsel__new_cycles() local
335 evsel = evsel__new(&attr); in evsel__new_cycles()
336 if (evsel == NULL) in evsel__new_cycles()
339 arch_evsel__fixup_new_cycles(&evsel->core.attr); in evsel__new_cycles()
341 evsel->precise_max = true; in evsel__new_cycles()
344 if (asprintf(&evsel->name, "cycles%s%s%.*s", in evsel__new_cycles()
350 return evsel; in evsel__new_cycles()
352 evsel__delete(evsel); in evsel__new_cycles()
353 evsel = NULL; in evsel__new_cycles()
379 static int evsel__copy_config_terms(struct evsel *dst, struct evsel *src) in evsel__copy_config_terms()
391 struct evsel *evsel__clone(struct evsel *orig) in evsel__clone()
393 struct evsel *evsel; in evsel__clone() local
404 evsel = evsel__new(&orig->core.attr); in evsel__clone()
405 if (evsel == NULL) in evsel__clone()
408 evsel->core.cpus = perf_cpu_map__get(orig->core.cpus); in evsel__clone()
409 evsel->core.own_cpus = perf_cpu_map__get(orig->core.own_cpus); in evsel__clone()
410 evsel->core.threads = perf_thread_map__get(orig->core.threads); in evsel__clone()
411 evsel->core.nr_members = orig->core.nr_members; in evsel__clone()
412 evsel->core.system_wide = orig->core.system_wide; in evsel__clone()
413 evsel->core.requires_cpu = orig->core.requires_cpu; in evsel__clone()
416 evsel->name = strdup(orig->name); in evsel__clone()
417 if (evsel->name == NULL) in evsel__clone()
421 evsel->group_name = strdup(orig->group_name); in evsel__clone()
422 if (evsel->group_name == NULL) in evsel__clone()
426 evsel->pmu_name = strdup(orig->pmu_name); in evsel__clone()
427 if (evsel->pmu_name == NULL) in evsel__clone()
431 evsel->filter = strdup(orig->filter); in evsel__clone()
432 if (evsel->filter == NULL) in evsel__clone()
436 evsel->metric_id = strdup(orig->metric_id); in evsel__clone()
437 if (evsel->metric_id == NULL) in evsel__clone()
440 evsel->cgrp = cgroup__get(orig->cgrp); in evsel__clone()
441 evsel->tp_format = orig->tp_format; in evsel__clone()
442 evsel->handler = orig->handler; in evsel__clone()
443 evsel->core.leader = orig->core.leader; in evsel__clone()
445 evsel->max_events = orig->max_events; in evsel__clone()
446 evsel->tool_event = orig->tool_event; in evsel__clone()
447 free((char *)evsel->unit); in evsel__clone()
448 evsel->unit = strdup(orig->unit); in evsel__clone()
449 if (evsel->unit == NULL) in evsel__clone()
452 evsel->scale = orig->scale; in evsel__clone()
453 evsel->snapshot = orig->snapshot; in evsel__clone()
454 evsel->per_pkg = orig->per_pkg; in evsel__clone()
455 evsel->percore = orig->percore; in evsel__clone()
456 evsel->precise_max = orig->precise_max; in evsel__clone()
457 evsel->use_uncore_alias = orig->use_uncore_alias; in evsel__clone()
458 evsel->is_libpfm_event = orig->is_libpfm_event; in evsel__clone()
460 evsel->exclude_GH = orig->exclude_GH; in evsel__clone()
461 evsel->sample_read = orig->sample_read; in evsel__clone()
462 evsel->auto_merge_stats = orig->auto_merge_stats; in evsel__clone()
463 evsel->collect_stat = orig->collect_stat; in evsel__clone()
464 evsel->weak_group = orig->weak_group; in evsel__clone()
465 evsel->use_config_name = orig->use_config_name; in evsel__clone()
467 if (evsel__copy_config_terms(evsel, orig) < 0) in evsel__clone()
470 return evsel; in evsel__clone()
473 evsel__delete(evsel); in evsel__clone()
480 struct evsel *evsel__newtp_idx(const char *sys, const char *name, int idx) in evsel__newtp_idx()
482 struct evsel *evsel = zalloc(perf_evsel__object.size); in evsel__newtp_idx() local
485 if (evsel == NULL) { in evsel__newtp_idx()
494 if (asprintf(&evsel->name, "%s:%s", sys, name) < 0) in evsel__newtp_idx()
497 evsel->tp_format = trace_event__tp_format(sys, name); in evsel__newtp_idx()
498 if (IS_ERR(evsel->tp_format)) { in evsel__newtp_idx()
499 err = PTR_ERR(evsel->tp_format); in evsel__newtp_idx()
504 attr.config = evsel->tp_format->id; in evsel__newtp_idx()
506 evsel__init(evsel, &attr, idx); in evsel__newtp_idx()
509 return evsel; in evsel__newtp_idx()
512 zfree(&evsel->name); in evsel__newtp_idx()
513 free(evsel); in evsel__newtp_idx()
561 static int evsel__add_modifiers(struct evsel *evsel, char *bf, size_t size) in evsel__add_modifiers() argument
564 struct perf_event_attr *attr = &evsel->core.attr; in evsel__add_modifiers()
597 static int evsel__hw_name(struct evsel *evsel, char *bf, size_t size) in evsel__hw_name() argument
599 int r = scnprintf(bf, size, "%s", __evsel__hw_name(evsel->core.attr.config)); in evsel__hw_name()
600 return r + evsel__add_modifiers(evsel, bf + r, size - r); in evsel__hw_name()
623 static int evsel__sw_name(struct evsel *evsel, char *bf, size_t size) in evsel__sw_name() argument
625 int r = scnprintf(bf, size, "%s", __evsel__sw_name(evsel->core.attr.config)); in evsel__sw_name()
626 return r + evsel__add_modifiers(evsel, bf + r, size - r); in evsel__sw_name()
652 static int evsel__bp_name(struct evsel *evsel, char *bf, size_t size) in evsel__bp_name() argument
654 struct perf_event_attr *attr = &evsel->core.attr; in evsel__bp_name()
656 return r + evsel__add_modifiers(evsel, bf + r, size - r); in evsel__bp_name()
748 static int evsel__hw_cache_name(struct evsel *evsel, char *bf, size_t size) in evsel__hw_cache_name() argument
750 int ret = __evsel__hw_cache_name(evsel->core.attr.config, bf, size); in evsel__hw_cache_name()
751 return ret + evsel__add_modifiers(evsel, bf + ret, size - ret); in evsel__hw_cache_name()
754 static int evsel__raw_name(struct evsel *evsel, char *bf, size_t size) in evsel__raw_name() argument
756 int ret = scnprintf(bf, size, "raw 0x%" PRIx64, evsel->core.attr.config); in evsel__raw_name()
757 return ret + evsel__add_modifiers(evsel, bf + ret, size - ret); in evsel__raw_name()
760 const char *evsel__name(struct evsel *evsel) in evsel__name() argument
764 if (!evsel) in evsel__name()
767 if (evsel->name) in evsel__name()
768 return evsel->name; in evsel__name()
770 switch (evsel->core.attr.type) { in evsel__name()
772 evsel__raw_name(evsel, bf, sizeof(bf)); in evsel__name()
776 evsel__hw_name(evsel, bf, sizeof(bf)); in evsel__name()
780 evsel__hw_cache_name(evsel, bf, sizeof(bf)); in evsel__name()
784 if (evsel__is_tool(evsel)) in evsel__name()
785 evsel__tool_name(evsel->tool_event, bf, sizeof(bf)); in evsel__name()
787 evsel__sw_name(evsel, bf, sizeof(bf)); in evsel__name()
795 evsel__bp_name(evsel, bf, sizeof(bf)); in evsel__name()
800 evsel->core.attr.type); in evsel__name()
804 evsel->name = strdup(bf); in evsel__name()
806 if (evsel->name) in evsel__name()
807 return evsel->name; in evsel__name()
812 const char *evsel__metric_id(const struct evsel *evsel) in evsel__metric_id() argument
814 if (evsel->metric_id) in evsel__metric_id()
815 return evsel->metric_id; in evsel__metric_id()
817 if (evsel__is_tool(evsel)) in evsel__metric_id()
818 return perf_tool_event__to_str(evsel->tool_event); in evsel__metric_id()
823 const char *evsel__group_name(struct evsel *evsel) in evsel__group_name() argument
825 return evsel->group_name ?: "anon group"; in evsel__group_name()
838 int evsel__group_desc(struct evsel *evsel, char *buf, size_t size) in evsel__group_desc() argument
841 struct evsel *pos; in evsel__group_desc()
842 const char *group_name = evsel__group_name(evsel); in evsel__group_desc()
844 if (!evsel->forced_leader) in evsel__group_desc()
847 ret += scnprintf(buf + ret, size - ret, "%s", evsel__name(evsel)); in evsel__group_desc()
849 for_each_group_member(pos, evsel) in evsel__group_desc()
852 if (!evsel->forced_leader) in evsel__group_desc()
858 static void __evsel__config_callchain(struct evsel *evsel, struct record_opts *opts, in __evsel__config_callchain() argument
861 bool function = evsel__is_function_event(evsel); in __evsel__config_callchain()
862 struct perf_event_attr *attr = &evsel->core.attr; in __evsel__config_callchain()
864 evsel__set_sample_bit(evsel, CALLCHAIN); in __evsel__config_callchain()
879 evsel__set_sample_bit(evsel, BRANCH_STACK); in __evsel__config_callchain()
893 evsel__set_sample_bit(evsel, REGS_USER); in __evsel__config_callchain()
894 evsel__set_sample_bit(evsel, STACK_USER); in __evsel__config_callchain()
917 void evsel__config_callchain(struct evsel *evsel, struct record_opts *opts, in evsel__config_callchain() argument
921 return __evsel__config_callchain(evsel, opts, param); in evsel__config_callchain()
924 static void evsel__reset_callgraph(struct evsel *evsel, struct callchain_param *param) in evsel__reset_callgraph() argument
926 struct perf_event_attr *attr = &evsel->core.attr; in evsel__reset_callgraph()
928 evsel__reset_sample_bit(evsel, CALLCHAIN); in evsel__reset_callgraph()
930 evsel__reset_sample_bit(evsel, BRANCH_STACK); in evsel__reset_callgraph()
936 evsel__reset_sample_bit(evsel, REGS_USER); in evsel__reset_callgraph()
937 evsel__reset_sample_bit(evsel, STACK_USER); in evsel__reset_callgraph()
941 static void evsel__apply_config_terms(struct evsel *evsel, in evsel__apply_config_terms() argument
945 struct list_head *config_terms = &evsel->config_terms; in evsel__apply_config_terms()
946 struct perf_event_attr *attr = &evsel->core.attr; in evsel__apply_config_terms()
961 evsel__reset_sample_bit(evsel, PERIOD); in evsel__apply_config_terms()
968 evsel__set_sample_bit(evsel, PERIOD); in evsel__apply_config_terms()
973 evsel__set_sample_bit(evsel, TIME); in evsel__apply_config_terms()
975 evsel__reset_sample_bit(evsel, TIME); in evsel__apply_config_terms()
982 evsel__set_sample_bit(evsel, BRANCH_STACK); in evsel__apply_config_terms()
986 evsel__reset_sample_bit(evsel, BRANCH_STACK); in evsel__apply_config_terms()
995 evsel->max_events = term->val.max_events; in evsel__apply_config_terms()
1046 evsel->name); in evsel__apply_config_terms()
1060 evsel__reset_callgraph(evsel, &callchain_param); in evsel__apply_config_terms()
1065 evsel__set_sample_bit(evsel, ADDR); in evsel__apply_config_terms()
1066 evsel__set_sample_bit(evsel, DATA_SRC); in evsel__apply_config_terms()
1067 evsel->core.attr.mmap_data = track; in evsel__apply_config_terms()
1069 evsel__config_callchain(evsel, opts, ¶m); in evsel__apply_config_terms()
1074 struct evsel_config_term *__evsel__get_config_term(struct evsel *evsel, enum evsel_term_type type) in __evsel__get_config_term() argument
1078 list_for_each_entry(term, &evsel->config_terms, list) { in __evsel__get_config_term()
1086 void __weak arch_evsel__set_sample_weight(struct evsel *evsel) in arch_evsel__set_sample_weight() argument
1088 evsel__set_sample_bit(evsel, WEIGHT); in arch_evsel__set_sample_weight()
1106 static bool evsel__is_offcpu_event(struct evsel *evsel) in evsel__is_offcpu_event() argument
1108 return evsel__is_bpf_output(evsel) && !strcmp(evsel->name, OFFCPU_EVENT); in evsel__is_offcpu_event()
1139 void evsel__config(struct evsel *evsel, struct record_opts *opts, in evsel__config() argument
1142 struct evsel *leader = evsel__leader(evsel); in evsel__config()
1143 struct perf_event_attr *attr = &evsel->core.attr; in evsel__config()
1144 int track = evsel->tracking; in evsel__config()
1151 evsel__set_sample_bit(evsel, IP); in evsel__config()
1152 evsel__set_sample_bit(evsel, TID); in evsel__config()
1154 if (evsel->sample_read) { in evsel__config()
1155 evsel__set_sample_bit(evsel, READ); in evsel__config()
1161 evsel__set_sample_id(evsel, false); in evsel__config()
1177 if ((evsel->is_libpfm_event && !attr->sample_period) || in evsel__config()
1178 (!evsel->is_libpfm_event && (!attr->sample_period || in evsel__config()
1188 evsel__set_sample_bit(evsel, PERIOD); in evsel__config()
1194 evsel->core.attr.read_format |= in evsel__config()
1202 evsel__set_sample_bit(evsel, ADDR); in evsel__config()
1211 if (evsel__is_function_event(evsel)) in evsel__config()
1212 evsel->core.attr.exclude_callchain_user = 1; in evsel__config()
1214 if (callchain && callchain->enabled && !evsel->no_aux_samples) in evsel__config()
1215 evsel__config_callchain(evsel, opts, callchain); in evsel__config()
1217 if (opts->sample_intr_regs && !evsel->no_aux_samples && in evsel__config()
1218 !evsel__is_dummy_event(evsel)) { in evsel__config()
1220 evsel__set_sample_bit(evsel, REGS_INTR); in evsel__config()
1223 if (opts->sample_user_regs && !evsel->no_aux_samples && in evsel__config()
1224 !evsel__is_dummy_event(evsel)) { in evsel__config()
1226 evsel__set_sample_bit(evsel, REGS_USER); in evsel__config()
1230 evsel__set_sample_bit(evsel, CPU); in evsel__config()
1239 evsel__set_sample_bit(evsel, TIME); in evsel__config()
1241 if (opts->raw_samples && !evsel->no_aux_samples) { in evsel__config()
1242 evsel__set_sample_bit(evsel, TIME); in evsel__config()
1243 evsel__set_sample_bit(evsel, RAW); in evsel__config()
1244 evsel__set_sample_bit(evsel, CPU); in evsel__config()
1248 evsel__set_sample_bit(evsel, DATA_SRC); in evsel__config()
1251 evsel__set_sample_bit(evsel, PHYS_ADDR); in evsel__config()
1257 if (opts->branch_stack && !evsel->no_aux_samples) { in evsel__config()
1258 evsel__set_sample_bit(evsel, BRANCH_STACK); in evsel__config()
1263 arch_evsel__set_sample_weight(evsel); in evsel__config()
1284 evsel__set_sample_bit(evsel, CGROUP); in evsel__config()
1288 evsel__set_sample_bit(evsel, DATA_PAGE_SIZE); in evsel__config()
1291 evsel__set_sample_bit(evsel, CODE_PAGE_SIZE); in evsel__config()
1297 evsel__set_sample_bit(evsel, TRANSACTION); in evsel__config()
1300 evsel->core.attr.read_format |= in evsel__config()
1311 if (evsel__is_group_leader(evsel)) in evsel__config()
1318 if (target__none(&opts->target) && evsel__is_group_leader(evsel) && in evsel__config()
1322 if (evsel->immediate) { in evsel__config()
1333 if (evsel->precise_max) in evsel__config()
1346 if (evsel->core.own_cpus || evsel->unit) in evsel__config()
1347 evsel->core.attr.read_format |= PERF_FORMAT_ID; in evsel__config()
1353 evsel__apply_config_terms(evsel, opts, track); in evsel__config()
1355 evsel->ignore_missing_thread = opts->ignore_missing_thread; in evsel__config()
1360 evsel__set_sample_bit(evsel, PERIOD); in evsel__config()
1362 evsel__reset_sample_bit(evsel, PERIOD); in evsel__config()
1373 if (evsel__is_dummy_event(evsel)) in evsel__config()
1374 evsel__reset_sample_bit(evsel, BRANCH_STACK); in evsel__config()
1376 if (evsel__is_offcpu_event(evsel)) in evsel__config()
1377 evsel->core.attr.sample_type &= OFFCPU_SAMPLE_TYPES; in evsel__config()
1380 int evsel__set_filter(struct evsel *evsel, const char *filter) in evsel__set_filter() argument
1385 free(evsel->filter); in evsel__set_filter()
1386 evsel->filter = new_filter; in evsel__set_filter()
1393 static int evsel__append_filter(struct evsel *evsel, const char *fmt, const char *filter) in evsel__append_filter() argument
1397 if (evsel->filter == NULL) in evsel__append_filter()
1398 return evsel__set_filter(evsel, filter); in evsel__append_filter()
1400 if (asprintf(&new_filter, fmt, evsel->filter, filter) > 0) { in evsel__append_filter()
1401 free(evsel->filter); in evsel__append_filter()
1402 evsel->filter = new_filter; in evsel__append_filter()
1409 int evsel__append_tp_filter(struct evsel *evsel, const char *filter) in evsel__append_tp_filter() argument
1411 return evsel__append_filter(evsel, "(%s) && (%s)", filter); in evsel__append_tp_filter()
1414 int evsel__append_addr_filter(struct evsel *evsel, const char *filter) in evsel__append_addr_filter() argument
1416 return evsel__append_filter(evsel, "%s,%s", filter); in evsel__append_addr_filter()
1420 int evsel__enable_cpu(struct evsel *evsel, int cpu_map_idx) in evsel__enable_cpu() argument
1422 return perf_evsel__enable_cpu(&evsel->core, cpu_map_idx); in evsel__enable_cpu()
1425 int evsel__enable(struct evsel *evsel) in evsel__enable() argument
1427 int err = perf_evsel__enable(&evsel->core); in evsel__enable()
1430 evsel->disabled = false; in evsel__enable()
1435 int evsel__disable_cpu(struct evsel *evsel, int cpu_map_idx) in evsel__disable_cpu() argument
1437 return perf_evsel__disable_cpu(&evsel->core, cpu_map_idx); in evsel__disable_cpu()
1440 int evsel__disable(struct evsel *evsel) in evsel__disable() argument
1442 int err = perf_evsel__disable(&evsel->core); in evsel__disable()
1450 evsel->disabled = true; in evsel__disable()
1467 static void evsel__free_config_terms(struct evsel *evsel) in evsel__free_config_terms() argument
1469 free_config_terms(&evsel->config_terms); in evsel__free_config_terms()
1472 void evsel__exit(struct evsel *evsel) in evsel__exit() argument
1474 assert(list_empty(&evsel->core.node)); in evsel__exit()
1475 assert(evsel->evlist == NULL); in evsel__exit()
1476 bpf_counter__destroy(evsel); in evsel__exit()
1477 evsel__free_counts(evsel); in evsel__exit()
1478 perf_evsel__free_fd(&evsel->core); in evsel__exit()
1479 perf_evsel__free_id(&evsel->core); in evsel__exit()
1480 evsel__free_config_terms(evsel); in evsel__exit()
1481 cgroup__put(evsel->cgrp); in evsel__exit()
1482 perf_cpu_map__put(evsel->core.cpus); in evsel__exit()
1483 perf_cpu_map__put(evsel->core.own_cpus); in evsel__exit()
1484 perf_thread_map__put(evsel->core.threads); in evsel__exit()
1485 zfree(&evsel->group_name); in evsel__exit()
1486 zfree(&evsel->name); in evsel__exit()
1487 zfree(&evsel->pmu_name); in evsel__exit()
1488 zfree(&evsel->unit); in evsel__exit()
1489 zfree(&evsel->metric_id); in evsel__exit()
1490 evsel__zero_per_pkg(evsel); in evsel__exit()
1491 hashmap__free(evsel->per_pkg_mask); in evsel__exit()
1492 evsel->per_pkg_mask = NULL; in evsel__exit()
1493 zfree(&evsel->metric_events); in evsel__exit()
1494 perf_evsel__object.fini(evsel); in evsel__exit()
1497 void evsel__delete(struct evsel *evsel) in evsel__delete() argument
1499 evsel__exit(evsel); in evsel__delete()
1500 free(evsel); in evsel__delete()
1503 void evsel__compute_deltas(struct evsel *evsel, int cpu_map_idx, int thread, in evsel__compute_deltas() argument
1508 if (!evsel->prev_raw_counts) in evsel__compute_deltas()
1512 tmp = evsel->prev_raw_counts->aggr; in evsel__compute_deltas()
1513 evsel->prev_raw_counts->aggr = *count; in evsel__compute_deltas()
1515 tmp = *perf_counts(evsel->prev_raw_counts, cpu_map_idx, thread); in evsel__compute_deltas()
1516 *perf_counts(evsel->prev_raw_counts, cpu_map_idx, thread) = *count; in evsel__compute_deltas()
1524 static int evsel__read_one(struct evsel *evsel, int cpu_map_idx, int thread) in evsel__read_one() argument
1526 struct perf_counts_values *count = perf_counts(evsel->counts, cpu_map_idx, thread); in evsel__read_one()
1528 return perf_evsel__read(&evsel->core, cpu_map_idx, thread, count); in evsel__read_one()
1531 static void evsel__set_count(struct evsel *counter, int cpu_map_idx, int thread, in evsel__set_count()
1545 static int evsel__process_group_data(struct evsel *leader, int cpu_map_idx, int thread, u64 *data) in evsel__process_group_data()
1567 struct evsel *counter; in evsel__process_group_data()
1579 static int evsel__read_group(struct evsel *leader, int cpu_map_idx, int thread) in evsel__read_group()
1609 int evsel__read_counter(struct evsel *evsel, int cpu_map_idx, int thread) in evsel__read_counter() argument
1611 u64 read_format = evsel->core.attr.read_format; in evsel__read_counter()
1614 return evsel__read_group(evsel, cpu_map_idx, thread); in evsel__read_counter()
1616 return evsel__read_one(evsel, cpu_map_idx, thread); in evsel__read_counter()
1619 int __evsel__read_on_cpu(struct evsel *evsel, int cpu_map_idx, int thread, bool scale) in __evsel__read_on_cpu() argument
1624 if (FD(evsel, cpu_map_idx, thread) < 0) in __evsel__read_on_cpu()
1627 if (evsel->counts == NULL && evsel__alloc_counts(evsel) < 0) in __evsel__read_on_cpu()
1630 if (readn(FD(evsel, cpu_map_idx, thread), &count, nv * sizeof(u64)) <= 0) in __evsel__read_on_cpu()
1633 evsel__compute_deltas(evsel, cpu_map_idx, thread, &count); in __evsel__read_on_cpu()
1635 *perf_counts(evsel->counts, cpu_map_idx, thread) = count; in __evsel__read_on_cpu()
1639 static int evsel__match_other_cpu(struct evsel *evsel, struct evsel *other, in evsel__match_other_cpu() argument
1644 cpu = perf_cpu_map__cpu(evsel->core.cpus, cpu_map_idx); in evsel__match_other_cpu()
1648 static int evsel__hybrid_group_cpu_map_idx(struct evsel *evsel, int cpu_map_idx) in evsel__hybrid_group_cpu_map_idx() argument
1650 struct evsel *leader = evsel__leader(evsel); in evsel__hybrid_group_cpu_map_idx()
1652 if ((evsel__is_hybrid(evsel) && !evsel__is_hybrid(leader)) || in evsel__hybrid_group_cpu_map_idx()
1653 (!evsel__is_hybrid(evsel) && evsel__is_hybrid(leader))) { in evsel__hybrid_group_cpu_map_idx()
1654 return evsel__match_other_cpu(evsel, leader, cpu_map_idx); in evsel__hybrid_group_cpu_map_idx()
1660 static int get_group_fd(struct evsel *evsel, int cpu_map_idx, int thread) in get_group_fd() argument
1662 struct evsel *leader = evsel__leader(evsel); in get_group_fd()
1665 if (evsel__is_group_leader(evsel)) in get_group_fd()
1674 cpu_map_idx = evsel__hybrid_group_cpu_map_idx(evsel, cpu_map_idx); in get_group_fd()
1684 static void evsel__remove_fd(struct evsel *pos, int nr_cpus, int nr_threads, int thread_idx) in evsel__remove_fd()
1691 static int update_fds(struct evsel *evsel, in update_fds() argument
1695 struct evsel *pos; in update_fds()
1700 evlist__for_each_entry(evsel->evlist, pos) { in update_fds()
1701 nr_cpus = pos != evsel ? nr_cpus : cpu_map_idx; in update_fds()
1709 if (pos == evsel) in update_fds()
1715 static bool evsel__ignore_missing_thread(struct evsel *evsel, in evsel__ignore_missing_thread() argument
1722 if (!evsel->ignore_missing_thread) in evsel__ignore_missing_thread()
1726 if (evsel->core.system_wide) in evsel__ignore_missing_thread()
1741 if (update_fds(evsel, nr_cpus, cpu_map_idx, threads->nr, thread)) in evsel__ignore_missing_thread()
1768 bool evsel__precise_ip_fallback(struct evsel *evsel) in evsel__precise_ip_fallback() argument
1771 if (!evsel->precise_max) in evsel__precise_ip_fallback()
1778 if (!evsel->core.attr.precise_ip) { in evsel__precise_ip_fallback()
1779 evsel->core.attr.precise_ip = evsel->precise_ip_original; in evsel__precise_ip_fallback()
1783 if (!evsel->precise_ip_original) in evsel__precise_ip_fallback()
1784 evsel->precise_ip_original = evsel->core.attr.precise_ip; in evsel__precise_ip_fallback()
1786 evsel->core.attr.precise_ip--; in evsel__precise_ip_fallback()
1787 pr_debug2_peo("decreasing precise_ip by one (%d)\n", evsel->core.attr.precise_ip); in evsel__precise_ip_fallback()
1788 display_attr(&evsel->core.attr); in evsel__precise_ip_fallback()
1795 static int __evsel__prepare_open(struct evsel *evsel, struct perf_cpu_map *cpus, in __evsel__prepare_open() argument
1800 if ((perf_missing_features.write_backward && evsel->core.attr.write_backward) || in __evsel__prepare_open()
1801 (perf_missing_features.aux_output && evsel->core.attr.aux_output)) in __evsel__prepare_open()
1824 if (evsel->core.system_wide) in __evsel__prepare_open()
1829 if (evsel->core.fd == NULL && in __evsel__prepare_open()
1830 perf_evsel__alloc_fd(&evsel->core, perf_cpu_map__nr(cpus), nthreads) < 0) in __evsel__prepare_open()
1833 evsel->open_flags = PERF_FLAG_FD_CLOEXEC; in __evsel__prepare_open()
1834 if (evsel->cgrp) in __evsel__prepare_open()
1835 evsel->open_flags |= PERF_FLAG_PID_CGROUP; in __evsel__prepare_open()
1840 static void evsel__disable_missing_features(struct evsel *evsel) in evsel__disable_missing_features() argument
1843 evsel__set_sample_bit(evsel, WEIGHT); in evsel__disable_missing_features()
1844 evsel__reset_sample_bit(evsel, WEIGHT_STRUCT); in evsel__disable_missing_features()
1847 evsel->core.attr.clockid = CLOCK_MONOTONIC; /* should always work */ in evsel__disable_missing_features()
1849 evsel->core.attr.use_clockid = 0; in evsel__disable_missing_features()
1850 evsel->core.attr.clockid = 0; in evsel__disable_missing_features()
1853 evsel->open_flags &= ~(unsigned long)PERF_FLAG_FD_CLOEXEC; in evsel__disable_missing_features()
1855 evsel->core.attr.mmap2 = 0; in evsel__disable_missing_features()
1856 if (evsel->pmu && evsel->pmu->missing_features.exclude_guest) in evsel__disable_missing_features()
1857 evsel->core.attr.exclude_guest = evsel->core.attr.exclude_host = 0; in evsel__disable_missing_features()
1859 evsel->core.attr.branch_sample_type &= ~(PERF_SAMPLE_BRANCH_NO_FLAGS | in evsel__disable_missing_features()
1861 if (perf_missing_features.group_read && evsel->core.attr.inherit) in evsel__disable_missing_features()
1862 evsel->core.attr.read_format &= ~(PERF_FORMAT_GROUP|PERF_FORMAT_ID); in evsel__disable_missing_features()
1864 evsel->core.attr.ksymbol = 0; in evsel__disable_missing_features()
1866 evsel->core.attr.bpf_event = 0; in evsel__disable_missing_features()
1868 evsel->core.attr.branch_sample_type &= ~PERF_SAMPLE_BRANCH_HW_INDEX; in evsel__disable_missing_features()
1870 evsel->core.attr.sample_id_all = 0; in evsel__disable_missing_features()
1873 int evsel__prepare_open(struct evsel *evsel, struct perf_cpu_map *cpus, in evsel__prepare_open() argument
1878 err = __evsel__prepare_open(evsel, cpus, threads); in evsel__prepare_open()
1882 evsel__disable_missing_features(evsel); in evsel__prepare_open()
1887 bool evsel__detect_missing_features(struct evsel *evsel) in evsel__detect_missing_features() argument
1894 (evsel->core.attr.sample_type & PERF_SAMPLE_WEIGHT_STRUCT)) { in evsel__detect_missing_features()
1899 (evsel->core.attr.sample_type & PERF_SAMPLE_CODE_PAGE_SIZE)) { in evsel__detect_missing_features()
1904 (evsel->core.attr.sample_type & PERF_SAMPLE_DATA_PAGE_SIZE)) { in evsel__detect_missing_features()
1908 } else if (!perf_missing_features.cgroup && evsel->core.attr.cgroup) { in evsel__detect_missing_features()
1913 (evsel->core.attr.branch_sample_type & PERF_SAMPLE_BRANCH_HW_INDEX)) { in evsel__detect_missing_features()
1917 } else if (!perf_missing_features.aux_output && evsel->core.attr.aux_output) { in evsel__detect_missing_features()
1921 } else if (!perf_missing_features.bpf && evsel->core.attr.bpf_event) { in evsel__detect_missing_features()
1925 } else if (!perf_missing_features.ksymbol && evsel->core.attr.ksymbol) { in evsel__detect_missing_features()
1929 } else if (!perf_missing_features.write_backward && evsel->core.attr.write_backward) { in evsel__detect_missing_features()
1933 } else if (!perf_missing_features.clockid_wrong && evsel->core.attr.use_clockid) { in evsel__detect_missing_features()
1937 } else if (!perf_missing_features.clockid && evsel->core.attr.use_clockid) { in evsel__detect_missing_features()
1941 } else if (!perf_missing_features.cloexec && (evsel->open_flags & PERF_FLAG_FD_CLOEXEC)) { in evsel__detect_missing_features()
1945 } else if (!perf_missing_features.mmap2 && evsel->core.attr.mmap2) { in evsel__detect_missing_features()
1949 } else if ((evsel->core.attr.exclude_guest || evsel->core.attr.exclude_host) && in evsel__detect_missing_features()
1950 (evsel->pmu == NULL || evsel->pmu->missing_features.exclude_guest)) { in evsel__detect_missing_features()
1951 if (evsel->pmu == NULL) { in evsel__detect_missing_features()
1952 evsel->pmu = evsel__find_pmu(evsel); in evsel__detect_missing_features()
1953 if (evsel->pmu) in evsel__detect_missing_features()
1954 evsel->pmu->missing_features.exclude_guest = true; in evsel__detect_missing_features()
1957 evsel->core.attr.exclude_host = false; in evsel__detect_missing_features()
1958 evsel->core.attr.exclude_guest = false; in evsel__detect_missing_features()
1962 if (evsel->exclude_GH) { in evsel__detect_missing_features()
1976 (evsel->core.attr.branch_sample_type & in evsel__detect_missing_features()
1983 evsel->core.attr.inherit && in evsel__detect_missing_features()
1984 (evsel->core.attr.read_format & PERF_FORMAT_GROUP) && in evsel__detect_missing_features()
1985 evsel__is_group_leader(evsel)) { in evsel__detect_missing_features()
2021 static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus, in evsel__open_cpu() argument
2029 err = __evsel__prepare_open(evsel, cpus, threads); in evsel__open_cpu()
2039 if (evsel->core.system_wide) in evsel__open_cpu()
2044 if (evsel->cgrp) in evsel__open_cpu()
2045 pid = evsel->cgrp->fd; in evsel__open_cpu()
2048 evsel__disable_missing_features(evsel); in evsel__open_cpu()
2050 display_attr(&evsel->core.attr); in evsel__open_cpu()
2060 if (!evsel->cgrp && !evsel->core.system_wide) in evsel__open_cpu()
2063 group_fd = get_group_fd(evsel, idx, thread); in evsel__open_cpu()
2068 pid, perf_cpu_map__cpu(cpus, idx).cpu, group_fd, evsel->open_flags); in evsel__open_cpu()
2070 fd = sys_perf_event_open(&evsel->core.attr, pid, in evsel__open_cpu()
2072 group_fd, evsel->open_flags); in evsel__open_cpu()
2074 FD(evsel, idx, thread) = fd; in evsel__open_cpu()
2084 bpf_counter__install_pe(evsel, idx, fd); in evsel__open_cpu()
2087 test_attr__open(&evsel->core.attr, pid, in evsel__open_cpu()
2089 fd, group_fd, evsel->open_flags); in evsel__open_cpu()
2094 if (evsel->bpf_fd >= 0) { in evsel__open_cpu()
2096 int bpf_fd = evsel->bpf_fd; in evsel__open_cpu()
2126 if (evsel__precise_ip_fallback(evsel)) in evsel__open_cpu()
2129 if (evsel__ignore_missing_thread(evsel, perf_cpu_map__nr(cpus), in evsel__open_cpu()
2148 if (evsel__detect_missing_features(evsel)) in evsel__open_cpu()
2157 if (FD(evsel, idx, thread) >= 0) in evsel__open_cpu()
2158 close(FD(evsel, idx, thread)); in evsel__open_cpu()
2159 FD(evsel, idx, thread) = -1; in evsel__open_cpu()
2167 int evsel__open(struct evsel *evsel, struct perf_cpu_map *cpus, in evsel__open() argument
2170 return evsel__open_cpu(evsel, cpus, threads, 0, perf_cpu_map__nr(cpus)); in evsel__open()
2173 void evsel__close(struct evsel *evsel) in evsel__close() argument
2175 perf_evsel__close(&evsel->core); in evsel__close()
2176 perf_evsel__free_id(&evsel->core); in evsel__close()
2179 int evsel__open_per_cpu(struct evsel *evsel, struct perf_cpu_map *cpus, int cpu_map_idx) in evsel__open_per_cpu() argument
2182 return evsel__open_cpu(evsel, cpus, NULL, 0, perf_cpu_map__nr(cpus)); in evsel__open_per_cpu()
2184 return evsel__open_cpu(evsel, cpus, NULL, cpu_map_idx, cpu_map_idx + 1); in evsel__open_per_cpu()
2187 int evsel__open_per_thread(struct evsel *evsel, struct perf_thread_map *threads) in evsel__open_per_thread() argument
2189 return evsel__open(evsel, NULL, threads); in evsel__open_per_thread()
2192 static int perf_evsel__parse_id_sample(const struct evsel *evsel, in perf_evsel__parse_id_sample() argument
2196 u64 type = evsel->core.attr.sample_type; in perf_evsel__parse_id_sample()
2198 bool swapped = evsel->needs_swap; in perf_evsel__parse_id_sample()
2337 int evsel__parse_sample(struct evsel *evsel, union perf_event *event, in evsel__parse_sample() argument
2340 u64 type = evsel->core.attr.sample_type; in evsel__parse_sample()
2341 bool swapped = evsel->needs_swap; in evsel__parse_sample()
2356 data->period = evsel->core.attr.sample_period; in evsel__parse_sample()
2363 if (!evsel->core.attr.sample_id_all) in evsel__parse_sample()
2365 return perf_evsel__parse_id_sample(evsel, event, data); in evsel__parse_sample()
2370 if (perf_event__check_size(event, evsel->sample_size)) in evsel__parse_sample()
2436 u64 read_format = evsel->core.attr.read_format; in evsel__parse_sample()
2534 if (evsel__has_branch_hw_idx(evsel)) { in evsel__parse_sample()
2571 u64 mask = evsel->core.attr.sample_regs_user; in evsel__parse_sample()
2627 u64 mask = evsel->core.attr.sample_regs_intr; in evsel__parse_sample()
2677 int evsel__parse_sample_timestamp(struct evsel *evsel, union perf_event *event, in evsel__parse_sample_timestamp() argument
2680 u64 type = evsel->core.attr.sample_type; in evsel__parse_sample_timestamp()
2691 if (!evsel->core.attr.sample_id_all) in evsel__parse_sample_timestamp()
2693 if (perf_evsel__parse_id_sample(evsel, event, &data)) in evsel__parse_sample_timestamp()
2702 if (perf_event__check_size(event, evsel->sample_size)) in evsel__parse_sample_timestamp()
2720 struct tep_format_field *evsel__field(struct evsel *evsel, const char *name) in evsel__field() argument
2722 return tep_find_field(evsel->tp_format, name); in evsel__field()
2725 void *evsel__rawptr(struct evsel *evsel, struct perf_sample *sample, const char *name) in evsel__rawptr() argument
2727 struct tep_format_field *field = evsel__field(evsel, name); in evsel__rawptr()
2784 u64 evsel__intval(struct evsel *evsel, struct perf_sample *sample, const char *name) in evsel__intval() argument
2786 struct tep_format_field *field = evsel__field(evsel, name); in evsel__intval()
2791 return field ? format_field__intval(field, sample, evsel->needs_swap) : 0; in evsel__intval()
2794 bool evsel__fallback(struct evsel *evsel, int err, char *msg, size_t msgsize) in evsel__fallback() argument
2799 evsel->core.attr.type == PERF_TYPE_HARDWARE && in evsel__fallback()
2800 evsel->core.attr.config == PERF_COUNT_HW_CPU_CYCLES) { in evsel__fallback()
2812 evsel->core.attr.type = PERF_TYPE_SOFTWARE; in evsel__fallback()
2813 evsel->core.attr.config = PERF_COUNT_SW_CPU_CLOCK; in evsel__fallback()
2815 zfree(&evsel->name); in evsel__fallback()
2817 } else if (err == EACCES && !evsel->core.attr.exclude_kernel && in evsel__fallback()
2819 const char *name = evsel__name(evsel); in evsel__fallback()
2824 if (evsel->core.attr.exclude_user) in evsel__fallback()
2829 (strchr(name, ':') && !evsel->is_libpfm_event)) in evsel__fallback()
2835 if (evsel->name) in evsel__fallback()
2836 free(evsel->name); in evsel__fallback()
2837 evsel->name = new_name; in evsel__fallback()
2841 evsel->core.attr.exclude_kernel = 1; in evsel__fallback()
2842 evsel->core.attr.exclude_hv = 1; in evsel__fallback()
2891 static bool is_amd_ibs(struct evsel *evsel) in is_amd_ibs() argument
2893 return evsel->core.attr.precise_ip in is_amd_ibs()
2894 || (evsel->pmu_name && !strncmp(evsel->pmu_name, "ibs", 3)); in is_amd_ibs()
2897 int evsel__open_strerror(struct evsel *evsel, struct target *target, in evsel__open_strerror() argument
2900 struct perf_env *env = evsel__env(evsel); in evsel__open_strerror()
2923 "No permission to enable %s event.\n\n", evsel__name(evsel)); in evsel__open_strerror()
2941 return scnprintf(msg, size, "The %s event is not supported.", evsel__name(evsel)); in evsel__open_strerror()
2949 if (evsel__has_callchain(evsel) && in evsel__open_strerror()
2962 if (evsel->core.attr.sample_type & PERF_SAMPLE_BRANCH_STACK) in evsel__open_strerror()
2965 evsel__name(evsel)); in evsel__open_strerror()
2966 if (evsel->core.attr.aux_output) in evsel__open_strerror()
2969 evsel__name(evsel)); in evsel__open_strerror()
2970 if (evsel->core.attr.sample_period != 0) in evsel__open_strerror()
2973 evsel__name(evsel)); in evsel__open_strerror()
2974 if (evsel->core.attr.precise_ip) in evsel__open_strerror()
2978 if (evsel->core.attr.type == PERF_TYPE_HARDWARE) in evsel__open_strerror()
2990 …if (evsel->core.attr.sample_type & PERF_SAMPLE_CODE_PAGE_SIZE && perf_missing_features.code_page_s… in evsel__open_strerror()
2992 …if (evsel->core.attr.sample_type & PERF_SAMPLE_DATA_PAGE_SIZE && perf_missing_features.data_page_s… in evsel__open_strerror()
2994 if (evsel->core.attr.write_backward && perf_missing_features.write_backward) in evsel__open_strerror()
3005 evsel__name(evsel)); in evsel__open_strerror()
3007 if (is_amd_ibs(evsel)) { in evsel__open_strerror()
3008 if (evsel->core.attr.exclude_kernel) in evsel__open_strerror()
3011 if (!evsel->core.system_wide) in evsel__open_strerror()
3028 err, str_error_r(err, sbuf, sizeof(sbuf)), evsel__name(evsel)); in evsel__open_strerror()
3031 struct perf_env *evsel__env(struct evsel *evsel) in evsel__env() argument
3033 if (evsel && evsel->evlist && evsel->evlist->env) in evsel__env()
3034 return evsel->evlist->env; in evsel__env()
3038 static int store_evsel_ids(struct evsel *evsel, struct evlist *evlist) in store_evsel_ids() argument
3042 for (cpu_map_idx = 0; cpu_map_idx < xyarray__max_x(evsel->core.fd); cpu_map_idx++) { in store_evsel_ids()
3043 for (thread = 0; thread < xyarray__max_y(evsel->core.fd); in store_evsel_ids()
3045 int fd = FD(evsel, cpu_map_idx, thread); in store_evsel_ids()
3047 if (perf_evlist__id_add_fd(&evlist->core, &evsel->core, in store_evsel_ids()
3056 int evsel__store_ids(struct evsel *evsel, struct evlist *evlist) in evsel__store_ids() argument
3058 struct perf_cpu_map *cpus = evsel->core.cpus; in evsel__store_ids()
3059 struct perf_thread_map *threads = evsel->core.threads; in evsel__store_ids()
3061 if (perf_evsel__alloc_id(&evsel->core, perf_cpu_map__nr(cpus), threads->nr)) in evsel__store_ids()
3064 return store_evsel_ids(evsel, evlist); in evsel__store_ids()
3067 void evsel__zero_per_pkg(struct evsel *evsel) in evsel__zero_per_pkg() argument
3072 if (evsel->per_pkg_mask) { in evsel__zero_per_pkg()
3073 hashmap__for_each_entry(evsel->per_pkg_mask, cur, bkt) in evsel__zero_per_pkg()
3076 hashmap__clear(evsel->per_pkg_mask); in evsel__zero_per_pkg()
3080 bool evsel__is_hybrid(struct evsel *evsel) in evsel__is_hybrid() argument
3082 return evsel->pmu_name && perf_pmu__is_hybrid(evsel->pmu_name); in evsel__is_hybrid()
3085 struct evsel *evsel__leader(struct evsel *evsel) in evsel__leader() argument
3087 return container_of(evsel->core.leader, struct evsel, core); in evsel__leader()
3090 bool evsel__has_leader(struct evsel *evsel, struct evsel *leader) in evsel__has_leader() argument
3092 return evsel->core.leader == &leader->core; in evsel__has_leader()
3095 bool evsel__is_leader(struct evsel *evsel) in evsel__is_leader() argument
3097 return evsel__has_leader(evsel, evsel); in evsel__is_leader()
3100 void evsel__set_leader(struct evsel *evsel, struct evsel *leader) in evsel__set_leader() argument
3102 evsel->core.leader = &leader->core; in evsel__set_leader()
3105 int evsel__source_count(const struct evsel *evsel) in evsel__source_count() argument
3107 struct evsel *pos; in evsel__source_count()
3110 evlist__for_each_entry(evsel->evlist, pos) { in evsel__source_count()
3111 if (pos->metric_leader == evsel) in evsel__source_count()
3117 bool __weak arch_evsel__must_be_in_group(const struct evsel *evsel __maybe_unused) in arch_evsel__must_be_in_group()
3127 void evsel__remove_from_group(struct evsel *evsel, struct evsel *leader) in evsel__remove_from_group() argument
3129 if (!arch_evsel__must_be_in_group(evsel) && evsel != leader) { in evsel__remove_from_group()
3130 evsel__set_leader(evsel, evsel); in evsel__remove_from_group()
3131 evsel->core.nr_members = 0; in evsel__remove_from_group()