mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	David Ahern <dsahern@gmail.com>,
	Stephane Eranian <eranian@google.com>
Subject: [PATCH 3/3] perf tools: Fix leaked account of hist period on collapsing
Date: Sat, 15 Oct 2011 20:36:13 +0200	[thread overview]
Message-ID: <1318703773-6846-3-git-send-email-fweisbec@gmail.com> (raw)
In-Reply-To: <1318703773-6846-1-git-send-email-fweisbec@gmail.com>

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@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: David Ahern <dsahern@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
---
 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


      parent reply	other threads:[~2011-10-15 18:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-15 18:36 [PATCH 1/3] perf tools: Fix double count of total period Frederic Weisbecker
2011-10-15 18:36 ` [PATCH 2/3] perf tools: Reset hists number of entries before collapsing Frederic Weisbecker
2011-10-15 18:36 ` Frederic Weisbecker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1318703773-6846-3-git-send-email-fweisbec@gmail.com \
    --to=fweisbec@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®