From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Ingo Molnar <mingo@kernel.org>, Paul Mackerras <paulus@samba.org>,
Namhyung Kim <namhyung.kim@lge.com>,
Namhyung Kim <namhyung@kernel.org>,
LKML <linux-kernel@vger.kernel.org>, Jiri Olsa <jolsa@redhat.com>,
Andi Kleen <andi@firstfloor.org>, David Ahern <dsahern@gmail.com>,
Frederic Weisbecker <fweisbec@gmail.com>
Subject: [PATCH 2/2] perf tools: Collapse first level callchain entry if it has sibling
Date: Mon, 24 Nov 2014 17:13:27 +0900 [thread overview]
Message-ID: <1416816807-6495-2-git-send-email-namhyung@kernel.org> (raw)
In-Reply-To: <1416816807-6495-1-git-send-email-namhyung@kernel.org>
If first level callchain has more than single path like when -g caller
option is given, it should show only first one in the path and hide
others. But it didn't do it properly nad just hindered the output.
Before:
- 80.33% 11.11% abc2 abc2 [.] main
+ 86.18% main
13.82% __libc_start_main
main
After:
- 80.33% 11.11% abc2 abc2 [.] main
+ 86.18% main
+ 13.82% __libc_start_main
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/ui/browsers/hists.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 8d22905a4687..502daff76ceb 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -227,10 +227,14 @@ static void callchain_node__init_have_children_rb_tree(struct callchain_node *no
}
}
-static void callchain_node__init_have_children(struct callchain_node *node)
+static void callchain_node__init_have_children(struct callchain_node *node,
+ bool has_sibling)
{
struct callchain_list *chain;
+ chain = list_entry(node->val.next, struct callchain_list, list);
+ chain->ms.has_children = has_sibling;
+
if (!list_empty(&node->val)) {
chain = list_entry(node->val.prev, struct callchain_list, list);
chain->ms.has_children = !RB_EMPTY_ROOT(&node->rb_root);
@@ -241,11 +245,12 @@ static void callchain_node__init_have_children(struct callchain_node *node)
static void callchain__init_have_children(struct rb_root *root)
{
- struct rb_node *nd;
+ struct rb_node *nd = rb_first(root);
+ bool has_sibling = nd && rb_next(nd);
for (nd = rb_first(root); nd; nd = rb_next(nd)) {
struct callchain_node *node = rb_entry(nd, struct callchain_node, rb_node);
- callchain_node__init_have_children(node);
+ callchain_node__init_have_children(node, has_sibling);
}
}
--
2.1.2
next prev parent reply other threads:[~2014-11-24 8:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-24 8:13 [PATCH 1/2] perf hists browser: Print overhead percent value for first-level callchain Namhyung Kim
2014-11-24 8:13 ` Namhyung Kim [this message]
2014-12-08 6:48 ` [tip:perf/core] perf tools: Collapse first level callchain entry if it has sibling 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:perf/core] " tip-bot for 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=1416816807-6495-2-git-send-email-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=andi@firstfloor.org \
--cc=dsahern@gmail.com \
--cc=fweisbec@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;
as well as URLs for NNTP newsgroup(s).