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

perf stat: Swap variable name cpu to index

The use of CPU is error prone, switch to cpu_map_idx.
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-43-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 379c224b
This diff is collapsed.
...@@ -356,14 +356,14 @@ static int check_per_pkg(struct evsel *counter, struct perf_counts_values *vals, ...@@ -356,14 +356,14 @@ static int check_per_pkg(struct evsel *counter, struct perf_counts_values *vals,
static int static int
process_counter_values(struct perf_stat_config *config, struct evsel *evsel, process_counter_values(struct perf_stat_config *config, struct evsel *evsel,
int cpu, int thread, int cpu_map_idx, int thread,
struct perf_counts_values *count) struct perf_counts_values *count)
{ {
struct perf_counts_values *aggr = &evsel->counts->aggr; struct perf_counts_values *aggr = &evsel->counts->aggr;
static struct perf_counts_values zero; static struct perf_counts_values zero;
bool skip = false; bool skip = false;
if (check_per_pkg(evsel, count, cpu, &skip)) { if (check_per_pkg(evsel, count, cpu_map_idx, &skip)) {
pr_err("failed to read per-pkg counter\n"); pr_err("failed to read per-pkg counter\n");
return -1; return -1;
} }
...@@ -379,11 +379,11 @@ process_counter_values(struct perf_stat_config *config, struct evsel *evsel, ...@@ -379,11 +379,11 @@ process_counter_values(struct perf_stat_config *config, struct evsel *evsel,
case AGGR_NODE: case AGGR_NODE:
case AGGR_NONE: case AGGR_NONE:
if (!evsel->snapshot) if (!evsel->snapshot)
evsel__compute_deltas(evsel, cpu, thread, count); evsel__compute_deltas(evsel, cpu_map_idx, thread, count);
perf_counts_values__scale(count, config->scale, NULL); perf_counts_values__scale(count, config->scale, NULL);
if ((config->aggr_mode == AGGR_NONE) && (!evsel->percore)) { if ((config->aggr_mode == AGGR_NONE) && (!evsel->percore)) {
perf_stat__update_shadow_stats(evsel, count->val, perf_stat__update_shadow_stats(evsel, count->val,
cpu, &rt_stat); cpu_map_idx, &rt_stat);
} }
if (config->aggr_mode == AGGR_THREAD) { if (config->aggr_mode == AGGR_THREAD) {
...@@ -412,15 +412,15 @@ static int process_counter_maps(struct perf_stat_config *config, ...@@ -412,15 +412,15 @@ static int process_counter_maps(struct perf_stat_config *config,
{ {
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 ncpus = evsel__nr_cpus(counter);
int cpu, thread; int idx, thread;
if (counter->core.system_wide) if (counter->core.system_wide)
nthreads = 1; nthreads = 1;
for (thread = 0; thread < nthreads; thread++) { for (thread = 0; thread < nthreads; thread++) {
for (cpu = 0; cpu < ncpus; cpu++) { for (idx = 0; idx < ncpus; idx++) {
if (process_counter_values(config, counter, cpu, thread, if (process_counter_values(config, counter, idx, thread,
perf_counts(counter->counts, cpu, thread))) perf_counts(counter->counts, idx, thread)))
return -1; return -1;
} }
} }
......
...@@ -208,7 +208,7 @@ void perf_stat__init_shadow_stats(void); ...@@ -208,7 +208,7 @@ void perf_stat__init_shadow_stats(void);
void perf_stat__reset_shadow_stats(void); void perf_stat__reset_shadow_stats(void);
void perf_stat__reset_shadow_per_stat(struct runtime_stat *st); void perf_stat__reset_shadow_per_stat(struct runtime_stat *st);
void perf_stat__update_shadow_stats(struct evsel *counter, u64 count, void perf_stat__update_shadow_stats(struct evsel *counter, u64 count,
int cpu, struct runtime_stat *st); int cpu_map_idx, struct runtime_stat *st);
struct perf_stat_output_ctx { struct perf_stat_output_ctx {
void *ctx; void *ctx;
print_metric_t print_metric; print_metric_t print_metric;
...@@ -253,5 +253,5 @@ void evlist__print_counters(struct evlist *evlist, struct perf_stat_config *conf ...@@ -253,5 +253,5 @@ void evlist__print_counters(struct evlist *evlist, struct perf_stat_config *conf
struct target *_target, struct timespec *ts, int argc, const char **argv); struct target *_target, struct timespec *ts, int argc, const char **argv);
struct metric_expr; struct metric_expr;
double test_generic_metric(struct metric_expr *mexp, int cpu, struct runtime_stat *st); double test_generic_metric(struct metric_expr *mexp, int cpu_map_idx, struct runtime_stat *st);
#endif #endif
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