aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-top.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-11-24 09:05:14 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-24 10:37:02 -0500
commit7cc017edb9459193d3b581155a14029e4bef0c49 (patch)
tree030c69f7688a83dceee4172bf6fc73606d842130 /tools/perf/builtin-top.c
parente74328d3a17ed75ffdf72b86f289965823a47240 (diff)
perf top: Always show the DSO column, even if its all the same
Ingo found it confusing, and I agree with that, for 'perf report' its OK because it is static, but for a tool refreshing it the eventual switch from column to summary at the top may seem confusing. Suggested-by: Ingo Molnar <mingo@elte.hu> 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: <1259071517-3242-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.c38
1 files changed, 11 insertions, 27 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 6a5de90e9b83..b9a321fd184e 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -451,9 +451,8 @@ static void print_sym_table(void)
451 struct sym_entry *syme, *n; 451 struct sym_entry *syme, *n;
452 struct rb_root tmp = RB_ROOT; 452 struct rb_root tmp = RB_ROOT;
453 struct rb_node *nd; 453 struct rb_node *nd;
454 int sym_width = 0, dso_width = 0; 454 int sym_width = 0, dso_width = 0, max_dso_width;
455 const int win_width = winsize.ws_col - 1; 455 const int win_width = winsize.ws_col - 1;
456 struct dso *unique_dso = NULL, *first_dso = NULL;
457 456
458 samples = userspace_samples = 0; 457 samples = userspace_samples = 0;
459 458
@@ -539,11 +538,6 @@ static void print_sym_table(void)
539 (int)syme->snap_count < count_filter) 538 (int)syme->snap_count < count_filter)
540 continue; 539 continue;
541 540
542 if (first_dso == NULL)
543 unique_dso = first_dso = syme->map->dso;
544 else if (syme->map->dso != first_dso)
545 unique_dso = NULL;
546
547 if (syme->map->dso->long_name_len > dso_width) 541 if (syme->map->dso->long_name_len > dso_width)
548 dso_width = syme->map->dso->long_name_len; 542 dso_width = syme->map->dso->long_name_len;
549 543
@@ -553,14 +547,10 @@ static void print_sym_table(void)
553 547
554 printed = 0; 548 printed = 0;
555 549
556 if (unique_dso) 550 max_dso_width = winsize.ws_col - sym_width - 29;
557 printf("DSO: %s\n", unique_dso->long_name); 551 if (dso_width > max_dso_width)
558 else { 552 dso_width = max_dso_width;
559 int max_dso_width = winsize.ws_col - sym_width - 29; 553 putchar('\n');
560 if (dso_width > max_dso_width)
561 dso_width = max_dso_width;
562 putchar('\n');
563 }
564 if (nr_counters == 1) 554 if (nr_counters == 1)
565 printf(" samples pcnt"); 555 printf(" samples pcnt");
566 else 556 else
@@ -568,17 +558,13 @@ static void print_sym_table(void)
568 558
569 if (verbose) 559 if (verbose)
570 printf(" RIP "); 560 printf(" RIP ");
571 printf(" %-*.*s", sym_width, sym_width, "function"); 561 printf(" %-*.*s DSO\n", sym_width, sym_width, "function");
572 if (!unique_dso)
573 printf(" DSO");
574 putchar('\n');
575 printf(" %s _______ _____", 562 printf(" %s _______ _____",
576 nr_counters == 1 ? " " : "______"); 563 nr_counters == 1 ? " " : "______");
577 if (verbose) 564 if (verbose)
578 printf(" ________________"); 565 printf(" ________________");
579 printf(" %-*.*s", sym_width, sym_width, graph_line); 566 printf(" %-*.*s", sym_width, sym_width, graph_line);
580 if (!unique_dso) 567 printf(" %-*.*s", dso_width, dso_width, graph_line);
581 printf(" %-*.*s", dso_width, dso_width, graph_line);
582 puts("\n"); 568 puts("\n");
583 569
584 for (nd = rb_first(&tmp); nd; nd = rb_next(nd)) { 570 for (nd = rb_first(&tmp); nd; nd = rb_next(nd)) {
@@ -603,12 +589,10 @@ static void print_sym_table(void)
603 if (verbose) 589 if (verbose)
604 printf(" %016llx", sym->start); 590 printf(" %016llx", sym->start);
605 printf(" %-*.*s", sym_width, sym_width, sym->name); 591 printf(" %-*.*s", sym_width, sym_width, sym->name);
606 if (!unique_dso) 592 printf(" %-*.*s\n", dso_width, dso_width,
607 printf(" %-*.*s", dso_width, dso_width, 593 dso_width >= syme->map->dso->long_name_len ?
608 dso_width >= syme->map->dso->long_name_len ? 594 syme->map->dso->long_name :
609 syme->map->dso->long_name : 595 syme->map->dso->short_name);
610 syme->map->dso->short_name);
611 printf("\n");
612 } 596 }
613} 597}
614 598