aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-10-03 19:30:48 -0400
committerIngo Molnar <mingo@elte.hu>2009-10-04 13:37:11 -0400
commitec218fc4a796a1b584741d59ef22615d96981188 (patch)
tree59e1060af0aa674d32bb81701bd08802209ef416
parent9735abf11bec48bfbbb1b54772a02deb2ae0c403 (diff)
perf tools: Remove show_mask bitmask
As it was not being exposed via any command line and with --dsos/--comms we can do this and even more, like asking for just kernel + some module: [root@doppio linux-2.6-tip]# perf report --dsos \[kernel\],\[drm\] --vmlinux /home/acme/git/build/tip-recvmmsg/vmlinux --modules | head -15 # Samples: 619669 # # Overhead Command Shared Object Symbol # ........ ............... ............. ...... # 7.12% swapper [kernel] [k] read_hpet 6.86% init [kernel] [k] read_hpet 6.22% init [kernel] [k] mwait_idle_with_hints 5.34% swapper [kernel] [k] mwait_idle_with_hints 3.01% firefox [kernel] [.] vread_hpet 2.14% Xorg [drm] [k] drm_clflush_pages 2.09% pidgin [kernel] [.] vread_hpet 1.58% npviewer.bin [kernel] [.] vread_hpet 1.37% swapper [kernel] [k] hpet_next_event 1.23% Xorg [kernel] [k] read_hpet [root@doppio linux-2.6-tip]# Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Mike Galbraith <efault@gmx.de> LKML-Reference: <20091003233048.GA30535@ghostprotocols.net> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--tools/perf/Makefile1
-rw-r--r--tools/perf/builtin-annotate.c15
-rw-r--r--tools/perf/builtin-report.c35
-rw-r--r--tools/perf/util/event.h6
4 files changed, 18 insertions, 39 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 8e7509f2d882..2c309a5c6868 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -323,6 +323,7 @@ LIB_H += ../../include/linux/rbtree.h
323LIB_H += ../../include/linux/list.h 323LIB_H += ../../include/linux/list.h
324LIB_H += util/include/linux/list.h 324LIB_H += util/include/linux/list.h
325LIB_H += perf.h 325LIB_H += perf.h
326LIB_H += util/event.h
326LIB_H += util/types.h 327LIB_H += util/types.h
327LIB_H += util/levenshtein.h 328LIB_H += util/levenshtein.h
328LIB_H += util/parse-options.h 329LIB_H += util/parse-options.h
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 855094234f2d..35ed97bd0c63 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -29,7 +29,6 @@ static char const *input_name = "perf.data";
29 29
30static int force; 30static int force;
31static int input; 31static int input;
32static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
33 32
34static int full_paths; 33static int full_paths;
35 34
@@ -97,7 +96,6 @@ static int
97process_sample_event(event_t *event, unsigned long offset, unsigned long head) 96process_sample_event(event_t *event, unsigned long offset, unsigned long head)
98{ 97{
99 char level; 98 char level;
100 int show = 0;
101 struct thread *thread; 99 struct thread *thread;
102 u64 ip = event->ip.ip; 100 u64 ip = event->ip.ip;
103 struct map *map = NULL; 101 struct map *map = NULL;
@@ -121,13 +119,11 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
121 } 119 }
122 120
123 if (event->header.misc & PERF_RECORD_MISC_KERNEL) { 121 if (event->header.misc & PERF_RECORD_MISC_KERNEL) {
124 show = SHOW_KERNEL;
125 level = 'k'; 122 level = 'k';
126 sym = kernel_maps__find_symbol(ip, &map); 123 sym = kernel_maps__find_symbol(ip, &map);
127 dump_printf(" ...... dso: %s\n", 124 dump_printf(" ...... dso: %s\n",
128 map ? map->dso->long_name : "<not found>"); 125 map ? map->dso->long_name : "<not found>");
129 } else if (event->header.misc & PERF_RECORD_MISC_USER) { 126 } else if (event->header.misc & PERF_RECORD_MISC_USER) {
130 show = SHOW_USER;
131 level = '.'; 127 level = '.';
132 map = thread__find_map(thread, ip); 128 map = thread__find_map(thread, ip);
133 if (map != NULL) { 129 if (map != NULL) {
@@ -153,17 +149,14 @@ got_map:
153 dump_printf(" ...... dso: %s\n", 149 dump_printf(" ...... dso: %s\n",
154 map ? map->dso->long_name : "<not found>"); 150 map ? map->dso->long_name : "<not found>");
155 } else { 151 } else {
156 show = SHOW_HV;
157 level = 'H'; 152 level = 'H';
158 dump_printf(" ...... dso: [hypervisor]\n"); 153 dump_printf(" ...... dso: [hypervisor]\n");
159 } 154 }
160 155
161 if (show & show_mask) { 156 if (hist_entry__add(thread, map, sym, ip, 1, level)) {
162 if (hist_entry__add(thread, map, sym, ip, 1, level)) { 157 fprintf(stderr, "problem incrementing symbol count, "
163 fprintf(stderr, 158 "skipping event\n");
164 "problem incrementing symbol count, skipping event\n"); 159 return -1;
165 return -1;
166 }
167 } 160 }
168 total++; 161 total++;
169 162
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 0e83ffcbe55a..fe4aadc9630f 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -38,7 +38,6 @@ static struct strlist *dso_list, *comm_list, *sym_list;
38 38
39static int force; 39static int force;
40static int input; 40static int input;
41static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
42 41
43static int full_paths; 42static int full_paths;
44static int show_nr_samples; 43static int show_nr_samples;
@@ -600,7 +599,6 @@ static int
600process_sample_event(event_t *event, unsigned long offset, unsigned long head) 599process_sample_event(event_t *event, unsigned long offset, unsigned long head)
601{ 600{
602 char level; 601 char level;
603 int show = 0;
604 struct symbol *sym = NULL; 602 struct symbol *sym = NULL;
605 struct thread *thread; 603 struct thread *thread;
606 u64 ip = event->ip.ip; 604 u64 ip = event->ip.ip;
@@ -657,42 +655,35 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
657 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; 655 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
658 656
659 if (cpumode == PERF_RECORD_MISC_KERNEL) { 657 if (cpumode == PERF_RECORD_MISC_KERNEL) {
660 show = SHOW_KERNEL;
661 level = 'k'; 658 level = 'k';
662
663 sym = kernel_maps__find_symbol(ip, &map); 659 sym = kernel_maps__find_symbol(ip, &map);
664 dump_printf(" ...... dso: %s\n", 660 dump_printf(" ...... dso: %s\n",
665 map ? map->dso->long_name : "<not found>"); 661 map ? map->dso->long_name : "<not found>");
666 } else if (cpumode == PERF_RECORD_MISC_USER) { 662 } else if (cpumode == PERF_RECORD_MISC_USER) {
667
668 show = SHOW_USER;
669 level = '.'; 663 level = '.';
670 sym = resolve_symbol(thread, &map, &ip); 664 sym = resolve_symbol(thread, &map, &ip);
671 665
672 } else { 666 } else {
673 show = SHOW_HV;
674 level = 'H'; 667 level = 'H';
675
676 dump_printf(" ...... dso: [hypervisor]\n"); 668 dump_printf(" ...... dso: [hypervisor]\n");
677 } 669 }
678 670
679 if (show & show_mask) { 671 if (dso_list &&
680 if (dso_list && 672 (!map || !map->dso ||
681 (!map || !map->dso || 673 !(strlist__has_entry(dso_list, map->dso->short_name) ||
682 !(strlist__has_entry(dso_list, map->dso->short_name) || 674 (map->dso->short_name != map->dso->long_name &&
683 (map->dso->short_name != map->dso->long_name && 675 strlist__has_entry(dso_list, map->dso->long_name)))))
684 strlist__has_entry(dso_list, map->dso->long_name))))) 676 return 0;
685 return 0;
686 677
687 if (sym_list && sym && !strlist__has_entry(sym_list, sym->name)) 678 if (sym_list && sym && !strlist__has_entry(sym_list, sym->name))
688 return 0; 679 return 0;
689 680
690 if (hist_entry__add(thread, map, sym, ip, 681 if (hist_entry__add(thread, map, sym, ip,
691 chain, level, period)) { 682 chain, level, period)) {
692 eprintf("problem incrementing symbol count, skipping event\n"); 683 eprintf("problem incrementing symbol count, skipping event\n");
693 return -1; 684 return -1;
694 }
695 } 685 }
686
696 total += period; 687 total += period;
697 688
698 return 0; 689 return 0;
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index a39520e6ae8f..c2e62be62798 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -6,12 +6,6 @@
6#include <linux/list.h> 6#include <linux/list.h>
7#include <linux/rbtree.h> 7#include <linux/rbtree.h>
8 8
9enum {
10 SHOW_KERNEL = 1,
11 SHOW_USER = 2,
12 SHOW_HV = 4,
13};
14
15/* 9/*
16 * PERF_SAMPLE_IP | PERF_SAMPLE_TID | * 10 * PERF_SAMPLE_IP | PERF_SAMPLE_TID | *
17 */ 11 */