[PATCH 3/3] perf tools: Fix leaked account of hist period on collapsing

From: Frederic Weisbecker
Date: Sat Oct 15 2011 - 14:36:25 EST


When we collapse the hists, we forget to account the part that
is collapsed into the other. This messes up the stats everytime
we sort by at least by comm.

Fix this by acccounting the collapsed side.

Before:

perf report -s comm --stdio

# Events: 26K cycles
#
# Overhead Command
# ........ .......
#
46388.16% perf

After:
perf report -s comm --stdio

# Events: 26K cycles
#
# Overhead Command
# ........ .......
#
100.00% perf

Signed-off-by: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: David Ahern <dsahern@xxxxxxxxx>
Cc: Stephane Eranian <eranian@xxxxxxxxxx>
---
tools/perf/util/hist.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index cef40d8..57d6e78 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -297,6 +297,8 @@ static bool hists__collapse_insert_entry(struct hists *hists,

if (!cmp) {
iter->period += he->period;
+ if (!iter->filtered)
+ hists->stats.total_period += he->period;
iter->nr_events += he->nr_events;
if (symbol_conf.use_callchain) {
callchain_cursor_reset(&hists->callchain_cursor);
--
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/