Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1273325
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 36/37] perf ui/gtk: Support flat callchains |
| Date | 2015-11-19 19:00 +0100 |
| Message-ID | <qwBF0-44P-29@gated-at.bofh.it> (permalink) |
| References | <qwBEZ-44P-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Namhyung Kim <namhyung@kernel.org>
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 cff7bb9d9632..0b24cd6d38a4 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)
--
2.1.0
--
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/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:00 +0100
[PATCH 31/37] perf callchain: Add count fields to struct callchain_node Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:00 +0100
Re: [PATCH 31/37] perf callchain: Add count fields to struct callchain_node Frederic Weisbecker <fweisbec@gmail.com> - 2015-11-23 15:40 +0100
Re: [PATCH 31/37] perf callchain: Add count fields to struct callchain_node Namhyung Kim <namhyung@kernel.org> - 2015-11-24 06:20 +0100
[PATCH 27/37] perf tools: Fix machine__create_kernel_maps to put kernel dso refcount Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:00 +0100
[PATCH 06/37] perf bpf: Add BPF_PROLOGUE config options for further patches Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:00 +0100
[PATCH 17/37] perf test: Print result for each LLVM subtest Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:00 +0100
[PATCH 30/37] perf callchain: Abstract callchain print function Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:00 +0100
[PATCH 10/37] perf bpf: Allow BPF program config probing options Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:00 +0100
[PATCH 35/37] perf hists browser: Support folded callchains Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:00 +0100
[PATCH 37/37] perf ui/gtk: Support folded callchains Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:00 +0100
[PATCH 36/37] perf ui/gtk: Support flat callchains Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:00 +0100
[PATCH 34/37] perf hists browser: Support flat callchains Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:00 +0100
Re: [PATCH 34/37] perf hists browser: Support flat callchains Frederic Weisbecker <fweisbec@gmail.com> - 2015-11-23 16:20 +0100
Re: [PATCH 34/37] perf hists browser: Support flat callchains Namhyung Kim <namhyung@kernel.org> - 2015-11-24 06:30 +0100
Re: [PATCH 34/37] perf hists browser: Support flat callchains Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> - 2015-11-24 15:50 +0100
Re: [PATCH 34/37] perf hists browser: Support flat callchains Namhyung Kim <namhyung@kernel.org> - 2015-11-25 02:30 +0100
Re: [PATCH 34/37] perf hists browser: Support flat callchains Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> - 2015-11-25 02:40 +0100
Re: [PATCH 34/37] perf hists browser: Support flat callchains Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> - 2015-11-25 03:20 +0100
Re: [PATCH 34/37] perf hists browser: Support flat callchains Namhyung Kim <namhyung@kernel.org> - 2015-11-25 22:10 +0100
[PATCH 03/37] tools: Adopt memdup() from tools/perf, moving it to tools/lib/string.c Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:00 +0100
[PATCH 02/37] tools: Fix selftests_install Makefile rule Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:00 +0100
[PATCH 33/37] perf hists browser: Factor out hist_browser__show_callchain_list() Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:00 +0100
[PATCH 32/37] perf report: Add callchain value option Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:00 +0100
[PATCH 08/37] perf bpf: Allow BPF program attach to uprobe events Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:10 +0100
[PATCH 21/37] perf machine: Fix machine__findnew_module_map to put registered map Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:10 +0100
[PATCH 14/37] perf test: Fix 'perf test BPF' when it fails to find a suitable vmlinux Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:10 +0100
[PATCH 13/37] perf test: Test the BPF prologue adding infrastructure Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:10 +0100
[PATCH 16/37] perf tests: Pass the subtest index to each test routine Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:10 +0100
[PATCH 18/37] perf test: Print result for each BPF subtest Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:10 +0100
[PATCH 11/37] perf bpf: Add prologue for BPF programs for fetching arguments Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:10 +0100
[PATCH 19/37] perf test: Mute test cases error messages if verbose == 0 Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:10 +0100
[PATCH 22/37] perf machine: Fix machine__destroy_kernel_maps to drop vmlinux_maps references Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:10 +0100
[PATCH 12/37] perf bpf: Generate prologue for BPF programs Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:10 +0100
[PATCH 20/37] perf probe: Fix to free temporal Dwarf_Frame Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:10 +0100
[PATCH 25/37] perf tools: Fix to put new map after inserting to map_groups in dso__load_sym Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:10 +0100
[PATCH 28/37] perf machine: Fix machine__findnew_module_map to put dso Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:10 +0100
[PATCH 26/37] perf tools: Fix __dsos__addnew to put dso after adding it to the list Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:10 +0100
[PATCH 04/37] tools: Clone the kernel's strtobool function Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:10 +0100
[PATCH 23/37] perf machine: Fix to destroy kernel maps when machine exits Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:10 +0100
[PATCH 05/37] bpf tools: Load a program with different instances using preprocessor Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-19 19:10 +0100
RE: [GIT PULL 00/37] perf/core improvements and fixes 平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com> - 2015-11-20 11:10 +0100
Re: [GIT PULL 00/37] perf/core improvements and fixes 'Arnaldo Carvalho de Melo' <acme@kernel.org> - 2015-11-20 13:10 +0100
RE: [GIT PULL 00/37] perf/core improvements and fixes 平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com> - 2015-11-20 18:00 +0100
Re: [GIT PULL 00/37] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2015-11-23 09:20 +0100
csiph-web