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,
return;
}
- ret = annotate(he, evsel, NULL);
+ ret = annotate(he, evsel, &ann->opts, NULL);
if (!ret || !ann->skip_missing)
return;
.ordered_events = true,
.ordering_requires_timestamps = true,
},
- .opts = annotation__default_options,
};
struct perf_data data = {
.mode = PERF_DATA_MODE_READ,
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)
#ifndef NDEBUG
perf_session__delete(annotate.session);
#endif
+ annotation_options__exit(&annotate.opts);
return ret;
}
if (rep->symbol_ipc && sym && !sym->annotate2) {
struct evsel *evsel = hists_to_evsel(he->hists);
- symbol__annotate2(&he->ms, evsel,
- &annotation__default_options, NULL);
+ symbol__annotate2(&he->ms, evsel, &rep->annotation_opts, NULL);
}
return 0;
.max_stack = PERF_MAX_STACK_DEPTH,
.pretty_printing_style = "normal",
.socket_filter = -1,
- .annotation_opts = annotation__default_options,
.skip_empty = true,
};
char *sort_order_help = sort_help("sort by key(s):");
if (ret < 0)
goto exit;
+ annotation_options__init(&report.annotation_opts);
+
ret = perf_config(report__config, &report);
if (ret)
goto exit;
zstd_fini(&(session->zstd_data));
perf_session__delete(session);
exit:
+ annotation_options__exit(&report.annotation_opts);
free(sort_order_help);
free(field_order_help);
return ret;
.sample_time_set = true,
},
.max_stack = sysctl__max_stack(),
- .annotation_opts = annotation__default_options,
.nr_threads_synthesize = UINT_MAX,
};
struct record_opts *opts = &top.record_opts;
if (status < 0)
return status;
+ annotation_options__init(&top.annotation_opts);
+
top.annotation_opts.min_pcnt = 5;
top.annotation_opts.context = 4;
out_delete_evlist:
evlist__delete(top.evlist);
perf_session__delete(top.session);
+ annotation_options__exit(&top.annotation_opts);
return status;
}
}
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;
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;
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)
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);
#include <linux/ctype.h>
-struct annotation_options annotation__default_options = {
- .use_offset = true,
- .jump_arrows = true,
- .annotate_src = true,
- .offset_level = ANNOTATION__OFFSET_JUMP_TARGETS,
- .percent_type = PERCENT_PERIOD_LOCAL,
-};
-
static regex_t file_lineno;
static struct ins_ops *ins__find(struct arch *arch, const char *name);
return 0;
}
+void annotation_options__init(struct annotation_options *opt)
+{
+ memset(opt, 0, sizeof(*opt));
+
+ /* Default values. */
+ opt->use_offset = true;
+ opt->jump_arrows = true;
+ opt->annotate_src = true;
+ opt->offset_level = ANNOTATION__OFFSET_JUMP_TARGETS;
+ opt->percent_type = PERCENT_PERIOD_LOCAL;
+}
+
+
+void annotation_options__exit(struct annotation_options *opt __maybe_unused)
+{
+}
+
void annotation_config__init(struct annotation_options *opt)
{
perf_config(annotation__config, opt);
#define ANNOTATION__MIN_OFFSET_LEVEL ANNOTATION__OFFSET_JUMP_TARGETS
-extern struct annotation_options annotation__default_options;
-
struct annotation;
struct sym_hist_entry {
}
#endif
+void annotation_options__init(struct annotation_options *opt);
+void annotation_options__exit(struct annotation_options *opt);
+
void annotation_config__init(struct annotation_options *opt);
int annotate_parse_percent_type(const struct option *opt, const char *_str,