summaryrefslogtreecommitdiff
path: root/tools/perf/ui
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2023-03-28 16:55:40 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2023-04-04 09:39:56 -0300
commit217b7d41ea2038e52991b7a600a0b958330d8ae6 (patch)
tree77331825087426797a3e70787eb136c9e3345acf /tools/perf/ui
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 <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>
Diffstat (limited to 'tools/perf/ui')
-rw-r--r--tools/perf/ui/gtk/annotate.c6
-rw-r--r--tools/perf/ui/gtk/gtk.h2
2 files changed, 6 insertions, 2 deletions
diff --git a/tools/perf/ui/gtk/annotate.c b/tools/perf/ui/gtk/annotate.c
index 0a50e962f9a3..a1c021a6d3c1 100644
--- a/tools/perf/ui/gtk/annotate.c
+++ b/tools/perf/ui/gtk/annotate.c
@@ -162,6 +162,7 @@ static int perf_gtk__annotate_symbol(GtkWidget *window, struct map_symbol *ms,
}
static int symbol__gtk_annotate(struct map_symbol *ms, struct evsel *evsel,
+ struct annotation_options *options,
struct hist_browser_timer *hbt)
{
struct symbol *sym = ms->sym;
@@ -174,7 +175,7 @@ static int symbol__gtk_annotate(struct map_symbol *ms, struct evsel *evsel,
if (ms->map->dso->annotate_warned)
return -1;
- err = symbol__annotate(ms, evsel, &annotation__default_options, NULL);
+ err = symbol__annotate(ms, evsel, options, NULL);
if (err) {
char msg[BUFSIZ];
ms->map->dso->annotate_warned = true;
@@ -242,9 +243,10 @@ static int symbol__gtk_annotate(struct map_symbol *ms, struct evsel *evsel,
int hist_entry__gtk_annotate(struct hist_entry *he,
struct evsel *evsel,
+ struct annotation_options *options,
struct hist_browser_timer *hbt)
{
- return symbol__gtk_annotate(&he->ms, evsel, hbt);
+ return symbol__gtk_annotate(&he->ms, evsel, options, hbt);
}
void perf_gtk__show_annotations(void)
diff --git a/tools/perf/ui/gtk/gtk.h b/tools/perf/ui/gtk/gtk.h
index a2b497f03fd6..1e84dceb5267 100644
--- a/tools/perf/ui/gtk/gtk.h
+++ b/tools/perf/ui/gtk/gtk.h
@@ -56,11 +56,13 @@ struct evsel;
struct evlist;
struct hist_entry;
struct hist_browser_timer;
+struct annotation_options;
int evlist__gtk_browse_hists(struct evlist *evlist, const char *help,
struct hist_browser_timer *hbt, float min_pcnt);
int hist_entry__gtk_annotate(struct hist_entry *he,
struct evsel *evsel,
+ struct annotation_options *options,
struct hist_browser_timer *hbt);
void perf_gtk__show_annotations(void);