perf hist: Pass struct sample to __hists__add_entry()
[deliverable/linux.git] / tools / perf / builtin-annotate.c
index 2bf9b3fd9e61546fb8fd58ff9a43f7c5106e2778..b5b8db0b03384fd211c21bea1df7dbf9ce6b7e1a 100644 (file)
@@ -21,7 +21,7 @@
 #include "util/evsel.h"
 #include "util/annotate.h"
 #include "util/event.h"
-#include "util/parse-options.h"
+#include <subcmd/parse-options.h>
 #include "util/parse-events.h"
 #include "util/thread.h"
 #include "util/sort.h"
@@ -47,7 +47,7 @@ struct perf_annotate {
 };
 
 static int perf_evsel__add_sample(struct perf_evsel *evsel,
-                                 struct perf_sample *sample __maybe_unused,
+                                 struct perf_sample *sample,
                                  struct addr_location *al,
                                  struct perf_annotate *ann)
 {
@@ -72,7 +72,10 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel,
                return 0;
        }
 
-       he = __hists__add_entry(hists, al, NULL, NULL, NULL, 1, 1, 0, true);
+       sample->period = 1;
+       sample->weight = 1;
+
+       he = __hists__add_entry(hists, al, NULL, NULL, NULL, sample, true);
        if (he == NULL)
                return -ENOMEM;
 
@@ -343,18 +346,19 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
                return ret;
 
        argc = parse_options(argc, argv, options, annotate_usage, 0);
+       if (argc) {
+               /*
+                * Special case: if there's an argument left then assume that
+                * it's a symbol filter:
+                */
+               if (argc > 1)
+                       usage_with_options(annotate_usage, options);
 
-       if (annotate.use_stdio)
-               use_browser = 0;
-       else if (annotate.use_tui)
-               use_browser = 1;
-       else if (annotate.use_gtk)
-               use_browser = 2;
+               annotate.sym_hist_filter = argv[0];
+       }
 
        file.path  = input_name;
 
-       setup_browser(true);
-
        annotate.session = perf_session__new(&file, false, &annotate.tool);
        if (annotate.session == NULL)
                return -1;
@@ -369,16 +373,14 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
        if (setup_sorting() < 0)
                usage_with_options(annotate_usage, options);
 
-       if (argc) {
-               /*
-                * Special case: if there's an argument left then assume that
-                * it's a symbol filter:
-                */
-               if (argc > 1)
-                       usage_with_options(annotate_usage, options);
+       if (annotate.use_stdio)
+               use_browser = 0;
+       else if (annotate.use_tui)
+               use_browser = 1;
+       else if (annotate.use_gtk)
+               use_browser = 2;
 
-               annotate.sym_hist_filter = argv[0];
-       }
+       setup_browser(true);
 
        ret = __cmd_annotate(&annotate);
 
This page took 0.040138 seconds and 5 git commands to generate.