aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-09-02 22:53:08 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-09-08 12:20:05 -0400
commit7e62ef44e89e7b7f2c48090a048f2a5dffa838c7 (patch)
tree6b67fe5cb51f361917582f09634283c5290d24d0
parent9ffad987ff565999d91fc2783dd77f08094a743b (diff)
perf hists: Use perf_hpp__format->width to calculate the column widths
Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1346640790-17197-4-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-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{