perf ui/tui: Fix a small callchain display bug
Namhyung Kim
maintainerPATCH 1/1 perf ui/tui: Fix a small callchain display bug
The currently when perf TUI report shows callchain, the first level chains have bogus '+' sign even though only the last one has children.
Since they are on a single line of the chain, toggling intermediate entries has no effect. Fix it to show '+' sign at the last entry only. Note that non-first level callchain entries don't have this problem.
Before:
Children Self Command Shared Object Symbols
---------------------------------------------------------------------------
- 40.70% 0.00% swapper [kernel.kallsyms] [k] cpuidle_wrap_enter
+ cpuidle_wrap_enter
+ cpuidle_enter_tk
+ cpuidle_idle_call
+ cpu_idle
After:
Children Self Command Shared Object Symbols
---------------------------------------------------------------------------
- 40.70% 0.00% swapper [kernel.kallsyms] [k] cpuidle_wrap_enter
cpuidle_wrap_enter
cpuidle_enter_tk
cpuidle_idle_call
+ cpu_idle
--- tools/perf/ui/browsers/hists.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/ui/browsers/hists.c +3 -1
@@ -228,8 +228,10 @@ static void callchain_node__init_have_children(struct callchain_node *node) {struct callchain_list *chain; -list_for_each_entry (chain, &node->val, list) +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); + }callchain_node__init_have_children_rb_tree (node); }
Signature · 1 line
2.0.0
Quoted 28 lines · Namhyung Kim
The currently when perf TUI report shows callchain, the first level chains have bogus '+' sign even though only the last one has children.
Since they are on a single line of the chain, toggling intermediate entries has no effect. Fix it to show '+' sign at the last entry only. Note that non-first level callchain entries don't have this problem.
Before:
Children Self Command Shared Object Symbols
---------------------------------------------------------------------------
- 40.70% 0.00% swapper [kernel.kallsyms] [k]cpuidle_wrap_enter
+cpuidle_wrap_enter
+cpuidle_enter_tk
+cpuidle_idle_call
+cpu_idleAfter:
Children Self Command Shared Object Symbols
---------------------------------------------------------------------------
- 40.70% 0.00% swapper [kernel.kallsyms] [k]cpuidle_wrap_enter
cpuidle_wrap_enter
cpuidle_enter_tk
cpuidle_idle_call
+cpu_idle
Quoted 2 lines
Cc Frederic Weisbecker <[email protected]>Signed-off-by Namhyung Kim <[email protected]>
Nice fix!
Thanks,
Ingo
Arnaldo Carvalho de Melo
maintainerEm Wed, Aug 13, 2014 at 10:19:09AM +0200, Ingo Molnar escreveu:
Quoted 21 lines · Namhyung Kim
Quoted 20 lines
Before:
Children Self Command Shared Object Symbols
---------------------------------------------------------------------------
- 40.70% 0.00% swapper [kernel.kallsyms] [k]cpuidle_wrap_enter
+cpuidle_wrap_enter
+cpuidle_enter_tk
+cpuidle_idle_call
+cpu_idleAfter:
Children Self Command Shared Object Symbols
---------------------------------------------------------------------------
- 40.70% 0.00% swapper [kernel.kallsyms] [k]cpuidle_wrap_enter
cpuidle_wrap_enter
cpuidle_enter_tk
cpuidle_idle_call
+cpu_idle
Quoted 4 lines
Quoted 2 lines
Cc Frederic Weisbecker <[email protected]>Signed-off-by Namhyung Kim <[email protected]>Nice fix!
Indeed, longstanding problem, kudos to Namhyung for deving into TUI + callchain land to fix this!
- Arnaldo
Quoted 5 lines
Acked-by Ingo Molnar <[email protected]>Thanks,
Ingo
Arnaldo Carvalho de Melo
maintainerEm Wed, Aug 13, 2014 at 03:02:41PM +0900, Namhyung Kim escreveu:
Quoted 8 lines
The currently when perf TUI report shows callchain, the first level chains have bogus '+' sign even though only the last one has children.
Since they are on a single line of the chain, toggling intermediate entries has no effect. Fix it to show '+' sign at the last entry only. Note that non-first level callchain entries don't have this problem.
Quoted 4 lines
Before:
Children Self Command Shared Object Symbols
---------------------------------------------------------------------------
Please avoid starting a line with --- inside the changeset comment log as this confuses scripts, that takes that as the end of the comment, like in ... (see below)
Quoted 16 lines
- 40.70% 0.00% swapper [kernel.kallsyms] [k]
cpuidle_wrap_enter
+cpuidle_wrap_enter
+cpuidle_enter_tk
+cpuidle_idle_call
+cpu_idleAfter:
Children Self Command Shared Object Symbols
---------------------------------------------------------------------------
- 40.70% 0.00% swapper [kernel.kallsyms] [k]cpuidle_wrap_enter
cpuidle_wrap_enter
cpuidle_enter_tk
cpuidle_idle_call
+cpu_idle
Quoted 3 lines
Cc Frederic Weisbecker <[email protected]>Signed-off-by Namhyung Kim <[email protected]>---
... here ^ ^ ^ ^ ^
:-)
Thanks for the fix, checking with 'P' after 'E' to expand everything, before and after, to then do a:
diff -u perf.hist.0 perf.hist.1
- Arnaldo
Quoted 21 lines
tools/perf/ui/browsers/hists.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)tools/perf/ui/browsers/hists.c +3
-1@@ -228,8 +228,10 @@ static void callchain_node__init_have_children(struct callchain_node *node) {struct callchain_list *chain; -list_for_each_entry (chain, &node->val, list) +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); + }callchain_node__init_have_children_rb_tree (node); }Signature · 1 line
2.0.0
tip-bot for Namhyung Kim
merge bot[tip:perf/core] perf hists browser: Fix a small callchain display bug
In reply to Namhyung Kimperf hists browser: Fix a small callchain display bug
Commit-ID: 82162b5ae3d152fd7d887b36213f5b6785fe1294 Gitweb: http://git.kernel.org/tip/82162b5ae3d152fd7d887b36213f5b6785fe1294 Author: Namhyung Kim <[email protected]> AuthorDate: Wed, 13 Aug 2014 15:02:41 +0900 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 13 Aug 2014 17:12:56 -0300
perf hists browser: Fix a small callchain display bug
The currently when perf TUI report shows callchain, the first level chains have bogus '+' sign even though only the last one has children.
Since they are on a single line of the chain, toggling intermediate entries has no effect. Fix it to show '+' sign at the last entry only. Note that non-first level callchain entries don't have this problem.
Before:
---------------------------------------------------------------------------
Children Self Command Shared Object Symbols - 40.70% 0.00% swapper [kernel.kallsyms] [k] cpuidle_wrap_enter
+ cpuidle_wrap_enter
+ cpuidle_enter_tk
+ cpuidle_idle_call
+ cpu_idle
After:
---------------------------------------------------------------------------
Children Self Command Shared Object Symbols - 40.70% 0.00% swapper [kernel.kallsyms] [k] cpuidle_wrap_enter
cpuidle_wrap_enter
cpuidle_enter_tk
cpuidle_idle_call
+ cpu_idle
--- tools/perf/ui/browsers/hists.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/ui/browsers/hists.c +3 -1
@@ -228,8 +228,10 @@ static void callchain_node__init_have_children(struct callchain_node *node) {struct callchain_list *chain; -list_for_each_entry (chain, &node->val, list) +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); + }callchain_node__init_have_children_rb_tree (node); }