perf stat: Switch to cpu version of cpu_map__get()
Avoid possible bugs where the wrong index is passed with the cpu_map. Reviewed-by: James Clark <james.clark@arm.com> Signed-off-by: Ian 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: 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-6-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
a023283fad
commit
88031a0de7
@@ -341,8 +341,7 @@ static int first_shadow_cpu(struct perf_stat_config *config,
|
||||
|
||||
cpus = evsel__cpus(evsel);
|
||||
perf_cpu_map__for_each_cpu(cpu, idx, cpus) {
|
||||
if (cpu_map__compare_aggr_cpu_id(config->aggr_get_id(config, cpus, idx),
|
||||
id))
|
||||
if (cpu_map__compare_aggr_cpu_id(config->aggr_get_id(config, cpu), id))
|
||||
return cpu;
|
||||
}
|
||||
return 0;
|
||||
@@ -525,8 +524,7 @@ static void aggr_update_shadow(struct perf_stat_config *config,
|
||||
cpus = evsel__cpus(counter);
|
||||
val = 0;
|
||||
perf_cpu_map__for_each_cpu(cpu, idx, cpus) {
|
||||
(void)cpu;
|
||||
s2 = config->aggr_get_id(config, cpus, idx);
|
||||
s2 = config->aggr_get_id(config, cpu);
|
||||
if (!cpu_map__compare_aggr_cpu_id(s2, id))
|
||||
continue;
|
||||
val += perf_counts(counter->counts, idx, 0)->val;
|
||||
@@ -642,8 +640,7 @@ static void aggr_cb(struct perf_stat_config *config,
|
||||
perf_cpu_map__for_each_cpu(cpu, idx, cpus) {
|
||||
struct perf_counts_values *counts;
|
||||
|
||||
(void)cpu;
|
||||
s2 = config->aggr_get_id(config, cpus, idx);
|
||||
s2 = config->aggr_get_id(config, cpu);
|
||||
if (!cpu_map__compare_aggr_cpu_id(s2, ad->id))
|
||||
continue;
|
||||
if (first)
|
||||
@@ -1217,7 +1214,7 @@ static void print_percore_thread(struct perf_stat_config *config,
|
||||
|
||||
cpus = evsel__cpus(counter);
|
||||
perf_cpu_map__for_each_cpu(cpu, idx, cpus) {
|
||||
s2 = config->aggr_get_id(config, cpus, idx);
|
||||
s2 = config->aggr_get_id(config, cpu);
|
||||
for (s = 0; s < config->aggr_map->nr; s++) {
|
||||
id = config->aggr_map->map[s];
|
||||
if (cpu_map__compare_aggr_cpu_id(s2, id))
|
||||
|
||||
Reference in New Issue
Block a user