mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
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 <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Andres Freund <andres@anarazel.de> Cc: German Gomez <german.gomez@arm.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Nathan Chancellor <nathan@kernel.org> Cc: Nick Desaulniers <ndesaulniers@google.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sandipan Das <sandipan.das@amd.com> Cc: Tom Rix <trix@redhat.com> Cc: llvm@lists.linux.dev Link: https://lore.kernel.org/r/20230328235543.1082207-2-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
8f08c363fd
commit
217b7d41ea
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user