Skip to content

Commit

Permalink
perf stat: Fix per-socket output bug for uncore events
Browse files Browse the repository at this point in the history
This patch fixes a problem reported by Andi Kleen on perf
stat when measuring uncore events:

 # perf stat --per-socket -e uncore_pcu/event=0x0/ -I1000  -a sleep 2

It would not report counts for the second socket. That was due to a
cpu mapping bug in print_aggr().

This patch also fixes the socket numbering bug for <not counted>
events.

Reported-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Stephane Eranian <eranian@google.com>
Tested-by: Andi Kleen <ak@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: zheng.z.yan@intel.com
Link: http://lkml.kernel.org/r/20130705170645.GA32519@quad
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Stephane Eranian authored and Arnaldo Carvalho de Melo committed Jul 8, 2013
1 parent f9ceffb commit 582ec08
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tools/perf/builtin-stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ static void abs_printout(int cpu, int nr, struct perf_evsel *evsel, double avg)
static void print_aggr(char *prefix)
{
struct perf_evsel *counter;
int cpu, s, s2, id, nr;
int cpu, cpu2, s, s2, id, nr;
u64 ena, run, val;

if (!(aggr_map || aggr_get_id))
Expand All @@ -936,7 +936,8 @@ static void print_aggr(char *prefix)
val = ena = run = 0;
nr = 0;
for (cpu = 0; cpu < perf_evsel__nr_cpus(counter); cpu++) {
s2 = aggr_get_id(evsel_list->cpus, cpu);
cpu2 = perf_evsel__cpus(counter)->map[cpu];
s2 = aggr_get_id(evsel_list->cpus, cpu2);
if (s2 != id)
continue;
val += counter->counts->cpu[cpu].val;
Expand All @@ -948,7 +949,7 @@ static void print_aggr(char *prefix)
fprintf(output, "%s", prefix);

if (run == 0 || ena == 0) {
aggr_printout(counter, cpu, nr);
aggr_printout(counter, id, nr);

fprintf(output, "%*s%s%*s",
csv_output ? 0 : 18,
Expand Down

0 comments on commit 582ec08

Please sign in to comment.