perf bpf_counter: Use public cpumap accessors
authorIan Rogers <irogers@google.com>
Mon, 20 Mar 2023 03:37:50 +0000 (20:37 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 20 Mar 2023 15:50:31 +0000 (12:50 -0300)
Avoid the use of internal apis via the cpumap accessor functions.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: André Almeida <andrealmeid@collabora.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: German Gomez <german.gomez@arm.com>
Cc: Hao Luo <haoluo@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Miaoqian Lin <linmq006@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Riccardo Mancini <rickyman7@gmail.com>
Cc: Shunsuke Nakamura <nakamura.shun@fujitsu.com>
Cc: Song Liu <song@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Yury Norov <yury.norov@gmail.com>
Link: https://lore.kernel.org/r/20230320033810.980165-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/bpf_counter.c

index 1b77436..76ee3e8 100644 (file)
@@ -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;