public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf stat: fix per-socket output bug for uncore events
@ 2013-07-05 17:06 Stephane Eranian
  2013-07-05 19:12 ` Andi Kleen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stephane Eranian @ 2013-07-05 17:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: peterz, mingo, jolsa, ak, zheng.z.yan, namhyung.kim


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>
---

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 7e910ba..128e168 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -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))
@@ -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;
@@ -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,

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf stat: fix per-socket output bug for uncore events
  2013-07-05 17:06 [PATCH] perf stat: fix per-socket output bug for uncore events Stephane Eranian
@ 2013-07-05 19:12 ` Andi Kleen
  2013-07-05 20:37 ` Arnaldo Carvalho de Melo
  2013-07-12  8:52 ` [tip:perf/urgent] perf stat: Fix " tip-bot for Stephane Eranian
  2 siblings, 0 replies; 4+ messages in thread
From: Andi Kleen @ 2013-07-05 19:12 UTC (permalink / raw)
  To: Stephane Eranian
  Cc: linux-kernel, peterz, mingo, jolsa, zheng.z.yan, namhyung.kim

> Reported-by: Andi Kleen <ak@linux.intel.com>
> Signed-off-by: Stephane Eranian <eranian@google.com>

Tested-by: Andi Kleen <ak@linux.intel.com>

Works for me. Thanks.

-Andi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf stat: fix per-socket output bug for uncore events
  2013-07-05 17:06 [PATCH] perf stat: fix per-socket output bug for uncore events Stephane Eranian
  2013-07-05 19:12 ` Andi Kleen
@ 2013-07-05 20:37 ` Arnaldo Carvalho de Melo
  2013-07-12  8:52 ` [tip:perf/urgent] perf stat: Fix " tip-bot for Stephane Eranian
  2 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-07-05 20:37 UTC (permalink / raw)
  To: Stephane Eranian
  Cc: linux-kernel, peterz, mingo, jolsa, ak, zheng.z.yan, namhyung.kim

Em Fri, Jul 05, 2013 at 07:06:45PM +0200, Stephane Eranian escreveu:
> 
> 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>

Thanks, applied.

- Arnaldo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:perf/urgent] perf stat: Fix per-socket output bug for uncore events
  2013-07-05 17:06 [PATCH] perf stat: fix per-socket output bug for uncore events Stephane Eranian
  2013-07-05 19:12 ` Andi Kleen
  2013-07-05 20:37 ` Arnaldo Carvalho de Melo
@ 2013-07-12  8:52 ` tip-bot for Stephane Eranian
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Stephane Eranian @ 2013-07-12  8:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, eranian, hpa, mingo, peterz, namhyung.kim,
	jolsa, ak, tglx, mingo

Commit-ID:  582ec0829b3dd74d8c0f58403a3f9df8cbaa9c7d
Gitweb:     http://git.kernel.org/tip/582ec0829b3dd74d8c0f58403a3f9df8cbaa9c7d
Author:     Stephane Eranian <eranian@google.com>
AuthorDate: Fri, 5 Jul 2013 19:06:45 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 8 Jul 2013 18:01:46 -0300

perf stat: Fix per-socket output bug for uncore events

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>
---
 tools/perf/builtin-stat.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 95768af..352fbd7 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -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))
@@ -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;
@@ -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,

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-07-12  8:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-05 17:06 [PATCH] perf stat: fix per-socket output bug for uncore events Stephane Eranian
2013-07-05 19:12 ` Andi Kleen
2013-07-05 20:37 ` Arnaldo Carvalho de Melo
2013-07-12  8:52 ` [tip:perf/urgent] perf stat: Fix " tip-bot for Stephane Eranian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox