[PATCH] perf hists: Fix determination of a callchain node's childlessness.

From: Andres Freund
Date: Wed Mar 30 2016 - 13:39:28 EST


4b3a3212233a ("perf hists browser: Support flat callchains")
over-aggressively tried to optimize
callchain_node__init_have_children().

That lead to --tui mode not allowing to expand call chain elements if a
call chain element had only one parent. That's why --inverted callgraphs
looked halfway sane, but plain ones didn't.

Revert that individual optimization, it wasn't really related to the
rest of the commit.

Fixes: 4b3a3212233a042f48b7b8fedc64933e1ccd8643

Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>
Signed-off-by: Andres Freund <andres@xxxxxxxxxxx>
---
tools/perf/ui/browsers/hists.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 4b98165..2a83414 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -337,7 +337,7 @@ static void callchain_node__init_have_children(struct callchain_node *node,
chain = list_entry(node->val.next, struct callchain_list, list);
chain->has_children = has_sibling;

- if (node->val.next != node->val.prev) {
+ if (!list_empty(&node->val)) {
chain = list_entry(node->val.prev, struct callchain_list, list);
chain->has_children = !RB_EMPTY_ROOT(&node->rb_root);
}
--
2.7.0.229.g701fa7f.dirty