[PATCH 17/59] libperf: Move bpf_counter to perf_evsel
From: Jiri Olsa <hidden>
Date: 2021-11-08 13:39:09
Subsystem:
performance events subsystem, the rest · Maintainers:
Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Linus Torvalds
Moving bpf_counter to perf_evsel struct. Signed-off-by: Jiri Olsa <jolsa@kernel.org> --- tools/lib/perf/include/internal/evsel.h | 1 + tools/perf/util/bpf_counter.c | 2 +- tools/perf/util/evsel.h | 1 - tools/perf/util/parse-events.c | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/lib/perf/include/internal/evsel.h b/tools/lib/perf/include/internal/evsel.h
index 8374dc8365cb..81df282fa008 100644
--- a/tools/lib/perf/include/internal/evsel.h
+++ b/tools/lib/perf/include/internal/evsel.h@@ -73,6 +73,7 @@ struct perf_evsel { int sample_read; bool precise_max; bool weak_group; + bool bpf_counter; }; };
diff --git a/tools/perf/util/bpf_counter.c b/tools/perf/util/bpf_counter.c
index ced2dac31dcf..c0146b4a03d3 100644
--- a/tools/perf/util/bpf_counter.c
+++ b/tools/perf/util/bpf_counter.c@@ -770,7 +770,7 @@ int bpf_counter__load(struct evsel *evsel, struct target *target) evsel->bpf_counter_ops = &bpf_program_profiler_ops; else if (cgrp_event_expanded && target->use_bpf) evsel->bpf_counter_ops = &bperf_cgrp_ops; - else if (target->use_bpf || evsel->bpf_counter || + else if (target->use_bpf || evsel->core.bpf_counter || evsel__match_bpf_counter_events(evsel->name)) evsel->bpf_counter_ops = &bperf_ops;
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 22f579e0e862..c09bbddd5da0 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h@@ -68,7 +68,6 @@ struct evsel { bool use_uncore_alias; bool is_libpfm_event; bool collect_stat; - bool bpf_counter; bool use_config_name; int bpf_fd; struct bpf_object *bpf_obj;
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 7a3a27f45644..24d01b768078 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c@@ -2053,7 +2053,7 @@ int parse_events__modifier_event(struct list_head *list, char *str, bool add) evsel->core.sample_read = mod.sample_read; evsel->core.precise_max = mod.precise_max; evsel->core.weak_group = mod.weak; - evsel->bpf_counter = mod.bpf_counter; + evsel->core.bpf_counter = mod.bpf_counter; if (evsel__is_group_leader(evsel)) { evsel->core.attr.pinned = mod.pinned;
--
2.31.1