diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/perf/ui/browsers/hists.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 6b22baf525dd..41dbb79c992e 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
| @@ -660,6 +660,7 @@ static int hist_browser__show_callchain_list(struct hist_browser *browser, | |||
| 660 | static int hist_browser__show_callchain_flat(struct hist_browser *browser, | 660 | static int hist_browser__show_callchain_flat(struct hist_browser *browser, |
| 661 | struct rb_root *root, | 661 | struct rb_root *root, |
| 662 | unsigned short row, u64 total, | 662 | unsigned short row, u64 total, |
| 663 | u64 parent_total __maybe_unused, | ||
| 663 | print_callchain_entry_fn print, | 664 | print_callchain_entry_fn print, |
| 664 | struct callchain_print_arg *arg, | 665 | struct callchain_print_arg *arg, |
| 665 | check_output_full_fn is_output_full) | 666 | check_output_full_fn is_output_full) |
| @@ -763,6 +764,7 @@ static char *hist_browser__folded_callchain_str(struct hist_browser *browser, | |||
| 763 | static int hist_browser__show_callchain_folded(struct hist_browser *browser, | 764 | static int hist_browser__show_callchain_folded(struct hist_browser *browser, |
| 764 | struct rb_root *root, | 765 | struct rb_root *root, |
| 765 | unsigned short row, u64 total, | 766 | unsigned short row, u64 total, |
| 767 | u64 parent_total __maybe_unused, | ||
| 766 | print_callchain_entry_fn print, | 768 | print_callchain_entry_fn print, |
| 767 | struct callchain_print_arg *arg, | 769 | struct callchain_print_arg *arg, |
| 768 | check_output_full_fn is_output_full) | 770 | check_output_full_fn is_output_full) |
| @@ -847,14 +849,18 @@ next: | |||
| 847 | static int hist_browser__show_callchain_graph(struct hist_browser *browser, | 849 | static int hist_browser__show_callchain_graph(struct hist_browser *browser, |
| 848 | struct rb_root *root, int level, | 850 | struct rb_root *root, int level, |
| 849 | unsigned short row, u64 total, | 851 | unsigned short row, u64 total, |
| 852 | u64 parent_total, | ||
| 850 | print_callchain_entry_fn print, | 853 | print_callchain_entry_fn print, |
| 851 | struct callchain_print_arg *arg, | 854 | struct callchain_print_arg *arg, |
| 852 | check_output_full_fn is_output_full) | 855 | check_output_full_fn is_output_full) |
| 853 | { | 856 | { |
| 854 | struct rb_node *node; | 857 | struct rb_node *node; |
| 855 | int first_row = row, offset = level * LEVEL_OFFSET_STEP; | 858 | int first_row = row, offset = level * LEVEL_OFFSET_STEP; |
| 856 | u64 new_total; | ||
| 857 | bool need_percent; | 859 | bool need_percent; |
| 860 | u64 percent_total = total; | ||
| 861 | |||
| 862 | if (callchain_param.mode == CHAIN_GRAPH_REL) | ||
| 863 | percent_total = parent_total; | ||
| 858 | 864 | ||
| 859 | node = rb_first(root); | 865 | node = rb_first(root); |
| 860 | need_percent = node && rb_next(node); | 866 | need_percent = node && rb_next(node); |
| @@ -878,7 +884,7 @@ static int hist_browser__show_callchain_graph(struct hist_browser *browser, | |||
| 878 | folded_sign = callchain_list__folded(chain); | 884 | folded_sign = callchain_list__folded(chain); |
| 879 | 885 | ||
| 880 | row += hist_browser__show_callchain_list(browser, child, | 886 | row += hist_browser__show_callchain_list(browser, child, |
| 881 | chain, row, total, | 887 | chain, row, percent_total, |
| 882 | was_first && need_percent, | 888 | was_first && need_percent, |
| 883 | offset + extra_offset, | 889 | offset + extra_offset, |
| 884 | print, arg); | 890 | print, arg); |
| @@ -893,13 +899,9 @@ static int hist_browser__show_callchain_graph(struct hist_browser *browser, | |||
| 893 | if (folded_sign == '-') { | 899 | if (folded_sign == '-') { |
| 894 | const int new_level = level + (extra_offset ? 2 : 1); | 900 | const int new_level = level + (extra_offset ? 2 : 1); |
| 895 | 901 | ||
| 896 | if (callchain_param.mode == CHAIN_GRAPH_REL) | ||
| 897 | new_total = child->children_hit; | ||
| 898 | else | ||
| 899 | new_total = total; | ||
| 900 | |||
| 901 | row += hist_browser__show_callchain_graph(browser, &child->rb_root, | 902 | row += hist_browser__show_callchain_graph(browser, &child->rb_root, |
| 902 | new_level, row, new_total, | 903 | new_level, row, total, |
| 904 | child->children_hit, | ||
| 903 | print, arg, is_output_full); | 905 | print, arg, is_output_full); |
| 904 | } | 906 | } |
| 905 | if (is_output_full(browser, row)) | 907 | if (is_output_full(browser, row)) |
| @@ -918,27 +920,29 @@ static int hist_browser__show_callchain(struct hist_browser *browser, | |||
| 918 | check_output_full_fn is_output_full) | 920 | check_output_full_fn is_output_full) |
| 919 | { | 921 | { |
| 920 | u64 total = hists__total_period(entry->hists); | 922 | u64 total = hists__total_period(entry->hists); |
| 923 | u64 parent_total; | ||
| 921 | int printed; | 924 | int printed; |
| 922 | 925 | ||
| 923 | if (callchain_param.mode == CHAIN_GRAPH_REL) { | 926 | if (symbol_conf.cumulate_callchain) |
| 924 | if (symbol_conf.cumulate_callchain) | 927 | parent_total = entry->stat_acc->period; |
| 925 | total = entry->stat_acc->period; | 928 | else |
| 926 | else | 929 | parent_total = entry->stat.period; |
| 927 | total = entry->stat.period; | ||
| 928 | } | ||
| 929 | 930 | ||
| 930 | if (callchain_param.mode == CHAIN_FLAT) { | 931 | if (callchain_param.mode == CHAIN_FLAT) { |
| 931 | printed = hist_browser__show_callchain_flat(browser, | 932 | printed = hist_browser__show_callchain_flat(browser, |
| 932 | &entry->sorted_chain, row, total, | 933 | &entry->sorted_chain, row, |
| 933 | print, arg, is_output_full); | 934 | total, parent_total, print, arg, |
| 935 | is_output_full); | ||
| 934 | } else if (callchain_param.mode == CHAIN_FOLDED) { | 936 | } else if (callchain_param.mode == CHAIN_FOLDED) { |
| 935 | printed = hist_browser__show_callchain_folded(browser, | 937 | printed = hist_browser__show_callchain_folded(browser, |
| 936 | &entry->sorted_chain, row, total, | 938 | &entry->sorted_chain, row, |
| 937 | print, arg, is_output_full); | 939 | total, parent_total, print, arg, |
| 940 | is_output_full); | ||
| 938 | } else { | 941 | } else { |
| 939 | printed = hist_browser__show_callchain_graph(browser, | 942 | printed = hist_browser__show_callchain_graph(browser, |
| 940 | &entry->sorted_chain, level, row, total, | 943 | &entry->sorted_chain, level, row, |
| 941 | print, arg, is_output_full); | 944 | total, parent_total, print, arg, |
| 945 | is_output_full); | ||
| 942 | } | 946 | } |
| 943 | 947 | ||
| 944 | if (arg->is_current_entry) | 948 | if (arg->is_current_entry) |
