mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung.kim@lge.com>,
	LKML <linux-kernel@vger.kernel.org>, Jiri Olsa <jolsa@redhat.com>,
	David Ahern <dsahern@gmail.com>
Subject: [PATCH 2/5] perf ui/tui: Add support for showing relative percentage
Date: Tue, 14 Jan 2014 13:43:16 +0900	[thread overview]
Message-ID: <1389674599-28227-3-git-send-email-namhyung@kernel.org> (raw)
In-Reply-To: <1389674599-28227-1-git-send-email-namhyung@kernel.org>

When filtering by thread, dso or symbol on TUI it also update total
period so that the output shows different result than no filter - the
percentage changed to relative to filtered entries only.  Sometimes
(always?)  this is not desired since users might expect same results
with filter.

So change this behavior depends on symbol_conf.filter_relative value.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/hist.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 2d81f3aefad0..58c799d9b689 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -696,10 +696,11 @@ static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h
 		return;
 
 	++hists->nr_entries;
+	if (symbol_conf.filter_relative)
+		hists->stats.total_period += h->stat.period;
 	if (h->ms.unfolded)
 		hists->nr_entries += h->nr_rows;
 	h->row_offset = 0;
-	hists->stats.total_period += h->stat.period;
 	hists->stats.nr_events[PERF_RECORD_SAMPLE] += h->stat.nr_events;
 
 	hists__calc_col_len(hists, h);
@@ -722,7 +723,9 @@ void hists__filter_by_dso(struct hists *hists)
 {
 	struct rb_node *nd;
 
-	hists->nr_entries = hists->stats.total_period = 0;
+	hists->nr_entries = 0;
+	if (symbol_conf.filter_relative)
+		hists->stats.total_period = 0;
 	hists->stats.nr_events[PERF_RECORD_SAMPLE] = 0;
 	hists__reset_col_len(hists);
 
@@ -755,7 +758,9 @@ void hists__filter_by_thread(struct hists *hists)
 {
 	struct rb_node *nd;
 
-	hists->nr_entries = hists->stats.total_period = 0;
+	hists->nr_entries = 0;
+	if (symbol_conf.filter_relative)
+		hists->stats.total_period = 0;
 	hists->stats.nr_events[PERF_RECORD_SAMPLE] = 0;
 	hists__reset_col_len(hists);
 
@@ -786,7 +791,9 @@ void hists__filter_by_symbol(struct hists *hists)
 {
 	struct rb_node *nd;
 
-	hists->nr_entries = hists->stats.total_period = 0;
+	hists->nr_entries = 0;
+	if (symbol_conf.filter_relative)
+		hists->stats.total_period = 0;
 	hists->stats.nr_events[PERF_RECORD_SAMPLE] = 0;
 	hists__reset_col_len(hists);
 
-- 
1.7.11.7


  parent reply	other threads:[~2014-01-14  4:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-14  4:43 [PATCHSET 0/5] perf tools: Update on filtered entries' percentage output Namhyung Kim
2014-01-14  4:43 ` [PATCH 1/5] perf tools: Count filtered entries to total period also Namhyung Kim
2014-01-14  4:43 ` Namhyung Kim [this message]
2014-01-14  4:43 ` [PATCH 3/5] perf report: Add --percentage option Namhyung Kim
2014-01-14 21:07   ` Andi Kleen
2014-01-14 21:25     ` Arnaldo Carvalho de Melo
2014-01-15  2:18       ` Namhyung Kim
2014-01-15 18:30         ` Arnaldo Carvalho de Melo
2014-01-16  1:25           ` Namhyung Kim
2014-01-14  4:43 ` [PATCH 4/5] perf report: Add report.percentage config option Namhyung Kim
2014-01-14  4:43 ` [PATCH 5/5] perf tools: Show absolute percentage by default Namhyung Kim
2014-01-22 23:28 [PATCHSET 0/5] perf tools: Update on filtered entries' percentage output (v3) Namhyung Kim
2014-01-22 23:28 ` [PATCH 2/5] perf ui/tui: Add support for showing relative percentage Namhyung Kim

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=1389674599-28227-3-git-send-email-namhyung@kernel.org \
    --to=namhyung@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=dsahern@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=paulus@samba.org \
    /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

Powered by JetHome