perf report: Convert to the global annotation_options

[ Upstream commit 14953f038d6b30e3dc9d1aa4d4584ac505e5a8ec ]

Use the global option and drop the local copy.

Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20231128175441.721579-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Stable-dep-of: aaf494cf483a ("perf annotate: Fix annotation_calc_lines() to pass correct address to get_srcline()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Namhyung Kim 2023-11-28 09:54:35 -08:00 committed by Greg Kroah-Hartman
parent dfd02119ae
commit e0af85d60b

View File

@ -98,7 +98,6 @@ struct report {
bool skip_empty;
int max_stack;
struct perf_read_values show_threads_values;
struct annotation_options annotation_opts;
const char *pretty_printing_style;
const char *cpu_list;
const char *symbol_filter_str;
@ -542,7 +541,7 @@ static int evlist__tui_block_hists_browse(struct evlist *evlist, struct report *
ret = report__browse_block_hists(&rep->block_reports[i++].hist,
rep->min_percent, pos,
&rep->session->header.env,
&rep->annotation_opts);
&annotate_opts);
if (ret != 0)
return ret;
}
@ -670,7 +669,7 @@ static int report__browse_hists(struct report *rep)
}
ret = evlist__tui_browse_hists(evlist, help, NULL, rep->min_percent,
&session->header.env, true, &rep->annotation_opts);
&session->header.env, true, &annotate_opts);
/*
* Usually "ret" is the last pressed key, and we only
* care if the key notifies us to switch data file.
@ -730,7 +729,7 @@ static int hists__resort_cb(struct hist_entry *he, void *arg)
if (rep->symbol_ipc && sym && !sym->annotate2) {
struct evsel *evsel = hists_to_evsel(he->hists);
symbol__annotate2(&he->ms, evsel, &rep->annotation_opts, NULL);
symbol__annotate2(&he->ms, evsel, &annotate_opts, NULL);
}
return 0;
@ -1326,15 +1325,15 @@ int cmd_report(int argc, const char **argv)
"list of cpus to profile"),
OPT_BOOLEAN('I', "show-info", &report.show_full_info,
"Display extended information about perf.data file"),
OPT_BOOLEAN(0, "source", &report.annotation_opts.annotate_src,
OPT_BOOLEAN(0, "source", &annotate_opts.annotate_src,
"Interleave source code with assembly code (default)"),
OPT_BOOLEAN(0, "asm-raw", &report.annotation_opts.show_asm_raw,
OPT_BOOLEAN(0, "asm-raw", &annotate_opts.show_asm_raw,
"Display raw encoding of assembly instructions (default)"),
OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
"Specify disassembler style (e.g. -M intel for intel syntax)"),
OPT_STRING(0, "prefix", &report.annotation_opts.prefix, "prefix",
OPT_STRING(0, "prefix", &annotate_opts.prefix, "prefix",
"Add prefix to source file path names in programs (with --prefix-strip)"),
OPT_STRING(0, "prefix-strip", &report.annotation_opts.prefix_strip, "N",
OPT_STRING(0, "prefix-strip", &annotate_opts.prefix_strip, "N",
"Strip first N entries of source file path name in programs (with --prefix)"),
OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period,
"Show a column with the sum of periods"),
@ -1386,7 +1385,7 @@ int cmd_report(int argc, const char **argv)
"Time span of interest (start,stop)"),
OPT_BOOLEAN(0, "inline", &symbol_conf.inline_name,
"Show inline function"),
OPT_CALLBACK(0, "percent-type", &report.annotation_opts, "local-period",
OPT_CALLBACK(0, "percent-type", &annotate_opts, "local-period",
"Set percent type local/global-period/hits",
annotate_parse_percent_type),
OPT_BOOLEAN(0, "ns", &symbol_conf.nanosecs, "Show times in nanosecs"),
@ -1418,7 +1417,7 @@ int cmd_report(int argc, const char **argv)
*/
symbol_conf.keep_exited_threads = true;
annotation_options__init(&report.annotation_opts);
annotation_options__init(&annotate_opts);
ret = perf_config(report__config, &report);
if (ret)
@ -1437,13 +1436,13 @@ int cmd_report(int argc, const char **argv)
}
if (disassembler_style) {
report.annotation_opts.disassembler_style = strdup(disassembler_style);
if (!report.annotation_opts.disassembler_style)
annotate_opts.disassembler_style = strdup(disassembler_style);
if (!annotate_opts.disassembler_style)
return -ENOMEM;
}
if (objdump_path) {
report.annotation_opts.objdump_path = strdup(objdump_path);
if (!report.annotation_opts.objdump_path)
annotate_opts.objdump_path = strdup(objdump_path);
if (!annotate_opts.objdump_path)
return -ENOMEM;
}
if (addr2line_path) {
@ -1452,7 +1451,7 @@ int cmd_report(int argc, const char **argv)
return -ENOMEM;
}
if (annotate_check_args(&report.annotation_opts) < 0) {
if (annotate_check_args(&annotate_opts) < 0) {
ret = -EINVAL;
goto exit;
}
@ -1684,7 +1683,7 @@ repeat:
*/
symbol_conf.priv_size += sizeof(u32);
}
annotation_config__init(&report.annotation_opts);
annotation_config__init(&annotate_opts);
}
if (symbol__init(&session->header.env) < 0)
@ -1738,7 +1737,7 @@ error:
zstd_fini(&(session->zstd_data));
perf_session__delete(session);
exit:
annotation_options__exit(&report.annotation_opts);
annotation_options__exit(&annotate_opts);
free(sort_order_help);
free(field_order_help);
return ret;