2009-12-16 16:31:59

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [PATCH 1/1] perf diff: Percent calcs should use double values

From: Arnaldo Carvalho de Melo <[email protected]>

Cc: Frédéric Weisbecker <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Paul Mackerras <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/util/hist.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index ecf853c..1bf8658 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -494,9 +494,9 @@ static size_t hist_entry__fprintf(struct hist_entry *self,
double old_percent = 0, new_percent = 0, diff;

if (total > 0)
- old_percent = (count * 100) / total;
+ old_percent = (count * 100.0) / total;
if (session->events_stats.total > 0)
- new_percent = (self->count * 100) / session->events_stats.total;
+ new_percent = (self->count * 100.0) / session->events_stats.total;

diff = old_percent - new_percent;

--
1.6.2.5