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
Unified · Split
| @@ -224,7 +224,7 @@ static int __cmd_report(void) · 223 unmodified lines | |||
| 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) |
| @@ -95,8 +95,8 @@ typedef union event_union { · 94 unmodified lines | |||
| 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); |