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

perf stat: Use perf_cpu_map__for_each_cpu()

Correct in print_counter() where an index was being used as a cpu.
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-32-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent ab90caa7
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/time64.h> #include <linux/time64.h>
#include <math.h> #include <math.h>
#include <perf/cpumap.h>
#include "color.h" #include "color.h"
#include "counts.h" #include "counts.h"
#include "evlist.h" #include "evlist.h"
...@@ -732,7 +733,7 @@ static void print_aggr(struct perf_stat_config *config, ...@@ -732,7 +733,7 @@ static void print_aggr(struct perf_stat_config *config,
evlist__for_each_entry(evlist, counter) { evlist__for_each_entry(evlist, counter) {
print_counter_aggrdata(config, counter, s, print_counter_aggrdata(config, counter, s,
prefix, metric_only, prefix, metric_only,
&first, -1); &first, /*cpu=*/-1);
} }
if (metric_only) if (metric_only)
fputc('\n', output); fputc('\n', output);
...@@ -893,11 +894,11 @@ static void print_counter(struct perf_stat_config *config, ...@@ -893,11 +894,11 @@ static void print_counter(struct perf_stat_config *config,
FILE *output = config->output; FILE *output = config->output;
u64 ena, run, val; u64 ena, run, val;
double uval; double uval;
int cpu; int idx, cpu;
struct aggr_cpu_id id; struct aggr_cpu_id id;
for (cpu = 0; cpu < evsel__nr_cpus(counter); cpu++) { perf_cpu_map__for_each_cpu(cpu, idx, evsel__cpus(counter)) {
struct aggr_data ad = { .cpu_map_idx = cpu }; struct aggr_data ad = { .cpu_map_idx = idx };
if (!collect_data(config, counter, counter_cb, &ad)) if (!collect_data(config, counter, counter_cb, &ad))
return; return;
...@@ -1248,7 +1249,7 @@ static void print_percore(struct perf_stat_config *config, ...@@ -1248,7 +1249,7 @@ static void print_percore(struct perf_stat_config *config,
print_counter_aggrdata(config, counter, s, print_counter_aggrdata(config, counter, s,
prefix, metric_only, prefix, metric_only,
&first, -1); &first, /*cpu=*/-1);
} }
if (metric_only) if (metric_only)
......
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