diff options
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r-- | tools/perf/builtin-report.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index d9f2de3e81fe..c877982a64d3 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -311,7 +311,7 @@ static int process_sample_event(struct perf_tool *tool, | |||
311 | if (rep->cpu_list && !test_bit(sample->cpu, rep->cpu_bitmap)) | 311 | if (rep->cpu_list && !test_bit(sample->cpu, rep->cpu_bitmap)) |
312 | return 0; | 312 | return 0; |
313 | 313 | ||
314 | if (sort__branch_mode == 1) { | 314 | if (sort__mode == SORT_MODE__BRANCH) { |
315 | if (perf_report__add_branch_hist_entry(tool, &al, sample, | 315 | if (perf_report__add_branch_hist_entry(tool, &al, sample, |
316 | evsel, machine)) { | 316 | evsel, machine)) { |
317 | pr_debug("problem adding lbr entry, skipping event\n"); | 317 | pr_debug("problem adding lbr entry, skipping event\n"); |
@@ -387,7 +387,7 @@ static int perf_report__setup_sample_type(struct perf_report *rep) | |||
387 | } | 387 | } |
388 | } | 388 | } |
389 | 389 | ||
390 | if (sort__branch_mode == 1) { | 390 | if (sort__mode == SORT_MODE__BRANCH) { |
391 | if (!self->fd_pipe && | 391 | if (!self->fd_pipe && |
392 | !(sample_type & PERF_SAMPLE_BRANCH_STACK)) { | 392 | !(sample_type & PERF_SAMPLE_BRANCH_STACK)) { |
393 | ui__error("Selected -b but no branch data. " | 393 | ui__error("Selected -b but no branch data. " |
@@ -694,7 +694,9 @@ static int | |||
694 | parse_branch_mode(const struct option *opt __maybe_unused, | 694 | parse_branch_mode(const struct option *opt __maybe_unused, |
695 | const char *str __maybe_unused, int unset) | 695 | const char *str __maybe_unused, int unset) |
696 | { | 696 | { |
697 | sort__branch_mode = !unset; | 697 | int *branch_mode = opt->value; |
698 | |||
699 | *branch_mode = !unset; | ||
698 | return 0; | 700 | return 0; |
699 | } | 701 | } |
700 | 702 | ||
@@ -703,6 +705,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) | |||
703 | struct perf_session *session; | 705 | struct perf_session *session; |
704 | struct stat st; | 706 | struct stat st; |
705 | bool has_br_stack = false; | 707 | bool has_br_stack = false; |
708 | int branch_mode = -1; | ||
706 | int ret = -1; | 709 | int ret = -1; |
707 | char callchain_default_opt[] = "fractal,0.5,callee"; | 710 | char callchain_default_opt[] = "fractal,0.5,callee"; |
708 | const char * const report_usage[] = { | 711 | const char * const report_usage[] = { |
@@ -799,7 +802,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) | |||
799 | "Show a column with the sum of periods"), | 802 | "Show a column with the sum of periods"), |
800 | OPT_BOOLEAN(0, "group", &symbol_conf.event_group, | 803 | OPT_BOOLEAN(0, "group", &symbol_conf.event_group, |
801 | "Show event group information together"), | 804 | "Show event group information together"), |
802 | OPT_CALLBACK_NOOPT('b', "branch-stack", &sort__branch_mode, "", | 805 | OPT_CALLBACK_NOOPT('b', "branch-stack", &branch_mode, "", |
803 | "use branch records for histogram filling", parse_branch_mode), | 806 | "use branch records for histogram filling", parse_branch_mode), |
804 | OPT_STRING(0, "objdump", &objdump_path, "path", | 807 | OPT_STRING(0, "objdump", &objdump_path, "path", |
805 | "objdump binary to use for disassembly and annotations"), | 808 | "objdump binary to use for disassembly and annotations"), |
@@ -849,11 +852,11 @@ repeat: | |||
849 | has_br_stack = perf_header__has_feat(&session->header, | 852 | has_br_stack = perf_header__has_feat(&session->header, |
850 | HEADER_BRANCH_STACK); | 853 | HEADER_BRANCH_STACK); |
851 | 854 | ||
852 | if (sort__branch_mode == -1 && has_br_stack) | 855 | if (branch_mode == -1 && has_br_stack) |
853 | sort__branch_mode = 1; | 856 | sort__mode = SORT_MODE__BRANCH; |
854 | 857 | ||
855 | /* sort__branch_mode could be 0 if --no-branch-stack */ | 858 | /* sort__mode could be NORMAL if --no-branch-stack */ |
856 | if (sort__branch_mode == 1) { | 859 | if (sort__mode == SORT_MODE__BRANCH) { |
857 | /* | 860 | /* |
858 | * if no sort_order is provided, then specify | 861 | * if no sort_order is provided, then specify |
859 | * branch-mode specific order | 862 | * branch-mode specific order |
@@ -864,7 +867,7 @@ repeat: | |||
864 | 867 | ||
865 | } | 868 | } |
866 | if (report.mem_mode) { | 869 | if (report.mem_mode) { |
867 | if (sort__branch_mode == 1) { | 870 | if (sort__mode == SORT_MODE__BRANCH) { |
868 | fprintf(stderr, "branch and mem mode incompatible\n"); | 871 | fprintf(stderr, "branch and mem mode incompatible\n"); |
869 | goto error; | 872 | goto error; |
870 | } | 873 | } |
@@ -934,7 +937,7 @@ repeat: | |||
934 | 937 | ||
935 | sort_entry__setup_elide(&sort_comm, symbol_conf.comm_list, "comm", stdout); | 938 | sort_entry__setup_elide(&sort_comm, symbol_conf.comm_list, "comm", stdout); |
936 | 939 | ||
937 | if (sort__branch_mode == 1) { | 940 | if (sort__mode == SORT_MODE__BRANCH) { |
938 | sort_entry__setup_elide(&sort_dso_from, symbol_conf.dso_from_list, "dso_from", stdout); | 941 | sort_entry__setup_elide(&sort_dso_from, symbol_conf.dso_from_list, "dso_from", stdout); |
939 | sort_entry__setup_elide(&sort_dso_to, symbol_conf.dso_to_list, "dso_to", stdout); | 942 | sort_entry__setup_elide(&sort_dso_to, symbol_conf.dso_to_list, "dso_to", stdout); |
940 | sort_entry__setup_elide(&sort_sym_from, symbol_conf.sym_from_list, "sym_from", stdout); | 943 | sort_entry__setup_elide(&sort_sym_from, symbol_conf.sym_from_list, "sym_from", stdout); |