diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-03-15 19:03:50 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-03-16 09:52:36 +0100 |
commit | b63be8d7beda7fe5879559be6f70f8e1c93109e4 (patch) | |
tree | f5bd2f8f24030539029d31a18ab18dc35f1cfdb2 /tools/perf/builtin-top.c | |
parent | perf probe: Fix need_dwarf flag if lazy matching is used (diff) | |
download | linux-b63be8d7beda7fe5879559be6f70f8e1c93109e4.tar.xz linux-b63be8d7beda7fe5879559be6f70f8e1c93109e4.zip |
perf top: Improve the autosizing of column lenghts
When profiling C++ workloads the symbol name length can be
really big, so cap it before it garbles the result.
This builds upon the autosizing already present where we choose
to use the short, basename of DSOs instead of its long, full
pathname.
Reported-by: Pavel Krauz <krauz@cngroup.cz>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1268676230-9261-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r-- | tools/perf/builtin-top.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 0b719e3dde05..8364c8aba194 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -455,7 +455,7 @@ static void print_sym_table(void) struct sym_entry *syme, *n; struct rb_root tmp = RB_ROOT; struct rb_node *nd; - int sym_width = 0, dso_width = 0, max_dso_width; + int sym_width = 0, dso_width = 0, dso_short_width; const int win_width = winsize.ws_col - 1; samples = userspace_samples = 0; @@ -545,15 +545,20 @@ static void print_sym_table(void) if (syme->map->dso->long_name_len > dso_width) dso_width = syme->map->dso->long_name_len; + if (syme->map->dso->short_name_len > dso_short_width) + dso_short_width = syme->map->dso->short_name_len; + if (syme->name_len > sym_width) sym_width = syme->name_len; } printed = 0; - max_dso_width = winsize.ws_col - sym_width - 29; - if (dso_width > max_dso_width) - dso_width = max_dso_width; + if (sym_width + dso_width > winsize.ws_col - 29) { + dso_width = dso_short_width; + if (sym_width + dso_width > winsize.ws_col - 29) + sym_width = winsize.ws_col - dso_width - 29; + } putchar('\n'); if (nr_counters == 1) printf(" samples pcnt"); |