aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2014-11-21 04:31:09 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-12-01 18:00:30 -0500
commit9bf1a52914c7e810091f7726790fc42242a2dafe (patch)
treece7feaffd9be8f80fdde15a9a0756c0ef179e8df /tools
parent060c4f9c8cc871a96dfacdc9306101e8b9195805 (diff)
perf stat: Make read_counter work over the thread dimension
The read function will be used later for both aggr and cpu counters, so we need to make it work over threads as well. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Andi Kleen <ak@linux.intel.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Matt Fleming <matt.fleming@intel.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1416562275-12404-6-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-stat.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 9cc0db1d7f06..2511d3aae708 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -444,11 +444,18 @@ static int read_counter_aggr(struct perf_evsel *counter)
444 */ 444 */
445static int read_counter(struct perf_evsel *counter) 445static int read_counter(struct perf_evsel *counter)
446{ 446{
447 int cpu; 447 int nthreads = thread_map__nr(evsel_list->threads);
448 int ncpus = perf_evsel__nr_cpus(counter);
449 int cpu, thread;
448 450
449 for (cpu = 0; cpu < perf_evsel__nr_cpus(counter); cpu++) { 451 if (counter->system_wide)
450 if (perf_evsel__read_cb(counter, cpu, 0, read_cb)) 452 nthreads = 1;
451 return -1; 453
454 for (thread = 0; thread < nthreads; thread++) {
455 for (cpu = 0; cpu < ncpus; cpu++) {
456 if (perf_evsel__read_cb(counter, cpu, thread, read_cb))
457 return -1;
458 }
452 } 459 }
453 460
454 return 0; 461 return 0;