aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2016-01-27 10:40:54 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-02-01 15:44:30 -0500
commit0c841c6c16f320704f75970bbe6a9800c53e6cf5 (patch)
treee64f53008d93292d7c3d90e9d5a7457e8d4a2e49 /tools/perf/ui
parent7ed5d6e28a0a1a54f554b0ab9c38a6061e7cac9e (diff)
perf hists browser: Fix dump to show correct callchain style
The commit 8c430a348699 ("perf hists browser: Support folded callchains") missed to update hist_browser__dump() so it always shows graph-style callchains regardless of current setting. To fix that, factor out callchain printing code and rename the existing function which prints graph-style callchain. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Wang Nan <wangnan0@huawei.com> Fixes: 8c430a348699 ("perf hists browser: Support folded callchains") Link: http://lkml.kernel.org/r/1453909257-26015-8-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui')
-rw-r--r--tools/perf/ui/browsers/hists.c73
1 files changed, 41 insertions, 32 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 1da30f8aa7a5..6b22baf525dd 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -844,7 +844,7 @@ next:
844 return row - first_row; 844 return row - first_row;
845} 845}
846 846
847static int hist_browser__show_callchain(struct hist_browser *browser, 847static int hist_browser__show_callchain_graph(struct hist_browser *browser,
848 struct rb_root *root, int level, 848 struct rb_root *root, int level,
849 unsigned short row, u64 total, 849 unsigned short row, u64 total,
850 print_callchain_entry_fn print, 850 print_callchain_entry_fn print,
@@ -898,7 +898,7 @@ static int hist_browser__show_callchain(struct hist_browser *browser,
898 else 898 else
899 new_total = total; 899 new_total = total;
900 900
901 row += hist_browser__show_callchain(browser, &child->rb_root, 901 row += hist_browser__show_callchain_graph(browser, &child->rb_root,
902 new_level, row, new_total, 902 new_level, row, new_total,
903 print, arg, is_output_full); 903 print, arg, is_output_full);
904 } 904 }
@@ -910,6 +910,43 @@ out:
910 return row - first_row; 910 return row - first_row;
911} 911}
912 912
913static int hist_browser__show_callchain(struct hist_browser *browser,
914 struct hist_entry *entry, int level,
915 unsigned short row,
916 print_callchain_entry_fn print,
917 struct callchain_print_arg *arg,
918 check_output_full_fn is_output_full)
919{
920 u64 total = hists__total_period(entry->hists);
921 int printed;
922
923 if (callchain_param.mode == CHAIN_GRAPH_REL) {
924 if (symbol_conf.cumulate_callchain)
925 total = entry->stat_acc->period;
926 else
927 total = entry->stat.period;
928 }
929
930 if (callchain_param.mode == CHAIN_FLAT) {
931 printed = hist_browser__show_callchain_flat(browser,
932 &entry->sorted_chain, row, total,
933 print, arg, is_output_full);
934 } else if (callchain_param.mode == CHAIN_FOLDED) {
935 printed = hist_browser__show_callchain_folded(browser,
936 &entry->sorted_chain, row, total,
937 print, arg, is_output_full);
938 } else {
939 printed = hist_browser__show_callchain_graph(browser,
940 &entry->sorted_chain, level, row, total,
941 print, arg, is_output_full);
942 }
943
944 if (arg->is_current_entry)
945 browser->he_selection = entry;
946
947 return printed;
948}
949
913struct hpp_arg { 950struct hpp_arg {
914 struct ui_browser *b; 951 struct ui_browser *b;
915 char folded_sign; 952 char folded_sign;
@@ -1084,38 +1121,14 @@ static int hist_browser__show_entry(struct hist_browser *browser,
1084 --row_offset; 1121 --row_offset;
1085 1122
1086 if (folded_sign == '-' && row != browser->b.rows) { 1123 if (folded_sign == '-' && row != browser->b.rows) {
1087 u64 total = hists__total_period(entry->hists);
1088 struct callchain_print_arg arg = { 1124 struct callchain_print_arg arg = {
1089 .row_offset = row_offset, 1125 .row_offset = row_offset,
1090 .is_current_entry = current_entry, 1126 .is_current_entry = current_entry,
1091 }; 1127 };
1092 1128
1093 if (callchain_param.mode == CHAIN_GRAPH_REL) { 1129 printed += hist_browser__show_callchain(browser, entry, 1, row,
1094 if (symbol_conf.cumulate_callchain)
1095 total = entry->stat_acc->period;
1096 else
1097 total = entry->stat.period;
1098 }
1099
1100 if (callchain_param.mode == CHAIN_FLAT) {
1101 printed += hist_browser__show_callchain_flat(browser,
1102 &entry->sorted_chain, row, total,
1103 hist_browser__show_callchain_entry, &arg, 1130 hist_browser__show_callchain_entry, &arg,
1104 hist_browser__check_output_full); 1131 hist_browser__check_output_full);
1105 } else if (callchain_param.mode == CHAIN_FOLDED) {
1106 printed += hist_browser__show_callchain_folded(browser,
1107 &entry->sorted_chain, row, total,
1108 hist_browser__show_callchain_entry, &arg,
1109 hist_browser__check_output_full);
1110 } else {
1111 printed += hist_browser__show_callchain(browser,
1112 &entry->sorted_chain, 1, row, total,
1113 hist_browser__show_callchain_entry, &arg,
1114 hist_browser__check_output_full);
1115 }
1116
1117 if (arg.is_current_entry)
1118 browser->he_selection = entry;
1119 } 1132 }
1120 1133
1121 return printed; 1134 return printed;
@@ -1380,15 +1393,11 @@ do_offset:
1380static int hist_browser__fprintf_callchain(struct hist_browser *browser, 1393static int hist_browser__fprintf_callchain(struct hist_browser *browser,
1381 struct hist_entry *he, FILE *fp) 1394 struct hist_entry *he, FILE *fp)
1382{ 1395{
1383 u64 total = hists__total_period(he->hists);
1384 struct callchain_print_arg arg = { 1396 struct callchain_print_arg arg = {
1385 .fp = fp, 1397 .fp = fp,
1386 }; 1398 };
1387 1399
1388 if (symbol_conf.cumulate_callchain) 1400 hist_browser__show_callchain(browser, he, 1, 0,
1389 total = he->stat_acc->period;
1390
1391 hist_browser__show_callchain(browser, &he->sorted_chain, 1, 0, total,
1392 hist_browser__fprintf_callchain_entry, &arg, 1401 hist_browser__fprintf_callchain_entry, &arg,
1393 hist_browser__check_dump_full); 1402 hist_browser__check_dump_full);
1394 return arg.printed; 1403 return arg.printed;