From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: paulus@samba.org, dsahern@gmail.com, tglx@linutronix.de,
fweisbec@gmail.com, acme@redhat.com, namhyung.kim@lge.com,
linux-kernel@vger.kernel.org, andi@firstfloor.org,
namhyung@kernel.org, hpa@zytor.com, jolsa@redhat.com,
mingo@kernel.org, a.p.zijlstra@chello.nl
Subject: [tip:perf/core] perf hists browser: Print overhead percent value for first-level callchain
Date: Sun, 7 Dec 2014 22:48:29 -0800 [thread overview]
Message-ID: <tip-4087d11cd9455cd28da0795504451d1188633a0d@git.kernel.org> (raw)
In-Reply-To: <1416816807-6495-1-git-send-email-namhyung@kernel.org>
Commit-ID: 4087d11cd9455cd28da0795504451d1188633a0d
Gitweb: http://git.kernel.org/tip/4087d11cd9455cd28da0795504451d1188633a0d
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Mon, 24 Nov 2014 17:13:26 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 24 Nov 2014 11:28:48 -0300
perf hists browser: Print overhead percent value for first-level callchain
Currently perf report on TUI doesn't print percent for first-level
callchain entry.
I guess it (wrongly) assumes that there's only a single callchain in the
first level.
This patch fixes it by handling the first level callchains same as
others - if it's not 100% it should print the percent value.
Also it'll affect other callchains in the other way around - if it's
100% (single callchain) it should not print the percentage.
Before:
- 30.95% 6.84% abc2 abc2 [.] a
- a
- 70.00% c
- 100.00% apic_timer_interrupt
smp_apic_timer_interrupt
local_apic_timer_interrupt
hrtimer_interrupt
...
+ 30.00% b
+ __libc_start_main
After:
- 30.95% 6.84% abc2 abc2 [.] a
- 77.90% a
- 70.00% c
- apic_timer_interrupt
smp_apic_timer_interrupt
local_apic_timer_interrupt
hrtimer_interrupt
...
+ 30.00% b
+ 22.10% __libc_start_main
Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1416816807-6495-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/browsers/hists.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 12c17c5..8d22905 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -542,8 +542,11 @@ static int hist_browser__show_callchain(struct hist_browser *browser,
struct rb_node *node;
int first_row = row, offset = level * LEVEL_OFFSET_STEP;
u64 new_total;
+ bool need_percent;
node = rb_first(root);
+ need_percent = !!rb_next(node);
+
while (node) {
struct callchain_node *child = rb_entry(node, struct callchain_node, rb_node);
struct rb_node *next = rb_next(node);
@@ -560,7 +563,7 @@ static int hist_browser__show_callchain(struct hist_browser *browser,
if (first)
first = false;
- else if (level > 1)
+ else if (need_percent)
extra_offset = LEVEL_OFFSET_STEP;
folded_sign = callchain_list__folded(chain);
@@ -573,7 +576,7 @@ static int hist_browser__show_callchain(struct hist_browser *browser,
str = callchain_list__sym_name(chain, bf, sizeof(bf),
browser->show_dso);
- if (was_first && level > 1) {
+ if (was_first && need_percent) {
double percent = cumul * 100.0 / total;
if (asprintf(&alloc_str, "%2.2f%% %s", percent, str) < 0)
@@ -790,6 +793,13 @@ static int hist_browser__show_entry(struct hist_browser *browser,
.is_current_entry = current_entry,
};
+ if (callchain_param.mode == CHAIN_GRAPH_REL) {
+ if (symbol_conf.cumulate_callchain)
+ total = entry->stat_acc->period;
+ else
+ total = entry->stat.period;
+ }
+
printed += hist_browser__show_callchain(browser,
&entry->sorted_chain, 1, row, total,
hist_browser__show_callchain_entry, &arg,
prev parent reply other threads:[~2014-12-08 6:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-24 8:13 [PATCH 1/2] " Namhyung Kim
2014-11-24 8:13 ` [PATCH 2/2] perf tools: Collapse first level callchain entry if it has sibling Namhyung Kim
2014-12-08 6:48 ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-11-24 14:52 ` probe + report for following branch history. was Re: [PATCH 1/2] perf hists browser: Print overhead percent value for first-level callchain Arnaldo Carvalho de Melo
2014-11-24 15:23 ` Arnaldo Carvalho de Melo
2014-11-24 15:25 ` Arnaldo Carvalho de Melo
2014-11-24 15:32 ` Arnaldo Carvalho de Melo
2014-11-24 15:48 ` perf/branch-history branch build broken with NO_DEMANGLE=1 " Arnaldo Carvalho de Melo
2014-11-24 21:23 ` Arnaldo Carvalho de Melo
2014-11-24 22:52 ` Andi Kleen
2014-11-25 1:17 ` Arnaldo Carvalho de Melo
2014-11-27 15:42 ` perf report --branch-history segfaul " Arnaldo Carvalho de Melo
2014-11-27 18:25 ` Andi Kleen
2014-11-27 1:12 ` probe + report for following branch history. was Re: [PATCH 1/2] perf " Namhyung Kim
2014-12-08 6:48 ` tip-bot for Namhyung Kim [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=tip-4087d11cd9455cd28da0795504451d1188633a0d@git.kernel.org \
--to=tipbot@zytor.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=andi@firstfloor.org \
--cc=dsahern@gmail.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung.kim@lge.com \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=tglx@linutronix.de \
/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