Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753429AbbKWQQY (ORCPT ); Mon, 23 Nov 2015 11:16:24 -0500 Received: from terminus.zytor.com ([198.137.202.10]:44160 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751366AbbKWQQV (ORCPT ); Mon, 23 Nov 2015 11:16:21 -0500 Date: Mon, 23 Nov 2015 08:16:04 -0800 From: tip-bot for Namhyung Kim Message-ID: Cc: andi@firstfloor.org, namhyung@kernel.org, acme@redhat.com, a.p.zijlstra@chello.nl, fweisbec@gmail.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, kan.liang@intel.com, brendan.d.gregg@gmail.com, dsahern@gmail.com, hpa@zytor.com, penberg@kernel.org, jolsa@redhat.com, mingo@kernel.org Reply-To: brendan.d.gregg@gmail.com, dsahern@gmail.com, kan.liang@intel.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, fweisbec@gmail.com, a.p.zijlstra@chello.nl, acme@redhat.com, namhyung@kernel.org, andi@firstfloor.org, mingo@kernel.org, jolsa@redhat.com, hpa@zytor.com, penberg@kernel.org In-Reply-To: <1447047946-1691-11-git-send-email-namhyung@kernel.org> References: <1447047946-1691-11-git-send-email-namhyung@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf ui/gtk: Support folded callchains Git-Commit-ID: 2c6caff2b26fde8f3f87183f8c97f2cebfdbcb98 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3816 Lines: 115 Commit-ID: 2c6caff2b26fde8f3f87183f8c97f2cebfdbcb98 Gitweb: http://git.kernel.org/tip/2c6caff2b26fde8f3f87183f8c97f2cebfdbcb98 Author: Namhyung Kim AuthorDate: Mon, 9 Nov 2015 14:45:46 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 19 Nov 2015 13:19:26 -0300 perf ui/gtk: Support folded callchains The folded callchain mode is to print all chains in a single line. Currently perf report --gtk doesn't support folded callchains. Like flat callchains, only leaf nodes are added to the final rbtree so it should show entries in parent nodes. Signed-off-by: Namhyung Kim Tested-by: Arnaldo Carvalho de Melo Tested-by: Brendan Gregg Cc: Andi Kleen Cc: David Ahern Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Kan Liang Cc: Pekka Enberg Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1447047946-1691-11-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/ui/gtk/hists.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c index 0b24cd6..4677172 100644 --- a/tools/perf/ui/gtk/hists.c +++ b/tools/perf/ui/gtk/hists.c @@ -152,6 +152,66 @@ static void perf_gtk__add_callchain_flat(struct rb_root *root, GtkTreeStore *sto } } +static void perf_gtk__add_callchain_folded(struct rb_root *root, GtkTreeStore *store, + GtkTreeIter *parent, int col, u64 total) +{ + struct rb_node *nd; + + for (nd = rb_first(root); nd; nd = rb_next(nd)) { + struct callchain_node *node; + struct callchain_list *chain; + GtkTreeIter iter; + char buf[64]; + char *str, *str_alloc = NULL; + bool first = true; + + node = rb_entry(nd, struct callchain_node, rb_node); + + callchain_node__make_parent_list(node); + + list_for_each_entry(chain, &node->parent_val, list) { + char name[1024]; + + callchain_list__sym_name(chain, name, sizeof(name), false); + + if (asprintf(&str, "%s%s%s", + first ? "" : str_alloc, + first ? "" : symbol_conf.field_sep ?: "; ", + name) < 0) + return; + + first = false; + free(str_alloc); + str_alloc = str; + } + + list_for_each_entry(chain, &node->val, list) { + char name[1024]; + + callchain_list__sym_name(chain, name, sizeof(name), false); + + if (asprintf(&str, "%s%s%s", + first ? "" : str_alloc, + first ? "" : symbol_conf.field_sep ?: "; ", + name) < 0) + return; + + first = false; + free(str_alloc); + str_alloc = str; + } + + gtk_tree_store_append(store, &iter, parent); + + callchain_node__scnprintf_value(node, buf, sizeof(buf), total); + gtk_tree_store_set(store, &iter, 0, buf, -1); + + gtk_tree_store_set(store, &iter, col, str, -1); + + free(str_alloc); + } +} + static void perf_gtk__add_callchain_graph(struct rb_root *root, GtkTreeStore *store, GtkTreeIter *parent, int col, u64 total) { @@ -207,6 +267,8 @@ static void perf_gtk__add_callchain(struct rb_root *root, GtkTreeStore *store, { if (callchain_param.mode == CHAIN_FLAT) perf_gtk__add_callchain_flat(root, store, parent, col, total); + else if (callchain_param.mode == CHAIN_FOLDED) + perf_gtk__add_callchain_folded(root, store, parent, col, total); else perf_gtk__add_callchain_graph(root, store, parent, col, total); } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/