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 annotate: Ensure init/exit for global options

Now it only cares about the global options so it can just handle it
without the argument.

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

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
7f929aea 22197fb2

+27 -24
+4 -4
tools/perf/builtin-annotate.c
··· 615 615 set_option_flag(options, 0, "show-total-period", PARSE_OPT_EXCLUSIVE); 616 616 set_option_flag(options, 0, "show-nr-samples", PARSE_OPT_EXCLUSIVE); 617 617 618 - annotation_options__init(&annotate_opts); 618 + annotation_options__init(); 619 619 620 620 ret = hists__init(); 621 621 if (ret < 0) 622 622 return ret; 623 623 624 - annotation_config__init(&annotate_opts); 624 + annotation_config__init(); 625 625 626 626 argc = parse_options(argc, argv, options, annotate_usage, 0); 627 627 if (argc) { ··· 651 651 return -ENOMEM; 652 652 } 653 653 654 - if (annotate_check_args(&annotate_opts) < 0) 654 + if (annotate_check_args() < 0) 655 655 return -EINVAL; 656 656 657 657 #ifdef HAVE_GTK2_SUPPORT ··· 732 732 #ifndef NDEBUG 733 733 perf_session__delete(annotate.session); 734 734 #endif 735 - annotation_options__exit(&annotate_opts); 735 + annotation_options__exit(); 736 736 737 737 return ret; 738 738 }
+4 -4
tools/perf/builtin-report.c
··· 1430 1430 */ 1431 1431 symbol_conf.keep_exited_threads = true; 1432 1432 1433 - annotation_options__init(&annotate_opts); 1433 + annotation_options__init(); 1434 1434 1435 1435 ret = perf_config(report__config, &report); 1436 1436 if (ret) ··· 1464 1464 return -ENOMEM; 1465 1465 } 1466 1466 1467 - if (annotate_check_args(&annotate_opts) < 0) { 1467 + if (annotate_check_args() < 0) { 1468 1468 ret = -EINVAL; 1469 1469 goto exit; 1470 1470 } ··· 1696 1696 */ 1697 1697 symbol_conf.priv_size += sizeof(u32); 1698 1698 } 1699 - annotation_config__init(&annotate_opts); 1699 + annotation_config__init(); 1700 1700 } 1701 1701 1702 1702 if (symbol__init(&session->header.env) < 0) ··· 1750 1750 zstd_fini(&(session->zstd_data)); 1751 1751 perf_session__delete(session); 1752 1752 exit: 1753 - annotation_options__exit(&annotate_opts); 1753 + annotation_options__exit(); 1754 1754 free(sort_order_help); 1755 1755 free(field_order_help); 1756 1756 return ret;
+4 -4
tools/perf/builtin-top.c
··· 1608 1608 if (status < 0) 1609 1609 return status; 1610 1610 1611 - annotation_options__init(&annotate_opts); 1611 + annotation_options__init(); 1612 1612 1613 1613 annotate_opts.min_pcnt = 5; 1614 1614 annotate_opts.context = 4; ··· 1660 1660 if (status) 1661 1661 goto out_delete_evlist; 1662 1662 1663 - if (annotate_check_args(&annotate_opts) < 0) 1663 + if (annotate_check_args() < 0) 1664 1664 goto out_delete_evlist; 1665 1665 1666 1666 if (!top.evlist->core.nr_entries) { ··· 1786 1786 if (status < 0) 1787 1787 goto out_delete_evlist; 1788 1788 1789 - annotation_config__init(&annotate_opts); 1789 + annotation_config__init(); 1790 1790 1791 1791 symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL); 1792 1792 status = symbol__init(NULL); ··· 1839 1839 out_delete_evlist: 1840 1840 evlist__delete(top.evlist); 1841 1841 perf_session__delete(top.session); 1842 - annotation_options__exit(&annotate_opts); 1842 + annotation_options__exit(); 1843 1843 1844 1844 return status; 1845 1845 }
+11 -8
tools/perf/util/annotate.c
··· 3416 3416 return 0; 3417 3417 } 3418 3418 3419 - void annotation_options__init(struct annotation_options *opt) 3419 + void annotation_options__init(void) 3420 3420 { 3421 + struct annotation_options *opt = &annotate_opts; 3422 + 3421 3423 memset(opt, 0, sizeof(*opt)); 3422 3424 3423 3425 /* Default values. */ ··· 3430 3428 opt->percent_type = PERCENT_PERIOD_LOCAL; 3431 3429 } 3432 3430 3433 - 3434 - void annotation_options__exit(struct annotation_options *opt) 3431 + void annotation_options__exit(void) 3435 3432 { 3436 - zfree(&opt->disassembler_style); 3437 - zfree(&opt->objdump_path); 3433 + zfree(&annotate_opts.disassembler_style); 3434 + zfree(&annotate_opts.objdump_path); 3438 3435 } 3439 3436 3440 - void annotation_config__init(struct annotation_options *opt) 3437 + void annotation_config__init(void) 3441 3438 { 3442 - perf_config(annotation__config, opt); 3439 + perf_config(annotation__config, &annotate_opts); 3443 3440 } 3444 3441 3445 3442 static unsigned int parse_percent_type(char *str1, char *str2) ··· 3492 3491 return err; 3493 3492 } 3494 3493 3495 - int annotate_check_args(struct annotation_options *args) 3494 + int annotate_check_args(void) 3496 3495 { 3496 + struct annotation_options *args = &annotate_opts; 3497 + 3497 3498 if (args->prefix_strip && !args->prefix) { 3498 3499 pr_err("--prefix-strip requires --prefix\n"); 3499 3500 return -1;
+4 -4
tools/perf/util/annotate.h
··· 428 428 } 429 429 #endif 430 430 431 - void annotation_options__init(struct annotation_options *opt); 432 - void annotation_options__exit(struct annotation_options *opt); 431 + void annotation_options__init(void); 432 + void annotation_options__exit(void); 433 433 434 - void annotation_config__init(struct annotation_options *opt); 434 + void annotation_config__init(void); 435 435 436 436 int annotate_parse_percent_type(const struct option *opt, const char *_str, 437 437 int unset); 438 438 439 - int annotate_check_args(struct annotation_options *args); 439 + int annotate_check_args(void); 440 440 441 441 #endif /* __PERF_ANNOTATE_H */