diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-03-15 14:03:50 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-03-16 04:52:36 -0400 |
commit | b63be8d7beda7fe5879559be6f70f8e1c93109e4 (patch) | |
tree | f5bd2f8f24030539029d31a18ab18dc35f1cfdb2 /tools/perf/builtin-top.c | |
parent | fc6ceea045031658d0b59af562369eae980b4370 (diff) |
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) | |||
455 | struct sym_entry *syme, *n; | 455 | struct sym_entry *syme, *n; |
456 | struct rb_root tmp = RB_ROOT; | 456 | struct rb_root tmp = RB_ROOT; |
457 | struct rb_node *nd; | 457 | struct rb_node *nd; |
458 | int sym_width = 0, dso_width = 0, max_dso_width; | 458 | int sym_width = 0, dso_width = 0, dso_short_width; |
459 | const int win_width = winsize.ws_col - 1; | 459 | const int win_width = winsize.ws_col - 1; |
460 | 460 | ||
461 | samples = userspace_samples = 0; | 461 | samples = userspace_samples = 0; |
@@ -545,15 +545,20 @@ static void print_sym_table(void) | |||
545 | if (syme->map->dso->long_name_len > dso_width) | 545 | if (syme->map->dso->long_name_len > dso_width) |
546 | dso_width = syme->map->dso->long_name_len; | 546 | dso_width = syme->map->dso->long_name_len; |
547 | 547 | ||
548 | if (syme->map->dso->short_name_len > dso_short_width) | ||
549 | dso_short_width = syme->map->dso->short_name_len; | ||
550 | |||
548 | if (syme->name_len > sym_width) | 551 | if (syme->name_len > sym_width) |
549 | sym_width = syme->name_len; | 552 | sym_width = syme->name_len; |
550 | } | 553 | } |
551 | 554 | ||
552 | printed = 0; | 555 | printed = 0; |
553 | 556 | ||
554 | max_dso_width = winsize.ws_col - sym_width - 29; | 557 | if (sym_width + dso_width > winsize.ws_col - 29) { |
555 | if (dso_width > max_dso_width) | 558 | dso_width = dso_short_width; |
556 | dso_width = max_dso_width; | 559 | if (sym_width + dso_width > winsize.ws_col - 29) |
560 | sym_width = winsize.ws_col - dso_width - 29; | ||
561 | } | ||
557 | putchar('\n'); | 562 | putchar('\n'); |
558 | if (nr_counters == 1) | 563 | if (nr_counters == 1) |
559 | printf(" samples pcnt"); | 564 | printf(" samples pcnt"); |