Commit 4087d11cd9455cd28da0795504451d1188633a0d
Committed by
Arnaldo Carvalho de Melo
1 parent
4e6e311e59
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
perf hists browser: Print overhead percent value for first-level callchain
Currently perf report on TUI doesn't print percent for first-level callchain entry. I guess it (wrongly) assumes that there's only a single callchain in the first level. This patch fixes it by handling the first level callchains same as others - if it's not 100% it should print the percent value. Also it'll affect other callchains in the other way around - if it's 100% (single callchain) it should not print the percentage. Before: - 30.95% 6.84% abc2 abc2 [.] a - a - 70.00% c - 100.00% apic_timer_interrupt smp_apic_timer_interrupt local_apic_timer_interrupt hrtimer_interrupt ... + 30.00% b + __libc_start_main After: - 30.95% 6.84% abc2 abc2 [.] a - 77.90% a - 70.00% c - apic_timer_interrupt smp_apic_timer_interrupt local_apic_timer_interrupt hrtimer_interrupt ... + 30.00% b + 22.10% __libc_start_main Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com> 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: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung.kim@lge.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1416816807-6495-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Showing 1 changed file with 12 additions and 2 deletions Side-by-side Diff
tools/perf/ui/browsers/hists.c
... | ... | @@ -542,8 +542,11 @@ |
542 | 542 | struct rb_node *node; |
543 | 543 | int first_row = row, offset = level * LEVEL_OFFSET_STEP; |
544 | 544 | u64 new_total; |
545 | + bool need_percent; | |
545 | 546 | |
546 | 547 | node = rb_first(root); |
548 | + need_percent = !!rb_next(node); | |
549 | + | |
547 | 550 | while (node) { |
548 | 551 | struct callchain_node *child = rb_entry(node, struct callchain_node, rb_node); |
549 | 552 | struct rb_node *next = rb_next(node); |
... | ... | @@ -560,7 +563,7 @@ |
560 | 563 | |
561 | 564 | if (first) |
562 | 565 | first = false; |
563 | - else if (level > 1) | |
566 | + else if (need_percent) | |
564 | 567 | extra_offset = LEVEL_OFFSET_STEP; |
565 | 568 | |
566 | 569 | folded_sign = callchain_list__folded(chain); |
... | ... | @@ -573,7 +576,7 @@ |
573 | 576 | str = callchain_list__sym_name(chain, bf, sizeof(bf), |
574 | 577 | browser->show_dso); |
575 | 578 | |
576 | - if (was_first && level > 1) { | |
579 | + if (was_first && need_percent) { | |
577 | 580 | double percent = cumul * 100.0 / total; |
578 | 581 | |
579 | 582 | if (asprintf(&alloc_str, "%2.2f%% %s", percent, str) < 0) |
... | ... | @@ -789,6 +792,13 @@ |
789 | 792 | .row_offset = row_offset, |
790 | 793 | .is_current_entry = current_entry, |
791 | 794 | }; |
795 | + | |
796 | + if (callchain_param.mode == CHAIN_GRAPH_REL) { | |
797 | + if (symbol_conf.cumulate_callchain) | |
798 | + total = entry->stat_acc->period; | |
799 | + else | |
800 | + total = entry->stat.period; | |
801 | + } | |
792 | 802 | |
793 | 803 | printed += hist_browser__show_callchain(browser, |
794 | 804 | &entry->sorted_chain, 1, row, total, |
-
mentioned in commit c09e31
-
mentioned in commit c09e31
-
mentioned in commit c09e31
-
mentioned in commit c09e31
-
mentioned in commit c09e31
-
mentioned in commit c09e31
-
mentioned in commit c09e31
-
mentioned in commit c09e31
-
mentioned in commit c09e31
-
mentioned in commit c09e31
-
mentioned in commit c09e31
-
mentioned in commit c09e31
-
mentioned in commit c09e31