Merge branch 'for-rmk/samsung6' of git://git.fluff.org/bjdooks/linux into devel-stable
[linux-2.6.git] / tools / perf / builtin-top.c
index b13f426..4b91d8c 100644 (file)
@@ -20,8 +20,9 @@
 
 #include "perf.h"
 
-#include "util/symbol.h"
 #include "util/color.h"
+#include "util/session.h"
+#include "util/symbol.h"
 #include "util/thread.h"
 #include "util/util.h"
 #include <linux/rbtree.h>
@@ -79,7 +80,6 @@ static int                    dump_symtab                     =      0;
 static bool                    hide_kernel_symbols             =  false;
 static bool                    hide_user_symbols               =  false;
 static struct winsize          winsize;
-struct symbol_conf             symbol_conf;
 
 /*
  * Source
@@ -705,7 +705,7 @@ static void print_mapped_keys(void)
                fprintf(stdout, "\t[w]     toggle display weighted/count[E]r. \t(%d)\n", display_weighted ? 1 : 0);
 
        fprintf(stdout,
-               "\t[K]     hide kernel_symbols symbols.             \t(%s)\n",
+               "\t[K]     hide kernel_symbols symbols.     \t(%s)\n",
                hide_kernel_symbols ? "yes" : "no");
        fprintf(stdout,
                "\t[U]     hide user symbols.               \t(%s)\n",
@@ -926,7 +926,8 @@ static int symbol_filter(struct map *map, struct symbol *sym)
        return 0;
 }
 
-static void event__process_sample(const event_t *self, int counter)
+static void event__process_sample(const event_t *self,
+                                struct perf_session *session, int counter)
 {
        u64 ip = self->ip.ip;
        struct sym_entry *syme;
@@ -946,8 +947,8 @@ static void event__process_sample(const event_t *self, int counter)
                return;
        }
 
-       if (event__preprocess_sample(self, &al, symbol_filter) < 0 ||
-           al.sym == NULL)
+       if (event__preprocess_sample(self, session, &al, symbol_filter) < 0 ||
+           al.sym == NULL || al.filtered)
                return;
 
        syme = symbol__priv(al.sym);
@@ -1053,7 +1054,7 @@ static void perf_session__mmap_read_counter(struct perf_session *self,
                }
 
                if (event->header.type == PERF_RECORD_SAMPLE)
-                       event__process_sample(event, md->counter);
+                       event__process_sample(event, self, md->counter);
                else
                        event__process(event, self);
                old += size;
@@ -1157,10 +1158,12 @@ static int __cmd_top(void)
        int i, counter;
        int ret;
        /*
-        * XXX perf_session__new should allow passing a O_MMAP, so that all this
-        * mmap reading, etc is encapsulated in it.
+        * FIXME: perf_session__new should allow passing a O_MMAP, so that all this
+        * mmap reading, etc is encapsulated in it. Use O_WRONLY for now.
         */
-       struct perf_session *session = NULL;
+       struct perf_session *session = perf_session__new(NULL, O_WRONLY, false);
+       if (session == NULL)
+               return -ENOMEM;
 
        if (target_pid != -1)
                event__synthesize_thread(target_pid, event__process, session);
@@ -1279,7 +1282,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
                                 (nr_counters + 1) * sizeof(unsigned long));
        if (symbol_conf.vmlinux_name == NULL)
                symbol_conf.try_vmlinux_path = true;
-       if (symbol__init(&symbol_conf) < 0)
+       if (symbol__init() < 0)
                return -1;
 
        if (delay_secs < 1)