aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/browsers/hists.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/ui/browsers/hists.c')
-rw-r--r--tools/perf/ui/browsers/hists.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index ccc4bd161420..57b82c26cd05 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -587,6 +587,8 @@ HPP__COLOR_FN(overhead_guest_us, period_guest_us)
587 587
588void hist_browser__init_hpp(void) 588void hist_browser__init_hpp(void)
589{ 589{
590 perf_hpp__column_enable(PERF_HPP__OVERHEAD);
591
590 perf_hpp__init(); 592 perf_hpp__init();
591 593
592 perf_hpp__format[PERF_HPP__OVERHEAD].color = 594 perf_hpp__format[PERF_HPP__OVERHEAD].color =
@@ -607,12 +609,13 @@ static int hist_browser__show_entry(struct hist_browser *browser,
607{ 609{
608 char s[256]; 610 char s[256];
609 double percent; 611 double percent;
610 int i, printed = 0; 612 int printed = 0;
611 int width = browser->b.width; 613 int width = browser->b.width;
612 char folded_sign = ' '; 614 char folded_sign = ' ';
613 bool current_entry = ui_browser__is_current_entry(&browser->b, row); 615 bool current_entry = ui_browser__is_current_entry(&browser->b, row);
614 off_t row_offset = entry->row_offset; 616 off_t row_offset = entry->row_offset;
615 bool first = true; 617 bool first = true;
618 struct perf_hpp_fmt *fmt;
616 619
617 if (current_entry) { 620 if (current_entry) {
618 browser->he_selection = entry; 621 browser->he_selection = entry;
@@ -629,12 +632,11 @@ static int hist_browser__show_entry(struct hist_browser *browser,
629 .buf = s, 632 .buf = s,
630 .size = sizeof(s), 633 .size = sizeof(s),
631 }; 634 };
635 int i = 0;
632 636
633 ui_browser__gotorc(&browser->b, row, 0); 637 ui_browser__gotorc(&browser->b, row, 0);
634 638
635 for (i = 0; i < PERF_HPP__MAX_INDEX; i++) { 639 perf_hpp__for_each_format(fmt) {
636 if (!perf_hpp__format[i].cond)
637 continue;
638 640
639 if (!first) { 641 if (!first) {
640 slsmg_printf(" "); 642 slsmg_printf(" ");
@@ -642,14 +644,14 @@ static int hist_browser__show_entry(struct hist_browser *browser,
642 } 644 }
643 first = false; 645 first = false;
644 646
645 if (perf_hpp__format[i].color) { 647 if (fmt->color) {
646 hpp.ptr = &percent; 648 hpp.ptr = &percent;
647 /* It will set percent for us. See HPP__COLOR_FN above. */ 649 /* It will set percent for us. See HPP__COLOR_FN above. */
648 width -= perf_hpp__format[i].color(&hpp, entry); 650 width -= fmt->color(&hpp, entry);
649 651
650 ui_browser__set_percent_color(&browser->b, percent, current_entry); 652 ui_browser__set_percent_color(&browser->b, percent, current_entry);
651 653
652 if (i == PERF_HPP__OVERHEAD && symbol_conf.use_callchain) { 654 if (!i && symbol_conf.use_callchain) {
653 slsmg_printf("%c ", folded_sign); 655 slsmg_printf("%c ", folded_sign);
654 width -= 2; 656 width -= 2;
655 } 657 }
@@ -659,9 +661,11 @@ static int hist_browser__show_entry(struct hist_browser *browser,
659 if (!current_entry || !browser->b.navkeypressed) 661 if (!current_entry || !browser->b.navkeypressed)
660 ui_browser__set_color(&browser->b, HE_COLORSET_NORMAL); 662 ui_browser__set_color(&browser->b, HE_COLORSET_NORMAL);
661 } else { 663 } else {
662 width -= perf_hpp__format[i].entry(&hpp, entry); 664 width -= fmt->entry(&hpp, entry);
663 slsmg_printf("%s", s); 665 slsmg_printf("%s", s);
664 } 666 }
667
668 i++;
665 } 669 }
666 670
667 /* The scroll bar isn't being used */ 671 /* The scroll bar isn't being used */