summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/stat.c
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2022-05-18 20:20:05 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2022-05-23 09:54:02 -0300
commit0b9462d0ac10627368cf47cd4125714004d99b7f (patch)
tree1531c9d9705bb7a40918be87b0ab5b2dc9fd6b84 /tools/perf/util/stat.c
parent54668a4ea03e317049b801c419c78e3ec4f366e6 (diff)
downloadlinux-0b9462d0ac10627368cf47cd4125714004d99b7f.tar.bz2
perf stat: Make use of index clearer with perf_counts
Try to disambiguate further when perf_counts is being accessed it is with a cpu map index rather than a CPU. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Andrii Nakryiko <andrii@kernel.org> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: Dave Marchevsky <davemarchevsky@fb.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Fastabend <john.fastabend@gmail.com> Cc: KP Singh <kpsingh@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Lv Ruyi <lv.ruyi@zte.com.cn> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Martin KaFai Lau <kafai@fb.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Quentin Monnet <quentin@isovalent.com> Cc: Song Liu <songliubraving@fb.com> Cc: Stephane Eranian <eranian@google.com> Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com> Cc: Yonghong Song <yhs@fb.com> Cc: bpf@vger.kernel.org Cc: netdev@vger.kernel.org Link: https://lore.kernel.org/r/20220519032005.1273691-6-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/stat.c')
-rw-r--r--tools/perf/util/stat.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index a77c28232298..37ea2d044708 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -237,14 +237,12 @@ void evlist__reset_prev_raw_counts(struct evlist *evlist)
static void evsel__copy_prev_raw_counts(struct evsel *evsel)
{
- int ncpus = evsel__nr_cpus(evsel);
- int nthreads = perf_thread_map__nr(evsel->core.threads);
+ int idx, nthreads = perf_thread_map__nr(evsel->core.threads);
for (int thread = 0; thread < nthreads; thread++) {
- for (int cpu = 0; cpu < ncpus; cpu++) {
- *perf_counts(evsel->counts, cpu, thread) =
- *perf_counts(evsel->prev_raw_counts, cpu,
- thread);
+ perf_cpu_map__for_each_idx(idx, evsel__cpus(evsel)) {
+ *perf_counts(evsel->counts, idx, thread) =
+ *perf_counts(evsel->prev_raw_counts, idx, thread);
}
}