diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-12-18 10:03:03 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-18 10:22:52 -0500 |
commit | b5b60fda1e462a849bc37dfbace2888191be82cc (patch) | |
tree | 6b4d1e2811bfa9d003fca6b7a6d11b73ec792919 /tools | |
parent | 99e8c5a3b875a34d894a711c9a3669858d6adf45 (diff) |
perf session: Make events_stats u64 to avoid overflow on 32-bit arches
Pekka Enberg reported weird percentages in perf report. It
turns out we are overflowing a 32-bit variables in struct
events_stats on 32-bit architectures.
Before:
[acme@ana linux-2.6-tip]$ perf report -i pekka.perf.data 2> /dev/null | head -10
281.96% Xorg b710a561 [.] 0x000000b710a561
140.15% Xorg [kernel] [k] __initramfs_end
51.56% metacity libgobject-2.0.so.0.2000.1 [.] 0x00000000026e46
35.12% evolution libcairo.so.2.10800.6 [.] 0x000000000203bd
33.84% metacity libpthread-2.9.so [.] 0x00000000007a3d
After:
[acme@ana linux-2.6-tip]$ perf report -i pekka.perf.data 2> /dev/null | head -10
30.04% Xorg b710a561 [.] 0x000000b710a561
14.93% Xorg [kernel] [k] __initramfs_end
5.49% metacity libgobject-2.0.so.0.2000.1 [.] 0x00000000026e46
3.74% evolution libcairo.so.2.10800.6 [.] 0x000000000203bd
3.61% metacity libpthread-2.9.so [.] 0x00000000007a3d
Reported-by: Pekka Enberg <penberg@cs.helsinki.fi>
Tested-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1261148583-20395-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-report.c | 2 | ||||
-rw-r--r-- | tools/perf/util/event.h | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index e50a6b10ee6f..5c2ab5357ec6 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -224,7 +224,7 @@ static int __cmd_report(void) | |||
224 | 224 | ||
225 | perf_session__collapse_resort(session); | 225 | perf_session__collapse_resort(session); |
226 | perf_session__output_resort(session, session->events_stats.total); | 226 | perf_session__output_resort(session, session->events_stats.total); |
227 | fprintf(stdout, "# Samples: %ld\n#\n", session->events_stats.total); | 227 | fprintf(stdout, "# Samples: %Ld\n#\n", session->events_stats.total); |
228 | perf_session__fprintf_hists(session, NULL, false, stdout); | 228 | perf_session__fprintf_hists(session, NULL, false, stdout); |
229 | if (sort_order == default_sort_order && | 229 | if (sort_order == default_sort_order && |
230 | parent_pattern == default_parent_pattern) | 230 | parent_pattern == default_parent_pattern) |
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 8027309b0422..690a96d0467c 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h | |||
@@ -95,8 +95,8 @@ typedef union event_union { | |||
95 | } event_t; | 95 | } event_t; |
96 | 96 | ||
97 | struct events_stats { | 97 | struct events_stats { |
98 | unsigned long total; | 98 | u64 total; |
99 | unsigned long lost; | 99 | u64 lost; |
100 | }; | 100 | }; |
101 | 101 | ||
102 | void event__print_totals(void); | 102 | void event__print_totals(void); |