diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-02-17 07:37:23 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-02-17 10:56:20 -0500 |
commit | fec9cbd15b9e99bab9bc50f1ed7e20a1087d7c6d (patch) | |
tree | f1a3ab02397fc438e896fc624df8903689c98288 /tools | |
parent | f0c55bcf4aa41b4b1dbee826513b1acb01bf65e1 (diff) |
perf hists: Print number of samples, not the period sum
So that we match the header where we state the number of events with the
"Samples" column when using 'perf report -n/--show-nr-samples':
[root@emilia ~]# perf record -a sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.111 MB perf.data (~4860 samples) ]
[root@emilia ~]# perf report --stdio --show-nr-samples
# Events: 11 cycles
#
# Overhead Samples Command Shared Object Symbol
# ........ .......... ........... .................. ............................
#
16.65% 1 sleep [kernel.kallsyms] [k] unmap_vmas
16.10% 1 perf libpthread-2.12.so [.] __pthread_cleanup_push_defer
15.79% 2 perf [kernel.kallsyms] [k] format_decode
12.88% 1 kworker/1:2 [kernel.kallsyms] [k] cache_reap
10.69% 1 swapper [kernel.kallsyms] [k] _raw_spin_lock
7.55% 1 sleep [kernel.kallsyms] [k] prepare_exec_creds
6.00% 1 perf [jbd2] [k] start_this_handle
5.29% 1 perf [kernel.kallsyms] [k] seq_read
4.75% 1 perf [kernel.kallsyms] [k] get_pid_task
4.30% 1 perf [kernel.kallsyms] [k] _raw_spin_unlock_irqrestore
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@emilia ~]#
Reported-by: Stephane Eranian <eranian@google.com>
Acked-by: Stephane Eranian <eranian@google.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/hist.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 3f437236f193..da2899e8c6f8 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -591,6 +591,7 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size, | |||
591 | { | 591 | { |
592 | struct sort_entry *se; | 592 | struct sort_entry *se; |
593 | u64 period, total, period_sys, period_us, period_guest_sys, period_guest_us; | 593 | u64 period, total, period_sys, period_us, period_guest_sys, period_guest_us; |
594 | u64 nr_events; | ||
594 | const char *sep = symbol_conf.field_sep; | 595 | const char *sep = symbol_conf.field_sep; |
595 | int ret; | 596 | int ret; |
596 | 597 | ||
@@ -599,6 +600,7 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size, | |||
599 | 600 | ||
600 | if (pair_hists) { | 601 | if (pair_hists) { |
601 | period = self->pair ? self->pair->period : 0; | 602 | period = self->pair ? self->pair->period : 0; |
603 | nr_events = self->pair ? self->pair->nr_events : 0; | ||
602 | total = pair_hists->stats.total_period; | 604 | total = pair_hists->stats.total_period; |
603 | period_sys = self->pair ? self->pair->period_sys : 0; | 605 | period_sys = self->pair ? self->pair->period_sys : 0; |
604 | period_us = self->pair ? self->pair->period_us : 0; | 606 | period_us = self->pair ? self->pair->period_us : 0; |
@@ -606,6 +608,7 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size, | |||
606 | period_guest_us = self->pair ? self->pair->period_guest_us : 0; | 608 | period_guest_us = self->pair ? self->pair->period_guest_us : 0; |
607 | } else { | 609 | } else { |
608 | period = self->period; | 610 | period = self->period; |
611 | nr_events = self->nr_events; | ||
609 | total = session_total; | 612 | total = session_total; |
610 | period_sys = self->period_sys; | 613 | period_sys = self->period_sys; |
611 | period_us = self->period_us; | 614 | period_us = self->period_us; |
@@ -646,9 +649,9 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size, | |||
646 | 649 | ||
647 | if (symbol_conf.show_nr_samples) { | 650 | if (symbol_conf.show_nr_samples) { |
648 | if (sep) | 651 | if (sep) |
649 | ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, period); | 652 | ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, nr_events); |
650 | else | 653 | else |
651 | ret += snprintf(s + ret, size - ret, "%11" PRIu64, period); | 654 | ret += snprintf(s + ret, size - ret, "%11" PRIu64, nr_events); |
652 | } | 655 | } |
653 | 656 | ||
654 | if (pair_hists) { | 657 | if (pair_hists) { |