diff options
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..1f529321607e 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 = 0; |
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"); |