Patch "perf stat: Get correct cpu id for print_aggr" has been added to the 4.1-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
perf stat: Get correct cpu id for print_aggr
to the 4.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
perf-stat-get-correct-cpu-id-for-print_aggr.patch
and it can be found in the queue-4.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
601083cffb7cabdcc55b8195d732f0f7028570faMon Sep 17 00:00:00 2001
From: Kan Liang <[email protected]>
Date: Thu, 2 Jul 2015 03:08:43 -0400
Subject: perf stat: Get correct cpu id for print_aggr
From: Kan Liang <[email protected]>
commit 601083cffb7cabdcc55b8195d732f0f7028570fa upstream.
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/
--- tools/perf/builtin-stat.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
tools/perf/builtin-stat.c +2 -3
@@ -1227,7 +1227,7 @@ static void abs_printout(int id, int nr,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;
@@ -1240,8 +1240,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 += counter->counts->cpu[cpu].val;
Patches currently in stable-queue which might be from [email protected] are
queue-4.1/perf-stat-get-correct-cpu-id-for-print_aggr.patch queue-4.1/perf-header-fixup-reading-of-header_nrcpus-feature.patch