Skip to contentSkip to conversation

perf report: fix broken perf report -n on 32-bit systems

PATCH In review Stephane Eranian 2 participants 2 messages Oct 22, 2012 – Oct 23, 2012 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf report: fix broken perf report -n on 32-bit systems

On 32-bit systems, using perf report -n would yield garbage for the Samples column. This is because the hpp code was assuming the hist_entry.stat.nr_events was u64 when in reality it was u32.

This patch fixes the problem by defining nr_events to be u64. u32 is too small anyway.

---

tools/perf/ui/browsers/hists.c +1 -1
index ef2f93c..616757e 100644
@@ -992,7 +992,7 @@ static int hist_browser__fprintf_entry(struct hist_browser *browser,
 	printed += fprintf(fp, " %5.2f%%", percent);
 
 	if (symbol_conf.show_nr_samples)
-		printed += fprintf(fp, " %11u", he->stat.nr_events);
+		printed += fprintf(fp, " %11"PRIu64, he->stat.nr_events);
 
 	if (symbol_conf.show_total_period)
 		printed += fprintf(fp, " %12" PRIu64, he->stat.period);
tools/perf/util/sort.h +1 -1
index 13761d8..ecda054 100644
@@ -49,7 +49,7 @@ struct he_stat {
 	u64			period_us;
 	u64			period_guest_sys;
 	u64			period_guest_us;
-	u32			nr_events;
+	u64			nr_events;
 };
 
 struct hist_entry_diff {
maintainer Acked-by on v1 1/1
#1 lore raw

Hi Stephane,

2012-10-22 (월), 23:00 +0200, Stephane Eranian:

Quoted 9 lines

On 32-bit systems, using perf report -n would yield garbage for the Samples column. This is because the hpp code was assuming the hist_entry.stat.nr_events was u64 when in reality it was u32.

This patch fixes the problem by defining nr_events to be u64. u32 is too small anyway.

Thanks,
Namhyung