]> Pileus Git - ~andy/linux/blobdiff - tools/perf/builtin-top.c
perf diff: Improve the help text
[~andy/linux] / tools / perf / builtin-top.c
index b13f42625549f76c15a5948d0672d7e74e8ed74b..296e809c2538a7bc333dd82b2082d285629c0331 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,7 @@ 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;
+static struct symbol_conf      symbol_conf;
 
 /*
  * Source
@@ -926,7 +927,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,7 +948,7 @@ static void event__process_sample(const event_t *self, int counter)
                return;
        }
 
-       if (event__preprocess_sample(self, &al, symbol_filter) < 0 ||
+       if (event__preprocess_sample(self, session, &al, symbol_filter) < 0 ||
            al.sym == NULL)
                return;
 
@@ -1053,7 +1055,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 +1159,13 @@ 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,
+                                                        &symbol_conf);
+       if (session == NULL)
+               return -ENOMEM;
 
        if (target_pid != -1)
                event__synthesize_thread(target_pid, event__process, session);