aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-11-17 12:40:55 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-19 00:03:37 -0500
commit1a105f743d9fa5f7b8eeeca0afb789951164a361 (patch)
tree0cae254f57fafa10d4dfaf08a698ab3896ff7129 /tools
parent13cc5079f235906e60577dbce8da2f9607e67e93 (diff)
perf top: Suppress DSO column if only one is present
E.g. [root@doppio ~]# perf top -U --------------------------------------------------------------------------- PerfTop: 482 irqs/sec kernel:100.0% [1000Hz cycles], (all, 2 CPUs) --------------------------------------------------------------------------- DSO: vmlinux samples pcnt function _______ _____ _________________________ 471.00 47.9% read_hpet 57.00 5.8% acpi_os_read_port 30.00 3.1% hpet_next_event 30.00 3.1% find_busiest_group 22.00 2.2% schedule 18.00 1.8% sched_clock_local 14.00 1.4% _spin_lock_irqsave 14.00 1.4% native_read_tsc 13.00 1.3% trace_hardirqs_off 9.00 0.9% fget_light 9.00 0.9% ioread8 8.00 0.8% do_sys_poll 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: <1258479655-28662-3-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-top.c43
1 files changed, 32 insertions, 11 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index a368978d5177..6db0e37ee33b 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -438,8 +438,9 @@ static void print_sym_table(void)
438 struct sym_entry *syme, *n; 438 struct sym_entry *syme, *n;
439 struct rb_root tmp = RB_ROOT; 439 struct rb_root tmp = RB_ROOT;
440 struct rb_node *nd; 440 struct rb_node *nd;
441 int sym_width = 0, dso_width; 441 int sym_width = 0, dso_width = 0;
442 const int win_width = winsize.ws_col - 1; 442 const int win_width = winsize.ws_col - 1;
443 struct dso *unique_dso = NULL, *first_dso = NULL;
443 444
444 samples = userspace_samples = 0; 445 samples = userspace_samples = 0;
445 446
@@ -509,7 +510,7 @@ static void print_sym_table(void)
509 printf(", %d CPUs)\n", nr_cpus); 510 printf(", %d CPUs)\n", nr_cpus);
510 } 511 }
511 512
512 printf("%-*.*s\n\n", win_width, win_width, graph_dotted_line); 513 printf("%-*.*s\n", win_width, win_width, graph_dotted_line);
513 514
514 if (sym_filter_entry) { 515 if (sym_filter_entry) {
515 show_details(sym_filter_entry); 516 show_details(sym_filter_entry);
@@ -525,28 +526,47 @@ static void print_sym_table(void)
525 (int)syme->snap_count < count_filter) 526 (int)syme->snap_count < count_filter)
526 continue; 527 continue;
527 528
529 if (first_dso == NULL)
530 unique_dso = first_dso = syme->map->dso;
531 else if (syme->map->dso != first_dso)
532 unique_dso = NULL;
533
534 if (syme->map->dso->long_name_len > dso_width)
535 dso_width = syme->map->dso->long_name_len;
536
528 if (syme->name_len > sym_width) 537 if (syme->name_len > sym_width)
529 sym_width = syme->name_len; 538 sym_width = syme->name_len;
530 } 539 }
531 540
532 printed = 0; 541 printed = 0;
533 542
543 if (unique_dso)
544 printf("DSO: %s\n", unique_dso->long_name);
545 else {
546 int max_dso_width = winsize.ws_col - sym_width - 29;
547 if (dso_width > max_dso_width)
548 dso_width = max_dso_width;
549 putchar('\n');
550 }
534 if (nr_counters == 1) 551 if (nr_counters == 1)
535 printf(" samples pcnt"); 552 printf(" samples pcnt");
536 else 553 else
537 printf(" weight samples pcnt"); 554 printf(" weight samples pcnt");
538 555
539 dso_width = winsize.ws_col - sym_width - 29;
540
541 if (verbose) 556 if (verbose)
542 printf(" RIP "); 557 printf(" RIP ");
543 printf(" %-*.*s DSO\n", sym_width, sym_width, "function"); 558 printf(" %-*.*s", sym_width, sym_width, "function");
559 if (!unique_dso)
560 printf(" DSO");
561 putchar('\n');
544 printf(" %s _______ _____", 562 printf(" %s _______ _____",
545 nr_counters == 1 ? " " : "______"); 563 nr_counters == 1 ? " " : "______");
546 if (verbose) 564 if (verbose)
547 printf(" ________________"); 565 printf(" ________________");
548 printf(" %-*.*s %-*.*s\n\n", sym_width, sym_width, graph_line, 566 printf(" %-*.*s", sym_width, sym_width, graph_line);
549 dso_width, dso_width, graph_line); 567 if (!unique_dso)
568 printf(" %-*.*s", dso_width, dso_width, graph_line);
569 puts("\n");
550 570
551 for (nd = rb_first(&tmp); nd; nd = rb_next(nd)) { 571 for (nd = rb_first(&tmp); nd; nd = rb_next(nd)) {
552 struct symbol *sym; 572 struct symbol *sym;
@@ -570,10 +590,11 @@ static void print_sym_table(void)
570 if (verbose) 590 if (verbose)
571 printf(" %016llx", sym->start); 591 printf(" %016llx", sym->start);
572 printf(" %-*.*s", sym_width, sym_width, sym->name); 592 printf(" %-*.*s", sym_width, sym_width, sym->name);
573 printf(" %-*.*s", dso_width, dso_width, 593 if (!unique_dso)
574 dso_width >= syme->map->dso->long_name_len ? 594 printf(" %-*.*s", dso_width, dso_width,
575 syme->map->dso->long_name : 595 dso_width >= syme->map->dso->long_name_len ?
576 syme->map->dso->short_name); 596 syme->map->dso->long_name :
597 syme->map->dso->short_name);
577 printf("\n"); 598 printf("\n");
578 } 599 }
579} 600}