[PATCH v4 02/22] perf bpf_counter: Use public cpumap accessors

From: Ian Rogers
Date: Sun Mar 19 2023 - 23:39:06 EST


Avoid the use of internal apis via the cpumap accessor functions.

Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/util/bpf_counter.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/bpf_counter.c b/tools/perf/util/bpf_counter.c
index 1b77436e067e..76ee3e86824a 100644
--- a/tools/perf/util/bpf_counter.c
+++ b/tools/perf/util/bpf_counter.c
@@ -545,7 +545,7 @@ static int bperf__load(struct evsel *evsel, struct target *target)
filter_type == BPERF_FILTER_TGID)
key = perf_thread_map__pid(evsel->core.threads, i);
else if (filter_type == BPERF_FILTER_CPU)
- key = evsel->core.cpus->map[i].cpu;
+ key = perf_cpu_map__cpu(evsel->core.cpus, i).cpu;
else
break;

@@ -587,9 +587,9 @@ static int bperf_sync_counters(struct evsel *evsel)
{
int num_cpu, i, cpu;

- num_cpu = all_cpu_map->nr;
+ num_cpu = perf_cpu_map__nr(all_cpu_map);
for (i = 0; i < num_cpu; i++) {
- cpu = all_cpu_map->map[i].cpu;
+ cpu = perf_cpu_map__cpu(all_cpu_map, i).cpu;
bperf_trigger_reading(evsel->bperf_leader_prog_fd, cpu);
}
return 0;
--
2.40.0.rc1.284.g88254d51c5-goog