[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <37D7C6CF3E00A74B8858931C1DB2F0770188353D@SHSMSX103.ccr.corp.intel.com>
Date: Tue, 30 Jun 2015 13:24:59 +0000
From: "Liang, Kan" <kan.liang@...el.com>
To: Jiri Olsa <jolsa@...hat.com>
CC: "acme@...nel.org" <acme@...nel.org>,
"jolsa@...nel.org" <jolsa@...nel.org>,
"ak@...ux.intel.com" <ak@...ux.intel.com>,
"namhyung@...nel.org" <namhyung@...nel.org>,
"eranian@...gle.com" <eranian@...gle.com>,
"Hunter, Adrian" <adrian.hunter@...el.com>,
"dsahern@...il.com" <dsahern@...il.com>,
"a.p.zijlstra@...llo.nl" <a.p.zijlstra@...llo.nl>,
"mingo@...hat.com" <mingo@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 1/2] perf,tools: get correct cpu id for print_aggr
> On Mon, Jun 29, 2015 at 03:55:34PM -0400, kan.liang@...el.com wrote:
> > From: Kan Liang <kan.liang@...el.com>
> >
> > print_aggr fails to print per-core/per-socket statistics after commit
> > b7f0c203586b ("perf evlist: Propagate cpu maps to evsels in an
> > evlist"), if events have differnt cpus. Because in print_aggr,
> > aggr_get_id needs index (not cpu id) to find core/pkg id.
> > This patch introduced perf_evsel__get_cpumap_index to get the index
> by
> > cpu id for a given event. The index can be used to find correct cpu id
> > for print_aggr.
> >
>
> SNIP
>
> >
> > diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> > index 37e301a..a3ea735 100644
> > --- a/tools/perf/builtin-stat.c
> > +++ b/tools/perf/builtin-stat.c
> > @@ -708,6 +708,7 @@ static void print_aggr(char *prefix)
> > nr = 0;
> > for (cpu = 0; cpu < perf_evsel__nr_cpus(counter);
> cpu++) {
> > cpu2 = perf_evsel__cpus(counter)-
> >map[cpu];
> > + cpu2 =
> perf_evsel__get_cpumap_index(cpu2, evsel_list->cpus);
> > s2 = aggr_get_id(evsel_list->cpus, cpu2);
> > if (s2 != id)
> > continue;
>
> hum, looks like passing the actual cpu number was introduced in:
> 582ec0829b3d perf stat: Fix per-socket output bug for uncore events
>
Right, I will change it.
> also, we already have the index into counter's cpus, why not use those for
> getting aggregated id (core,socket).. what do I miss?
Yes, the index is already there. But we still pass evlist's cpu map to aggr_get_id.
So once evsel and evlist have different cpu maps (e.g. -a with uncore event),
the wrong aggregated id will be return.
I think the patch as below will fix all these issues.
Thanks,
Kan
---
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 37e301a..47c3c1f 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -694,7 +694,7 @@ static void abs_printout(int id, int nr, struct perf_evsel *evsel, double avg)
static void print_aggr(char *prefix)
{
struct perf_evsel *counter;
- int cpu, cpu2, s, s2, id, nr;
+ int cpu, s, s2, id, nr;
double uval;
u64 ena, run, val;
@@ -707,8 +707,7 @@ static void print_aggr(char *prefix)
val = ena = run = 0;
nr = 0;
for (cpu = 0; cpu < perf_evsel__nr_cpus(counter); cpu++) {
- cpu2 = perf_evsel__cpus(counter)->map[cpu];
- s2 = aggr_get_id(evsel_list->cpus, cpu2);
+ s2 = aggr_get_id(perf_evsel__cpus(counter), cpu);
if (s2 != id)
continue;
val += perf_counts(counter->counts, cpu, 0)->val;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists