[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fWu+H-n57E52JgoEnAdGoJXs_P69-URum4UATx8bfrEOw@mail.gmail.com>
Date: Wed, 29 Dec 2021 22:22:54 -0800
From: Ian Rogers <irogers@...gle.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Andi Kleen <ak@...ux.intel.com>, Jiri Olsa <jolsa@...hat.com>,
John Garry <john.garry@...wei.com>,
Kajol Jain <kjain@...ux.ibm.com>,
"Paul A . Clarke" <pc@...ibm.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Riccardo Mancini <rickyman7@...il.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
linux-perf-users <linux-perf-users@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Vineet Singh <vineet.singh@...el.com>,
James Clark <james.clark@....com>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Suzuki K Poulose <suzuki.poulose@....com>,
Mike Leach <mike.leach@...aro.org>,
Leo Yan <leo.yan@...aro.org>, coresight@...ts.linaro.org,
linux-arm-kernel@...ts.infradead.org,
Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH v2 25/48] perf stat-display: Avoid use of core for CPU.
On Tue, Dec 28, 2021 at 4:09 PM Namhyung Kim <namhyung@...nel.org> wrote:
>
> On Wed, Dec 22, 2021 at 11:47 PM Ian Rogers <irogers@...gle.com> wrote:
> >
> > Correct use of cpumap index in print_no_aggr_metric.
> >
> > Signed-off-by: Ian Rogers <irogers@...gle.com>
> > ---
> [SNIP]
> > @@ -924,29 +921,32 @@ static void print_no_aggr_metric(struct perf_stat_config *config,
> > struct evlist *evlist,
> > char *prefix)
> > {
> > - int cpu;
> > - int nrcpus = 0;
> > - struct evsel *counter;
> > - u64 ena, run, val;
> > - double uval;
> > - struct aggr_cpu_id id;
> > + int cpu, nrcpus;
> >
> > nrcpus = evlist->core.cpus->nr;
> > for (cpu = 0; cpu < nrcpus; cpu++) {
> > + struct evsel *counter;
> > bool first = true;
> >
> > if (prefix)
> > fputs(prefix, config->output);
> > evlist__for_each_entry(evlist, counter) {
> > - id = aggr_cpu_id__empty();
> > - id.core = cpu;
> > + u64 ena, run, val;
> > + double uval;
> > + struct aggr_cpu_id id;
> > + int idx = perf_cpu_map__idx(evsel__cpus(counter), cpu);
>
> Not sure about this. Here the 'cpu' is an index for the
> evlist->core.cpus, not a CPU number. But the
> perf_cpu_map__idx() requires a CPU number, right?
Thanks for the reviews! You are right, I think it makes sense two have
two indices here, evlist and counter. I will change the outer loop to
use perf_cpu_map__for_each_cpu. v3 will have the other fixes you've
pointed out too.
Thanks,
Ian
> Thanks,
> Namhyung
>
>
> > +
> > + if (idx < 0)
> > + continue;
> > +
> > + id = aggr_cpu_id__cpu(cpu, /*data=*/NULL);
> > if (first) {
> > aggr_printout(config, counter, id, 0);
> > first = false;
> > }
> > - val = perf_counts(counter->counts, cpu, 0)->val;
> > - ena = perf_counts(counter->counts, cpu, 0)->ena;
> > - run = perf_counts(counter->counts, cpu, 0)->run;
> > + val = perf_counts(counter->counts, idx, 0)->val;
> > + ena = perf_counts(counter->counts, idx, 0)->ena;
> > + run = perf_counts(counter->counts, idx, 0)->run;
> >
> > uval = val * counter->scale;
> > printout(config, id, 0, counter, uval, prefix,
> > --
> > 2.34.1.307.g9b7440fafd-goog
> >
Powered by blists - more mailing lists