aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/ui/hist.c27
-rw-r--r--tools/perf/util/hist.c33
2 files changed, 27 insertions, 33 deletions
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 009adf206c8..031b349a3f8 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -360,3 +360,30 @@ int hist_entry__sort_snprintf(struct hist_entry *he, char *s, size_t size,
360 360
361 return ret; 361 return ret;
362} 362}
363
364/*
365 * See hists__fprintf to match the column widths
366 */
367unsigned int hists__sort_list_width(struct hists *hists)
368{
369 struct sort_entry *se;
370 int i, ret = 0;
371
372 for (i = 0; i < PERF_HPP__MAX_INDEX; i++) {
373 if (!perf_hpp__format[i].cond)
374 continue;
375 if (i)
376 ret += 2;
377
378 ret += perf_hpp__format[i].width(NULL);
379 }
380
381 list_for_each_entry(se, &hist_entry__sort_list, list)
382 if (!se->elide)
383 ret += 2 + hists__col_len(hists, se->se_width_idx);
384
385 if (verbose) /* Addr + origin */
386 ret += 3 + BITS_PER_LONG / 4;
387
388 return ret;
389}
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index b1817f15bb8..0ba65ad07cd 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -563,39 +563,6 @@ void hists__output_resort_threaded(struct hists *hists)
563 return __hists__output_resort(hists, true); 563 return __hists__output_resort(hists, true);
564} 564}
565 565
566/*
567 * See hists__fprintf to match the column widths
568 */
569unsigned int hists__sort_list_width(struct hists *hists)
570{
571 struct sort_entry *se;
572 int ret = 9; /* total % */
573
574 if (symbol_conf.show_cpu_utilization) {
575 ret += 7; /* count_sys % */
576 ret += 6; /* count_us % */
577 if (perf_guest) {
578 ret += 13; /* count_guest_sys % */
579 ret += 12; /* count_guest_us % */
580 }
581 }
582
583 if (symbol_conf.show_nr_samples)
584 ret += 11;
585
586 if (symbol_conf.show_total_period)
587 ret += 13;
588
589 list_for_each_entry(se, &hist_entry__sort_list, list)
590 if (!se->elide)
591 ret += 2 + hists__col_len(hists, se->se_width_idx);
592
593 if (verbose) /* Addr + origin */
594 ret += 3 + BITS_PER_LONG / 4;
595
596 return ret;
597}
598
599static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h, 566static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h,
600 enum hist_filter filter) 567 enum hist_filter filter)
601{ 568{