diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2012-09-03 02:53:08 (GMT) |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-09-08 16:20:05 (GMT) |
commit | 7e62ef44e89e7b7f2c48090a048f2a5dffa838c7 (patch) | |
tree | 6b67fe5cb51f361917582f09634283c5290d24d0 /tools/perf/ui | |
parent | 9ffad987ff565999d91fc2783dd77f08094a743b (diff) | |
download | linux-7e62ef44e89e7b7f2c48090a048f2a5dffa838c7.tar.xz |
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>
Diffstat (limited to 'tools/perf/ui')
-rw-r--r-- | tools/perf/ui/hist.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index 009adf20..031b349 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, return ret; } + +/* + * See hists__fprintf to match the column widths + */ +unsigned int hists__sort_list_width(struct hists *hists) +{ + struct sort_entry *se; + int i, ret = 0; + + for (i = 0; i < PERF_HPP__MAX_INDEX; i++) { + if (!perf_hpp__format[i].cond) + continue; + if (i) + ret += 2; + + ret += perf_hpp__format[i].width(NULL); + } + + list_for_each_entry(se, &hist_entry__sort_list, list) + if (!se->elide) + ret += 2 + hists__col_len(hists, se->se_width_idx); + + if (verbose) /* Addr + origin */ + ret += 3 + BITS_PER_LONG / 4; + + return ret; +} |