perf tools: Remove show_mask bitmask
authorArnaldo Carvalho de Melo <acme@redhat.com>
Sat, 3 Oct 2009 23:30:48 +0000 (20:30 -0300)
committerIngo Molnar <mingo@elte.hu>
Sun, 4 Oct 2009 17:37:11 +0000 (19:37 +0200)
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>
tools/perf/Makefile
tools/perf/builtin-annotate.c
tools/perf/builtin-report.c
tools/perf/util/event.h

index 8e7509f2d8829dfed6dbdc8f6f2533f1143d86af..2c309a5c68680c3ee9d4216b467ead396f23cfc8 100644 (file)
@@ -323,6 +323,7 @@ LIB_H += ../../include/linux/rbtree.h
 LIB_H += ../../include/linux/list.h
 LIB_H += util/include/linux/list.h
 LIB_H += perf.h
+LIB_H += util/event.h
 LIB_H += util/types.h
 LIB_H += util/levenshtein.h
 LIB_H += util/parse-options.h
index 855094234f2d25fa652b8e97762b731c8ba293a6..35ed97bd0c6326ea9781f0d14f44979cc56eee47 100644 (file)
@@ -29,7 +29,6 @@ static char           const *input_name = "perf.data";
 
 static int             force;
 static int             input;
-static int             show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
 
 static int             full_paths;
 
@@ -97,7 +96,6 @@ static int
 process_sample_event(event_t *event, unsigned long offset, unsigned long head)
 {
        char level;
-       int show = 0;
        struct thread *thread;
        u64 ip = event->ip.ip;
        struct map *map = NULL;
@@ -121,13 +119,11 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
        }
 
        if (event->header.misc & PERF_RECORD_MISC_KERNEL) {
-               show = SHOW_KERNEL;
                level = 'k';
                sym = kernel_maps__find_symbol(ip, &map);
                dump_printf(" ...... dso: %s\n",
                            map ? map->dso->long_name : "<not found>");
        } else if (event->header.misc & PERF_RECORD_MISC_USER) {
-               show = SHOW_USER;
                level = '.';
                map = thread__find_map(thread, ip);
                if (map != NULL) {
@@ -153,17 +149,14 @@ got_map:
                dump_printf(" ...... dso: %s\n",
                            map ? map->dso->long_name : "<not found>");
        } else {
-               show = SHOW_HV;
                level = 'H';
                dump_printf(" ...... dso: [hypervisor]\n");
        }
 
-       if (show & show_mask) {
-               if (hist_entry__add(thread, map, sym, ip, 1, level)) {
-                       fprintf(stderr,
-               "problem incrementing symbol count, skipping event\n");
-                       return -1;
-               }
+       if (hist_entry__add(thread, map, sym, ip, 1, level)) {
+               fprintf(stderr, "problem incrementing symbol count, "
+                               "skipping event\n");
+               return -1;
        }
        total++;
 
index 0e83ffcbe55a4dca36067024080d85b54068d952..fe4aadc9630f5a9db93dc38ae907273c70d4a378 100644 (file)
@@ -38,7 +38,6 @@ static struct strlist *dso_list, *comm_list, *sym_list;
 
 static int             force;
 static int             input;
-static int             show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
 
 static int             full_paths;
 static int             show_nr_samples;
@@ -600,7 +599,6 @@ static int
 process_sample_event(event_t *event, unsigned long offset, unsigned long head)
 {
        char level;
-       int show = 0;
        struct symbol *sym = NULL;
        struct thread *thread;
        u64 ip = event->ip.ip;
@@ -657,42 +655,35 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
        cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
 
        if (cpumode == PERF_RECORD_MISC_KERNEL) {
-               show = SHOW_KERNEL;
                level = 'k';
-
                sym = kernel_maps__find_symbol(ip, &map);
                dump_printf(" ...... dso: %s\n",
                            map ? map->dso->long_name : "<not found>");
        } else if (cpumode == PERF_RECORD_MISC_USER) {
-
-               show = SHOW_USER;
                level = '.';
                sym = resolve_symbol(thread, &map, &ip);
 
        } else {
-               show = SHOW_HV;
                level = 'H';
-
                dump_printf(" ...... dso: [hypervisor]\n");
        }
 
-       if (show & show_mask) {
-               if (dso_list &&
-                   (!map || !map->dso ||
-                    !(strlist__has_entry(dso_list, map->dso->short_name) ||
-                      (map->dso->short_name != map->dso->long_name &&
-                       strlist__has_entry(dso_list, map->dso->long_name)))))
-                       return 0;
+       if (dso_list &&
+           (!map || !map->dso ||
+            !(strlist__has_entry(dso_list, map->dso->short_name) ||
+              (map->dso->short_name != map->dso->long_name &&
+               strlist__has_entry(dso_list, map->dso->long_name)))))
+               return 0;
 
-               if (sym_list && sym && !strlist__has_entry(sym_list, sym->name))
-                       return 0;
+       if (sym_list && sym && !strlist__has_entry(sym_list, sym->name))
+               return 0;
 
-               if (hist_entry__add(thread, map, sym, ip,
-                                   chain, level, period)) {
-                       eprintf("problem incrementing symbol count, skipping event\n");
-                       return -1;
-               }
+       if (hist_entry__add(thread, map, sym, ip,
+                           chain, level, period)) {
+               eprintf("problem incrementing symbol count, skipping event\n");
+               return -1;
        }
+
        total += period;
 
        return 0;
index a39520e6ae8fbad1f37a5900e3039a92c06c0001..c2e62be62798a62d1cc81341a9de872621c29ee1 100644 (file)
@@ -6,12 +6,6 @@
 #include <linux/list.h>
 #include <linux/rbtree.h>
 
-enum {
-       SHOW_KERNEL     = 1,
-       SHOW_USER       = 2,
-       SHOW_HV         = 4,
-};
-
 /*
  * PERF_SAMPLE_IP | PERF_SAMPLE_TID | *
  */