Skip to content

Commit 1eddd9e

Browse files
committed
perf annotate: Adopt anotation options from symbol_conf
Continuing to group annotation options in an annotation specific struct. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: https://lkml.kernel.org/n/tip-astei92tzxp4yccag5pxb2h7@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 380195e commit 1eddd9e

7 files changed

Lines changed: 15 additions & 12 deletions

File tree

‎tools/perf/builtin-annotate.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,9 @@ int cmd_annotate(int argc, const char **argv)
515515
OPT_CALLBACK(0, "symfs", NULL, "directory",
516516
"Look for files with symbols relative to this directory",
517517
symbol__config_symfs),
518-
OPT_BOOLEAN(0, "source", &symbol_conf.annotate_src,
518+
OPT_BOOLEAN(0, "source", &annotate.opts.annotate_src,
519519
"Interleave source code with assembly code (default)"),
520-
OPT_BOOLEAN(0, "asm-raw", &symbol_conf.annotate_asm_raw,
520+
OPT_BOOLEAN(0, "asm-raw", &annotate.opts.show_asm_raw,
521521
"Display raw encoding of assembly instructions (default)"),
522522
OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
523523
"Specify disassembler style (e.g. -M intel for intel syntax)"),

‎tools/perf/builtin-report.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ struct report {
7171
bool group_set;
7272
int max_stack;
7373
struct perf_read_values show_threads_values;
74+
struct annotation_options annotation_opts;
7475
const char *pretty_printing_style;
7576
const char *cpu_list;
7677
const char *symbol_filter_str;
@@ -988,6 +989,7 @@ int cmd_report(int argc, const char **argv)
988989
.max_stack = PERF_MAX_STACK_DEPTH,
989990
.pretty_printing_style = "normal",
990991
.socket_filter = -1,
992+
.annotation_opts = annotation__default_options,
991993
};
992994
const struct option options[] = {
993995
OPT_STRING('i', "input", &input_name, "file",
@@ -1077,9 +1079,9 @@ int cmd_report(int argc, const char **argv)
10771079
"list of cpus to profile"),
10781080
OPT_BOOLEAN('I', "show-info", &report.show_full_info,
10791081
"Display extended information about perf.data file"),
1080-
OPT_BOOLEAN(0, "source", &symbol_conf.annotate_src,
1082+
OPT_BOOLEAN(0, "source", &report.annotation_opts.annotate_src,
10811083
"Interleave source code with assembly code (default)"),
1082-
OPT_BOOLEAN(0, "asm-raw", &symbol_conf.annotate_asm_raw,
1084+
OPT_BOOLEAN(0, "asm-raw", &report.annotation_opts.show_asm_raw,
10831085
"Display raw encoding of assembly instructions (default)"),
10841086
OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
10851087
"Specify disassembler style (e.g. -M intel for intel syntax)"),

‎tools/perf/builtin-top.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,9 +1340,9 @@ int cmd_top(int argc, const char **argv)
13401340
"only consider symbols in these comms"),
13411341
OPT_STRING(0, "symbols", &symbol_conf.sym_list_str, "symbol[,symbol...]",
13421342
"only consider these symbols"),
1343-
OPT_BOOLEAN(0, "source", &symbol_conf.annotate_src,
1343+
OPT_BOOLEAN(0, "source", &top.annotation_opts.annotate_src,
13441344
"Interleave source code with assembly code (default)"),
1345-
OPT_BOOLEAN(0, "asm-raw", &symbol_conf.annotate_asm_raw,
1345+
OPT_BOOLEAN(0, "asm-raw", &top.annotation_opts.show_asm_raw,
13461346
"Display raw encoding of assembly instructions (default)"),
13471347
OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel,
13481348
"Enable kernel symbol demangling"),

‎tools/perf/util/annotate.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
struct annotation_options annotation__default_options = {
4848
.use_offset = true,
4949
.jump_arrows = true,
50+
.annotate_src = true,
5051
.offset_level = ANNOTATION__OFFSET_JUMP_TARGETS,
5152
};
5253

@@ -1609,6 +1610,7 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil
16091610

16101611
static int symbol__disassemble(struct symbol *sym, struct annotate_args *args)
16111612
{
1613+
struct annotation_options *opts = args->options;
16121614
struct map *map = args->ms.map;
16131615
struct dso *dso = map->dso;
16141616
char *command;
@@ -1661,8 +1663,8 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args)
16611663
disassembler_style ? disassembler_style : "",
16621664
map__rip_2objdump(map, sym->start),
16631665
map__rip_2objdump(map, sym->end),
1664-
symbol_conf.annotate_asm_raw ? "" : "--no-show-raw",
1665-
symbol_conf.annotate_src ? "-S" : "",
1666+
opts->show_asm_raw ? "" : "--no-show-raw",
1667+
opts->annotate_src ? "-S" : "",
16661668
symfs_filename, symfs_filename);
16671669

16681670
if (err < 0) {

‎tools/perf/util/annotate.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ struct annotation_options {
7373
show_nr_jumps,
7474
show_nr_samples,
7575
show_total_period,
76-
show_minmax_cycle;
76+
show_minmax_cycle,
77+
show_asm_raw,
78+
annotate_src;
7779
u8 offset_level;
7880
int min_pcnt;
7981
int max_lines;

‎tools/perf/util/symbol.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ char **vmlinux_path;
4040
struct symbol_conf symbol_conf = {
4141
.use_modules = true,
4242
.try_vmlinux_path = true,
43-
.annotate_src = true,
4443
.demangle = true,
4544
.demangle_kernel = false,
4645
.cumulate_callchain = true,

‎tools/perf/util/symbol.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ struct symbol_conf {
108108
show_cpu_utilization,
109109
initialized,
110110
kptr_restrict,
111-
annotate_asm_raw,
112-
annotate_src,
113111
event_group,
114112
demangle,
115113
demangle_kernel,

0 commit comments

Comments
 (0)