aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/builtin-annotate.c
diff options
context:
space:
mode:
authorIan Rogers <[email protected]>2023-03-28 16:55:40 -0700
committerArnaldo Carvalho de Melo <[email protected]>2023-04-04 09:39:56 -0300
commit217b7d41ea2038e52991b7a600a0b958330d8ae6 (patch)
tree77331825087426797a3e70787eb136c9e3345acf /tools/perf/builtin-annotate.c
parent8f08c363fd6c682d10f2b055d4287ad1e54e76ea (diff)
perf annotate: Add init/exit to annotation_options remove default
The annotation__default_options global variable was used to initialize annotation_options. Switch to the init/exit pattern as later changes will give ownership over strings and this will be necessary to avoid memory leaks. Committer note: Fix the GTK2=1 build, hist_entry__gtk_annotate() needs to receive a 'struct annotation_options' pointer. Signed-off-by: Ian Rogers <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Andres Freund <[email protected]> Cc: German Gomez <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nathan Chancellor <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Sandipan Das <[email protected]> Cc: Tom Rix <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/perf/builtin-annotate.c')
-rw-r--r--tools/perf/builtin-annotate.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 98d1b6379230..997a1e65d090 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -352,6 +352,7 @@ find_next:
int ret;
int (*annotate)(struct hist_entry *he,
struct evsel *evsel,
+ struct annotation_options *options,
struct hist_browser_timer *hbt);
annotate = dlsym(perf_gtk_handle,
@@ -361,7 +362,7 @@ find_next:
return;
}
- ret = annotate(he, evsel, NULL);
+ ret = annotate(he, evsel, &ann->opts, NULL);
if (!ret || !ann->skip_missing)
return;
@@ -509,7 +510,6 @@ int cmd_annotate(int argc, const char **argv)
.ordered_events = true,
.ordering_requires_timestamps = true,
},
- .opts = annotation__default_options,
};
struct perf_data data = {
.mode = PERF_DATA_MODE_READ,
@@ -598,6 +598,7 @@ int cmd_annotate(int argc, const char **argv)
set_option_flag(options, 0, "show-total-period", PARSE_OPT_EXCLUSIVE);
set_option_flag(options, 0, "show-nr-samples", PARSE_OPT_EXCLUSIVE);
+ annotation_options__init(&annotate.opts);
ret = hists__init();
if (ret < 0)
@@ -698,6 +699,7 @@ out_delete:
#ifndef NDEBUG
perf_session__delete(annotate.session);
#endif
+ annotation_options__exit(&annotate.opts);
return ret;
}