From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: fweisbec@gmail.com, penberg@kernel.org, andi@firstfloor.org,
acme@redhat.com, namhyung@kernel.org,
linux-kernel@vger.kernel.org, brendan.d.gregg@gmail.com,
a.p.zijlstra@chello.nl, kan.liang@intel.com, jolsa@redhat.com,
dsahern@gmail.com, mingo@kernel.org, tglx@linutronix.de,
hpa@zytor.com
Subject: [tip:perf/core] perf ui/gtk: Support flat callchains
Date: Mon, 23 Nov 2015 08:15:44 -0800 [thread overview]
Message-ID: <tip-3cd99dfd1c87067fb28a19fee76500aed56d7c8f@git.kernel.org> (raw)
In-Reply-To: <1447047946-1691-10-git-send-email-namhyung@kernel.org>
Commit-ID: 3cd99dfd1c87067fb28a19fee76500aed56d7c8f
Gitweb: http://git.kernel.org/tip/3cd99dfd1c87067fb28a19fee76500aed56d7c8f
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Mon, 9 Nov 2015 14:45:45 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 19 Nov 2015 13:19:25 -0300
perf ui/gtk: Support flat callchains
The flat callchain mode is to print all chains in a simple flat
hierarchy so make it easy to see.
Currently perf report --gtk doesn't show flat callchains properly. With
flat callchains, only leaf nodes are added to the final rbtree so it
should show entries in parent nodes. To do that, add parent_val list to
struct callchain_node and show them along with the (normal) val list.
See the previous commit on TUI support for more information.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1447047946-1691-10-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/gtk/hists.c | 80 ++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 76 insertions(+), 4 deletions(-)
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index cff7bb9..0b24cd6 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -89,8 +89,71 @@ void perf_gtk__init_hpp(void)
perf_gtk__hpp_color_overhead_acc;
}
-static void perf_gtk__add_callchain(struct rb_root *root, GtkTreeStore *store,
- GtkTreeIter *parent, int col, u64 total)
+static void perf_gtk__add_callchain_flat(struct rb_root *root, GtkTreeStore *store,
+ GtkTreeIter *parent, int col, u64 total)
+{
+ struct rb_node *nd;
+ bool has_single_node = (rb_first(root) == rb_last(root));
+
+ for (nd = rb_first(root); nd; nd = rb_next(nd)) {
+ struct callchain_node *node;
+ struct callchain_list *chain;
+ GtkTreeIter iter, new_parent;
+ bool need_new_parent;
+
+ node = rb_entry(nd, struct callchain_node, rb_node);
+
+ new_parent = *parent;
+ need_new_parent = !has_single_node;
+
+ callchain_node__make_parent_list(node);
+
+ list_for_each_entry(chain, &node->parent_val, list) {
+ char buf[128];
+
+ gtk_tree_store_append(store, &iter, &new_parent);
+
+ callchain_node__scnprintf_value(node, buf, sizeof(buf), total);
+ gtk_tree_store_set(store, &iter, 0, buf, -1);
+
+ callchain_list__sym_name(chain, buf, sizeof(buf), false);
+ gtk_tree_store_set(store, &iter, col, buf, -1);
+
+ if (need_new_parent) {
+ /*
+ * Only show the top-most symbol in a callchain
+ * if it's not the only callchain.
+ */
+ new_parent = iter;
+ need_new_parent = false;
+ }
+ }
+
+ list_for_each_entry(chain, &node->val, list) {
+ char buf[128];
+
+ gtk_tree_store_append(store, &iter, &new_parent);
+
+ callchain_node__scnprintf_value(node, buf, sizeof(buf), total);
+ gtk_tree_store_set(store, &iter, 0, buf, -1);
+
+ callchain_list__sym_name(chain, buf, sizeof(buf), false);
+ gtk_tree_store_set(store, &iter, col, buf, -1);
+
+ if (need_new_parent) {
+ /*
+ * Only show the top-most symbol in a callchain
+ * if it's not the only callchain.
+ */
+ new_parent = iter;
+ need_new_parent = false;
+ }
+ }
+ }
+}
+
+static void perf_gtk__add_callchain_graph(struct rb_root *root, GtkTreeStore *store,
+ GtkTreeIter *parent, int col, u64 total)
{
struct rb_node *nd;
bool has_single_node = (rb_first(root) == rb_last(root));
@@ -134,11 +197,20 @@ static void perf_gtk__add_callchain(struct rb_root *root, GtkTreeStore *store,
child_total = total;
/* Now 'iter' contains info of the last callchain_list */
- perf_gtk__add_callchain(&node->rb_root, store, &iter, col,
- child_total);
+ perf_gtk__add_callchain_graph(&node->rb_root, store, &iter, col,
+ child_total);
}
}
+static void perf_gtk__add_callchain(struct rb_root *root, GtkTreeStore *store,
+ GtkTreeIter *parent, int col, u64 total)
+{
+ if (callchain_param.mode == CHAIN_FLAT)
+ perf_gtk__add_callchain_flat(root, store, parent, col, total);
+ else
+ perf_gtk__add_callchain_graph(root, store, parent, col, total);
+}
+
static void on_row_activated(GtkTreeView *view, GtkTreePath *path,
GtkTreeViewColumn *col __maybe_unused,
gpointer user_data __maybe_unused)
next prev parent reply other threads:[~2015-11-23 16:16 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-09 5:45 [PATCHSET 0/9] perf report: Support folded callchain output (v5) Namhyung Kim
2015-11-09 5:45 ` [PATCH v5 1/9] perf report: Support folded callchain mode on --stdio Namhyung Kim
2015-11-23 16:13 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-11-09 5:45 ` [PATCH] perf report: [WIP] Support '-F none' option to hide hist lines Namhyung Kim
2015-11-19 14:33 ` Arnaldo Carvalho de Melo
2015-11-20 1:43 ` Namhyung Kim
2015-11-09 5:45 ` [PATCH v5 2/9] perf callchain: Abstract callchain print function Namhyung Kim
2015-11-19 13:41 ` Arnaldo Carvalho de Melo
2015-11-20 1:33 ` Namhyung Kim
2015-11-23 16:13 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-11-09 5:45 ` [PATCH v5 3/9] perf callchain: Add count fields to struct callchain_node Namhyung Kim
2015-11-23 16:14 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-11-09 5:45 ` [PATCH v5 4/9] perf report: Add callchain value option Namhyung Kim
2015-11-19 13:59 ` Arnaldo Carvalho de Melo
2015-11-20 1:39 ` Namhyung Kim
2015-11-20 12:06 ` Arnaldo Carvalho de Melo
2015-11-23 16:14 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-11-09 5:45 ` [PATCH v5 5/9] perf hists browser: Factor out hist_browser__show_callchain_list() Namhyung Kim
2015-11-23 16:14 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-11-09 5:45 ` [PATCH v5 6/9] perf hists browser: Support flat callchains Namhyung Kim
2015-11-23 16:15 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-11-09 5:45 ` [PATCH v5 7/9] perf hists browser: Support folded callchains Namhyung Kim
2015-11-19 14:19 ` Arnaldo Carvalho de Melo
2015-11-20 1:40 ` Namhyung Kim
2015-11-23 16:15 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-11-09 5:45 ` [PATCH v5 8/9] perf ui/gtk: Support flat callchains Namhyung Kim
2015-11-23 16:15 ` tip-bot for Namhyung Kim [this message]
2015-11-09 5:45 ` [PATCH v5 9/9] perf ui/gtk: Support folded callchains Namhyung Kim
2015-11-23 16:16 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-11-12 17:50 ` [PATCHSET 0/9] perf report: Support folded callchain output (v5) Brendan Gregg
2015-11-16 23:09 ` Namhyung Kim
2015-11-17 0:09 ` Arnaldo Carvalho de Melo
2015-11-17 0:22 ` Namhyung Kim
2015-11-17 1:32 ` Arnaldo Carvalho de Melo
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-3cd99dfd1c87067fb28a19fee76500aed56d7c8f@git.kernel.org \
--to=tipbot@zytor.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=andi@firstfloor.org \
--cc=brendan.d.gregg@gmail.com \
--cc=dsahern@gmail.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=kan.liang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=penberg@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.