Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf top: Convert to the global annotation_options

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-4-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
c9a21a87 14953f03

+22 -23
+22 -22
tools/perf/builtin-top.c
··· 147 147 return err; 148 148 } 149 149 150 - err = symbol__annotate(&he->ms, evsel, &top->annotation_opts, NULL); 150 + err = symbol__annotate(&he->ms, evsel, &annotate_opts, NULL); 151 151 if (err == 0) { 152 152 top->sym_filter_entry = he; 153 153 } else { ··· 261 261 goto out_unlock; 262 262 263 263 printf("Showing %s for %s\n", evsel__name(top->sym_evsel), symbol->name); 264 - printf(" Events Pcnt (>=%d%%)\n", top->annotation_opts.min_pcnt); 264 + printf(" Events Pcnt (>=%d%%)\n", annotate_opts.min_pcnt); 265 265 266 - more = symbol__annotate_printf(&he->ms, top->sym_evsel, &top->annotation_opts); 266 + more = symbol__annotate_printf(&he->ms, top->sym_evsel, &annotate_opts); 267 267 268 268 if (top->evlist->enabled) { 269 269 if (top->zero) ··· 450 450 451 451 fprintf(stdout, "\t[f] profile display filter (count). \t(%d)\n", top->count_filter); 452 452 453 - fprintf(stdout, "\t[F] annotate display filter (percent). \t(%d%%)\n", top->annotation_opts.min_pcnt); 453 + fprintf(stdout, "\t[F] annotate display filter (percent). \t(%d%%)\n", annotate_opts.min_pcnt); 454 454 fprintf(stdout, "\t[s] annotate symbol. \t(%s)\n", name?: "NULL"); 455 455 fprintf(stdout, "\t[S] stop annotation.\n"); 456 456 ··· 553 553 prompt_integer(&top->count_filter, "Enter display event count filter"); 554 554 break; 555 555 case 'F': 556 - prompt_percent(&top->annotation_opts.min_pcnt, 556 + prompt_percent(&annotate_opts.min_pcnt, 557 557 "Enter details display event filter (percent)"); 558 558 break; 559 559 case 'K': ··· 647 647 648 648 ret = evlist__tui_browse_hists(top->evlist, help, &hbt, top->min_percent, 649 649 &top->session->header.env, !top->record_opts.overwrite, 650 - &top->annotation_opts); 650 + &annotate_opts); 651 651 if (ret == K_RELOAD) { 652 652 top->zero = true; 653 653 goto repeat; ··· 1241 1241 pthread_t thread, thread_process; 1242 1242 int ret; 1243 1243 1244 - if (!top->annotation_opts.objdump_path) { 1244 + if (!annotate_opts.objdump_path) { 1245 1245 ret = perf_env__lookup_objdump(&top->session->header.env, 1246 - &top->annotation_opts.objdump_path); 1246 + &annotate_opts.objdump_path); 1247 1247 if (ret) 1248 1248 return ret; 1249 1249 } ··· 1536 1536 "only consider symbols in these comms"), 1537 1537 OPT_STRING(0, "symbols", &symbol_conf.sym_list_str, "symbol[,symbol...]", 1538 1538 "only consider these symbols"), 1539 - OPT_BOOLEAN(0, "source", &top.annotation_opts.annotate_src, 1539 + OPT_BOOLEAN(0, "source", &annotate_opts.annotate_src, 1540 1540 "Interleave source code with assembly code (default)"), 1541 - OPT_BOOLEAN(0, "asm-raw", &top.annotation_opts.show_asm_raw, 1541 + OPT_BOOLEAN(0, "asm-raw", &annotate_opts.show_asm_raw, 1542 1542 "Display raw encoding of assembly instructions (default)"), 1543 1543 OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel, 1544 1544 "Enable kernel symbol demangling"), ··· 1549 1549 "addr2line binary to use for line numbers"), 1550 1550 OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style", 1551 1551 "Specify disassembler style (e.g. -M intel for intel syntax)"), 1552 - OPT_STRING(0, "prefix", &top.annotation_opts.prefix, "prefix", 1552 + OPT_STRING(0, "prefix", &annotate_opts.prefix, "prefix", 1553 1553 "Add prefix to source file path names in programs (with --prefix-strip)"), 1554 - OPT_STRING(0, "prefix-strip", &top.annotation_opts.prefix_strip, "N", 1554 + OPT_STRING(0, "prefix-strip", &annotate_opts.prefix_strip, "N", 1555 1555 "Strip first N entries of source file path name in programs (with --prefix)"), 1556 1556 OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"), 1557 1557 OPT_CALLBACK(0, "percent-limit", &top, "percent", ··· 1609 1609 if (status < 0) 1610 1610 return status; 1611 1611 1612 - annotation_options__init(&top.annotation_opts); 1612 + annotation_options__init(&annotate_opts); 1613 1613 1614 - top.annotation_opts.min_pcnt = 5; 1615 - top.annotation_opts.context = 4; 1614 + annotate_opts.min_pcnt = 5; 1615 + annotate_opts.context = 4; 1616 1616 1617 1617 top.evlist = evlist__new(); 1618 1618 if (top.evlist == NULL) ··· 1642 1642 usage_with_options(top_usage, options); 1643 1643 1644 1644 if (disassembler_style) { 1645 - top.annotation_opts.disassembler_style = strdup(disassembler_style); 1646 - if (!top.annotation_opts.disassembler_style) 1645 + annotate_opts.disassembler_style = strdup(disassembler_style); 1646 + if (!annotate_opts.disassembler_style) 1647 1647 return -ENOMEM; 1648 1648 } 1649 1649 if (objdump_path) { 1650 - top.annotation_opts.objdump_path = strdup(objdump_path); 1651 - if (!top.annotation_opts.objdump_path) 1650 + annotate_opts.objdump_path = strdup(objdump_path); 1651 + if (!annotate_opts.objdump_path) 1652 1652 return -ENOMEM; 1653 1653 } 1654 1654 if (addr2line_path) { ··· 1661 1661 if (status) 1662 1662 goto out_delete_evlist; 1663 1663 1664 - if (annotate_check_args(&top.annotation_opts) < 0) 1664 + if (annotate_check_args(&annotate_opts) < 0) 1665 1665 goto out_delete_evlist; 1666 1666 1667 1667 if (!top.evlist->core.nr_entries) { ··· 1787 1787 if (status < 0) 1788 1788 goto out_delete_evlist; 1789 1789 1790 - annotation_config__init(&top.annotation_opts); 1790 + annotation_config__init(&annotate_opts); 1791 1791 1792 1792 symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL); 1793 1793 status = symbol__init(NULL); ··· 1840 1840 out_delete_evlist: 1841 1841 evlist__delete(top.evlist); 1842 1842 perf_session__delete(top.session); 1843 - annotation_options__exit(&top.annotation_opts); 1843 + annotation_options__exit(&annotate_opts); 1844 1844 1845 1845 return status; 1846 1846 }
-1
tools/perf/util/top.h
··· 21 21 struct perf_tool tool; 22 22 struct evlist *evlist, *sb_evlist; 23 23 struct record_opts record_opts; 24 - struct annotation_options annotation_opts; 25 24 struct evswitch evswitch; 26 25 /* 27 26 * Symbols will be added here in perf_event__process_sample and will