Commit f9551b3f authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

perf script: Use for each cpu to aid readability

Use perf_cpu_map__for_each_cpu() to help with readability.
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Clarke <pc@us.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Riccardo Mancini <rickyman7@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Vineet Singh <vineet.singh@intel.com>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: zhengjun.xing@intel.com
Link: https://lore.kernel.org/r/20220105061351.120843-33-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 7ea82fbe
...@@ -2115,8 +2115,7 @@ static struct scripting_ops *scripting_ops; ...@@ -2115,8 +2115,7 @@ static struct scripting_ops *scripting_ops;
static void __process_stat(struct evsel *counter, u64 tstamp) static void __process_stat(struct evsel *counter, u64 tstamp)
{ {
int nthreads = perf_thread_map__nr(counter->core.threads); int nthreads = perf_thread_map__nr(counter->core.threads);
int ncpus = evsel__nr_cpus(counter); int idx, cpu, thread;
int cpu, thread;
static int header_printed; static int header_printed;
if (counter->core.system_wide) if (counter->core.system_wide)
...@@ -2129,13 +2128,13 @@ static void __process_stat(struct evsel *counter, u64 tstamp) ...@@ -2129,13 +2128,13 @@ static void __process_stat(struct evsel *counter, u64 tstamp)
} }
for (thread = 0; thread < nthreads; thread++) { for (thread = 0; thread < nthreads; thread++) {
for (cpu = 0; cpu < ncpus; cpu++) { perf_cpu_map__for_each_cpu(cpu, idx, evsel__cpus(counter)) {
struct perf_counts_values *counts; struct perf_counts_values *counts;
counts = perf_counts(counter->counts, cpu, thread); counts = perf_counts(counter->counts, cpu, thread);
printf("%3d %8d %15" PRIu64 " %15" PRIu64 " %15" PRIu64 " %15" PRIu64 " %s\n", printf("%3d %8d %15" PRIu64 " %15" PRIu64 " %15" PRIu64 " %15" PRIu64 " %s\n",
counter->core.cpus->map[cpu], cpu,
perf_thread_map__pid(counter->core.threads, thread), perf_thread_map__pid(counter->core.threads, thread),
counts->val, counts->val,
counts->ena, counts->ena,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment