perf trace beauty mmap: Add missing MADV_FREE
[cascardo/linux.git] / tools / perf / builtin-top.c
index bd10868..4007857 100644 (file)
@@ -68,6 +68,7 @@
 #include <sys/mman.h>
 
 #include <linux/stringify.h>
+#include <linux/time64.h>
 #include <linux/types.h>
 
 static volatile int done;
@@ -128,10 +129,14 @@ static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
                return err;
        }
 
-       err = symbol__annotate(sym, map, 0);
+       err = symbol__disassemble(sym, map, 0);
        if (err == 0) {
 out_assign:
                top->sym_filter_entry = he;
+       } else {
+               char msg[BUFSIZ];
+               symbol__strerror_disassemble(sym, map, err, msg, sizeof(msg));
+               pr_err("Couldn't annotate %s: %s\n", sym->name, msg);
        }
 
        pthread_mutex_unlock(&notes->lock);
@@ -620,7 +625,7 @@ static void *display_thread(void *arg)
        display_setup_sig();
        pthread__unblock_sigwinch();
 repeat:
-       delay_msecs = top->delay_secs * 1000;
+       delay_msecs = top->delay_secs * MSEC_PER_SEC;
        set_term_quiet_input(&save);
        /* trash return*/
        getc(stdin);
@@ -652,34 +657,6 @@ repeat:
        return NULL;
 }
 
-static int symbol_filter(struct map *map, struct symbol *sym)
-{
-       const char *name = sym->name;
-
-       if (!__map__is_kernel(map))
-               return 0;
-       /*
-        * ppc64 uses function descriptors and appends a '.' to the
-        * start of every instruction address. Remove it.
-        */
-       if (name[0] == '.')
-               name++;
-
-       if (!strcmp(name, "_text") ||
-           !strcmp(name, "_etext") ||
-           !strcmp(name, "_sinittext") ||
-           !strncmp("init_module", name, 11) ||
-           !strncmp("cleanup_module", name, 14) ||
-           strstr(name, "_text_start") ||
-           strstr(name, "_text_end"))
-               return 1;
-
-       if (symbol__is_idle(sym))
-               sym->ignore = true;
-
-       return 0;
-}
-
 static int hist_iter__top_callback(struct hist_entry_iter *iter,
                                   struct addr_location *al, bool single,
                                   void *arg)
@@ -778,7 +755,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
                }
        }
 
-       if (al.sym == NULL || !al.sym->ignore) {
+       if (al.sym == NULL || !al.sym->idle) {
                struct hists *hists = evsel__hists(evsel);
                struct hist_entry_iter iter = {
                        .evsel          = evsel,
@@ -944,8 +921,6 @@ static int __cmd_top(struct perf_top *top)
        if (top->session == NULL)
                return -1;
 
-       machines__set_symbol_filter(&top->session->machines, symbol_filter);
-
        if (!objdump_path) {
                ret = perf_env__lookup_objdump(&top->session->header.env);
                if (ret)
@@ -1319,7 +1294,9 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
        if (symbol_conf.cumulate_callchain && !callchain_param.order_set)
                callchain_param.order = ORDER_CALLER;
 
-       symbol_conf.priv_size = sizeof(struct annotation);
+       status = symbol__annotation_init();
+       if (status < 0)
+               goto out_delete_evlist;
 
        symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL);
        if (symbol__init(NULL) < 0)