aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Galbraith <efault@gmx.de>2009-04-02 04:40:28 -0400
committerIngo Molnar <mingo@elte.hu>2009-04-07 05:32:22 -0400
commit6278af660ff83fbafb18e53fc2747eb2ee6780fa (patch)
tree381d90236e78df4f9ce8d749d33c8eeed1c7afa6
parentbce379bf358738ab8efc8cda2594a299ac685085 (diff)
perf_counter tools: kerneltop: display per function percentage along with event count
------------------------------------------------------------------------------ KernelTop: 90551 irqs/sec kernel:15.0% [NMI, 100000 CPU cycles], (all, 4 CPUs) ------------------------------------------------------------------------------ events pcnt RIP kernel function ______ ______ _____ ________________ _______________ 16871.00 - 19.1% - ffffffff80328e20 : clear_page_c 8810.00 - 9.9% - ffffffff8048ce80 : page_fault 4746.00 - 5.4% - ffffffff8048cae2 : _spin_lock 4428.00 - 5.0% - ffffffff80328e70 : copy_page_c 3340.00 - 3.8% - ffffffff80329090 : copy_user_generic_string! 2679.00 - 3.0% - ffffffff8028a16b : get_page_from_freelist 2254.00 - 2.5% - ffffffff80296f19 : unmap_vmas 2082.00 - 2.4% - ffffffff80297e19 : handle_mm_fault 1754.00 - 2.0% - ffffffff80288dc8 : __rmqueue_smallest 1553.00 - 1.8% - ffffffff8048ca58 : _spin_lock_irqsave 1400.00 - 1.6% - ffffffff8028cdc8 : release_pages 1337.00 - 1.5% - ffffffff80285400 : find_get_page 1335.00 - 1.5% - ffffffff80225a23 : do_page_fault 1299.00 - 1.5% - ffffffff802ba8e7 : __d_lookup 1174.00 - 1.3% - ffffffff802b38f3 : __link_path_walk 1155.00 - 1.3% - ffffffff802843e1 : perf_swcounter_ctx_event! 1137.00 - 1.3% - ffffffff8028d118 : ____pagevec_lru_add 963.00 - 1.1% - ffffffff802a670b : kmem_cache_alloc 885.00 - 1.0% - ffffffff8024bc61 : __wake_up_bit Display per function percentage along with event count. Signed-off-by: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--Documentation/perf_counter/kerneltop.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/Documentation/perf_counter/kerneltop.c b/Documentation/perf_counter/kerneltop.c
index 4f8d7917aba1..15f3a5f90198 100644
--- a/Documentation/perf_counter/kerneltop.c
+++ b/Documentation/perf_counter/kerneltop.c
@@ -636,16 +636,20 @@ static void print_sym_table(void)
636 int counter; 636 int counter;
637 float events_per_sec = events/delay_secs; 637 float events_per_sec = events/delay_secs;
638 float kevents_per_sec = (events-userspace_events)/delay_secs; 638 float kevents_per_sec = (events-userspace_events)/delay_secs;
639 float sum_kevents = 0.0;
639 640
640 events = userspace_events = 0; 641 events = userspace_events = 0;
641 memcpy(tmp, sym_table, sizeof(sym_table[0])*sym_table_count); 642 memcpy(tmp, sym_table, sizeof(sym_table[0])*sym_table_count);
642 qsort(tmp, sym_table_count, sizeof(tmp[0]), compare); 643 qsort(tmp, sym_table_count, sizeof(tmp[0]), compare);
643 644
645 for (i = 0; i < sym_table_count && tmp[i].count[0]; i++)
646 sum_kevents += tmp[i].count[0];
647
644 write(1, CONSOLE_CLEAR, strlen(CONSOLE_CLEAR)); 648 write(1, CONSOLE_CLEAR, strlen(CONSOLE_CLEAR));
645 649
646 printf( 650 printf(
647"------------------------------------------------------------------------------\n"); 651"------------------------------------------------------------------------------\n");
648 printf( " KernelTop:%8.0f irqs/sec kernel:%3.1f%% [%s, ", 652 printf( " KernelTop:%8.0f irqs/sec kernel:%4.1f%% [%s, ",
649 events_per_sec, 653 events_per_sec,
650 100.0 - (100.0*((events_per_sec-kevents_per_sec)/events_per_sec)), 654 100.0 - (100.0*((events_per_sec-kevents_per_sec)/events_per_sec)),
651 nmi ? "NMI" : "IRQ"); 655 nmi ? "NMI" : "IRQ");
@@ -679,34 +683,31 @@ static void print_sym_table(void)
679 printf("------------------------------------------------------------------------------\n\n"); 683 printf("------------------------------------------------------------------------------\n\n");
680 684
681 if (nr_counters == 1) 685 if (nr_counters == 1)
682 printf(" events"); 686 printf(" events pcnt");
683 else 687 else
684 printf(" weight events"); 688 printf(" weight events pcnt");
685 689
686 printf(" RIP kernel function\n" 690 printf(" RIP kernel function\n"
687 " ______ ______ ________________ _______________\n\n" 691 " ______ ______ _____ ________________ _______________\n\n"
688 ); 692 );
689 693
690 printed = 0; 694 for (i = 0, printed = 0; i < sym_table_count; i++) {
691 for (i = 0; i < sym_table_count; i++) { 695 float pcnt;
692 int count; 696 int count;
693 697
694 if (nr_counters == 1) { 698 if (printed <= 18 && tmp[i].count[0] >= count_filter) {
695 if (printed <= 18 && 699 pcnt = 100.0 - (100.0*((sum_kevents-tmp[i].count[0])/sum_kevents));
696 tmp[i].count[0] >= count_filter) { 700
697 printf("%19.2f - %016llx : %s\n", 701 if (nr_counters == 1)
698 sym_weight(tmp + i), tmp[i].addr, tmp[i].sym); 702 printf("%19.2f - %4.1f%% - %016llx : %s\n",
699 printed++; 703 sym_weight(tmp + i),
700 } 704 pcnt, tmp[i].addr, tmp[i].sym);
701 } else { 705 else
702 if (printed <= 18 && 706 printf("%8.1f %10ld - %4.1f%% - %016llx : %s\n",
703 tmp[i].count[0] >= count_filter) { 707 sym_weight(tmp + i),
704 printf("%8.1f %10ld - %016llx : %s\n", 708 tmp[i].count[0],
705 sym_weight(tmp + i), 709 pcnt, tmp[i].addr, tmp[i].sym);
706 tmp[i].count[0], 710 printed++;
707 tmp[i].addr, tmp[i].sym);
708 printed++;
709 }
710 } 711 }
711 /* 712 /*
712 * Add decay to the counts: 713 * Add decay to the counts: