Merge tag 'arm-soc-fixes-5.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / tools / perf / builtin-annotate.c
index a23ba6b..49627a7 100644 (file)
@@ -239,7 +239,7 @@ static int evsel__add_sample(struct evsel *evsel, struct perf_sample *sample,
        }
 
        /*
-        * XXX filtered samples can still have branch entires pointing into our
+        * XXX filtered samples can still have branch entries pointing into our
         * symbol and are missed.
         */
        process_branch_stack(sample->branch_stack, al, sample);
@@ -374,13 +374,6 @@ find_next:
                } else {
                        hist_entry__tty_annotate(he, evsel, ann);
                        nd = rb_next(nd);
-                       /*
-                        * Since we have a hist_entry per IP for the same
-                        * symbol, free he->ms.sym->src to signal we already
-                        * processed this symbol.
-                        */
-                       zfree(&notes->src->cycles_hist);
-                       zfree(&notes->src);
                }
        }
 }
@@ -411,8 +404,8 @@ static int __cmd_annotate(struct perf_annotate *ann)
                goto out;
 
        if (dump_trace) {
-               perf_session__fprintf_nr_events(session, stdout);
-               evlist__fprintf_nr_events(session->evlist, stdout);
+               perf_session__fprintf_nr_events(session, stdout, false);
+               evlist__fprintf_nr_events(session->evlist, stdout, false);
                goto out;
        }
 
@@ -425,7 +418,7 @@ static int __cmd_annotate(struct perf_annotate *ann)
        total_nr_samples = 0;
        evlist__for_each_entry(session->evlist, pos) {
                struct hists *hists = evsel__hists(pos);
-               u32 nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE];
+               u32 nr_samples = hists->stats.nr_samples;
 
                if (nr_samples > 0) {
                        total_nr_samples += nr_samples;
@@ -538,6 +531,10 @@ int cmd_annotate(int argc, const char **argv)
                    "Strip first N entries of source file path name in programs (with --prefix)"),
        OPT_STRING(0, "objdump", &annotate.opts.objdump_path, "path",
                   "objdump binary to use for disassembly and annotations"),
+       OPT_BOOLEAN(0, "demangle", &symbol_conf.demangle,
+                   "Enable symbol demangling"),
+       OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel,
+                   "Enable kernel symbol demangling"),
        OPT_BOOLEAN(0, "group", &symbol_conf.event_group,
                    "Show event group information together"),
        OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period,
@@ -619,14 +616,22 @@ int cmd_annotate(int argc, const char **argv)
 
        setup_browser(true);
 
-       if ((use_browser == 1 || annotate.use_stdio2) && annotate.has_br_stack) {
+       /*
+        * Events of different processes may correspond to the same
+        * symbol, we do not care about the processes in annotate,
+        * set sort order to avoid repeated output.
+        */
+       sort_order = "dso,symbol";
+
+       /*
+        * Set SORT_MODE__BRANCH so that annotate display IPC/Cycle
+        * if branch info is in perf data in TUI mode.
+        */
+       if ((use_browser == 1 || annotate.use_stdio2) && annotate.has_br_stack)
                sort__mode = SORT_MODE__BRANCH;
-               if (setup_sorting(annotate.session->evlist) < 0)
-                       usage_with_options(annotate_usage, options);
-       } else {
-               if (setup_sorting(NULL) < 0)
-                       usage_with_options(annotate_usage, options);
-       }
+
+       if (setup_sorting(NULL) < 0)
+               usage_with_options(annotate_usage, options);
 
        ret = __cmd_annotate(&annotate);