Skip to contentSkip to conversation

perf stat fix

GIT PULL New Arnaldo Carvalho de Melo 2 participants 3 messages Aug 28, 2015 – Aug 31, 2015 perf events

lore
Share & tools
lore

Arnaldo Carvalho de Melo

author maintainer
#0 lore raw

Hi Ingo,

Please consider applying,

Kan Liang (1):
perf stat: Get correct cpu id for print_aggr

 tools/perf/builtin-stat.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Signature · 29 lines
2.1.0

The following changes since commit 196676497f2507966f99abef63bede6a8550f8b3:

  Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2015-08-20 11:47:14 +0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo

for you to fetch changes up to 601083cffb7cabdcc55b8195d732f0f7028570fa:

  perf stat: Get correct cpu id for print_aggr (2015-08-28 11:49:52 -0300)

----------------------------------------------------------------
perf/urgent fix:

User visible:

- Use index, not CPU id, to find core/pkg id in 'perf stat' (Kan Liang)

Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>

----------------------------------------------------------------
Kan Liang (1):
      perf stat: Get correct cpu id for print_aggr

 tools/perf/builtin-stat.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
author maintainer
#1 lore raw

PATCH 1/1 perf stat: Get correct cpu id for print_aggr

From: Kan Liang <[email protected]>

print_aggr() fails to print per-core/per-socket statistics after commit 582ec0829b3d ("perf stat: Fix per-socket output bug for uncore events") if events have differnt cpus. Because in print_aggr(), aggr_get_id needs index (not cpu id) to find core/pkg id. Also, evsel cpu maps should be used to get aggregated id.

Here is an example:

Counting events cycles,uncore_imc_0/cas_count_read/. (Uncore event has cpumask 0,18)

  $ perf stat -e cycles,uncore_imc_0/cas_count_read/ -C0,18 --per-core sleep 2

Without this patch, it failes to get CPU 18 result.

Performance counter stats for 'CPU(s) 0,18':

  S0-C0           1            7526851      cycles
  S0-C0           1               1.05 MiB  uncore_imc_0/cas_count_read/
  S1-C0           0      <not counted>      cycles
  S1-C0           0      <not counted> MiB  uncore_imc_0/cas_count_read/

With this patch, it can get both CPU0 and CPU18 result.

Performance counter stats for 'CPU(s) 0,18':

  S0-C0           1            6327768      cycles
  S0-C0           1               0.47 MiB  uncore_imc_0/cas_count_read/
  S1-C0           1             330228      cycles
  S1-C0           1               0.29 MiB  uncore_imc_0/cas_count_read/
Cc Adrian Hunter <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Fixes 582ec0829b3d ("perf stat: Fix per-socket output bug for uncore events")
---
 tools/perf/builtin-stat.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
tools/perf/builtin-stat.c +2 -3
index d99d850e1444..ef355fc0e870 100644
@@ -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;
Signature · 1 line
2.1.0
#2 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 40 lines · Arnaldo Carvalho de Melo

Hi Ingo,

Please consider applying,

Kan Liang (1):
perf stat: Get correct cpu id for print_aggr

 tools/perf/builtin-stat.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Signature · 29 lines
2.1.0

The following changes since commit 196676497f2507966f99abef63bede6a8550f8b3:

  Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2015-08-20 11:47:14 +0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo

for you to fetch changes up to 601083cffb7cabdcc55b8195d732f0f7028570fa:

  perf stat: Get correct cpu id for print_aggr (2015-08-28 11:49:52 -0300)

----------------------------------------------------------------
perf/urgent fix:

User visible:

- Use index, not CPU id, to find core/pkg id in 'perf stat' (Kan Liang)

Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>

----------------------------------------------------------------
Kan Liang (1):
      perf stat: Get correct cpu id for print_aggr

 tools/perf/builtin-stat.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Pulled, thanks Arnaldo!

Ingo