diff options
Diffstat (limited to 'tools/perf/builtin-report.c')
| -rw-r--r-- | tools/perf/builtin-report.c | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 7c88a243b5db..1da243dfbc3e 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
| @@ -69,8 +69,8 @@ static int perf_report__add_branch_hist_entry(struct perf_tool *tool, | |||
| 69 | 69 | ||
| 70 | if ((sort__has_parent || symbol_conf.use_callchain) | 70 | if ((sort__has_parent || symbol_conf.use_callchain) |
| 71 | && sample->callchain) { | 71 | && sample->callchain) { |
| 72 | err = machine__resolve_callchain(machine, al->thread, | 72 | err = machine__resolve_callchain(machine, evsel, al->thread, |
| 73 | sample->callchain, &parent); | 73 | sample, &parent); |
| 74 | if (err) | 74 | if (err) |
| 75 | return err; | 75 | return err; |
| 76 | } | 76 | } |
| @@ -93,7 +93,7 @@ static int perf_report__add_branch_hist_entry(struct perf_tool *tool, | |||
| 93 | struct annotation *notes; | 93 | struct annotation *notes; |
| 94 | err = -ENOMEM; | 94 | err = -ENOMEM; |
| 95 | bx = he->branch_info; | 95 | bx = he->branch_info; |
| 96 | if (bx->from.sym && use_browser > 0) { | 96 | if (bx->from.sym && use_browser == 1 && sort__has_sym) { |
| 97 | notes = symbol__annotation(bx->from.sym); | 97 | notes = symbol__annotation(bx->from.sym); |
| 98 | if (!notes->src | 98 | if (!notes->src |
| 99 | && symbol__alloc_hist(bx->from.sym) < 0) | 99 | && symbol__alloc_hist(bx->from.sym) < 0) |
| @@ -107,7 +107,7 @@ static int perf_report__add_branch_hist_entry(struct perf_tool *tool, | |||
| 107 | goto out; | 107 | goto out; |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | if (bx->to.sym && use_browser > 0) { | 110 | if (bx->to.sym && use_browser == 1 && sort__has_sym) { |
| 111 | notes = symbol__annotation(bx->to.sym); | 111 | notes = symbol__annotation(bx->to.sym); |
| 112 | if (!notes->src | 112 | if (!notes->src |
| 113 | && symbol__alloc_hist(bx->to.sym) < 0) | 113 | && symbol__alloc_hist(bx->to.sym) < 0) |
| @@ -140,8 +140,8 @@ static int perf_evsel__add_hist_entry(struct perf_evsel *evsel, | |||
| 140 | struct hist_entry *he; | 140 | struct hist_entry *he; |
| 141 | 141 | ||
| 142 | if ((sort__has_parent || symbol_conf.use_callchain) && sample->callchain) { | 142 | if ((sort__has_parent || symbol_conf.use_callchain) && sample->callchain) { |
| 143 | err = machine__resolve_callchain(machine, al->thread, | 143 | err = machine__resolve_callchain(machine, evsel, al->thread, |
| 144 | sample->callchain, &parent); | 144 | sample, &parent); |
| 145 | if (err) | 145 | if (err) |
| 146 | return err; | 146 | return err; |
| 147 | } | 147 | } |
| @@ -162,7 +162,7 @@ static int perf_evsel__add_hist_entry(struct perf_evsel *evsel, | |||
| 162 | * so we don't allocated the extra space needed because the stdio | 162 | * so we don't allocated the extra space needed because the stdio |
| 163 | * code will not use it. | 163 | * code will not use it. |
| 164 | */ | 164 | */ |
| 165 | if (he->ms.sym != NULL && use_browser > 0) { | 165 | if (he->ms.sym != NULL && use_browser == 1 && sort__has_sym) { |
| 166 | struct annotation *notes = symbol__annotation(he->ms.sym); | 166 | struct annotation *notes = symbol__annotation(he->ms.sym); |
| 167 | 167 | ||
| 168 | assert(evsel != NULL); | 168 | assert(evsel != NULL); |
| @@ -223,9 +223,9 @@ static int process_sample_event(struct perf_tool *tool, | |||
| 223 | 223 | ||
| 224 | static int process_read_event(struct perf_tool *tool, | 224 | static int process_read_event(struct perf_tool *tool, |
| 225 | union perf_event *event, | 225 | union perf_event *event, |
| 226 | struct perf_sample *sample __used, | 226 | struct perf_sample *sample __maybe_unused, |
| 227 | struct perf_evsel *evsel, | 227 | struct perf_evsel *evsel, |
| 228 | struct machine *machine __used) | 228 | struct machine *machine __maybe_unused) |
| 229 | { | 229 | { |
| 230 | struct perf_report *rep = container_of(tool, struct perf_report, tool); | 230 | struct perf_report *rep = container_of(tool, struct perf_report, tool); |
| 231 | 231 | ||
| @@ -287,7 +287,7 @@ static int perf_report__setup_sample_type(struct perf_report *rep) | |||
| 287 | 287 | ||
| 288 | extern volatile int session_done; | 288 | extern volatile int session_done; |
| 289 | 289 | ||
| 290 | static void sig_handler(int sig __used) | 290 | static void sig_handler(int sig __maybe_unused) |
| 291 | { | 291 | { |
| 292 | session_done = 1; | 292 | session_done = 1; |
| 293 | } | 293 | } |
| @@ -397,17 +397,17 @@ static int __cmd_report(struct perf_report *rep) | |||
| 397 | desc); | 397 | desc); |
| 398 | } | 398 | } |
| 399 | 399 | ||
| 400 | if (dump_trace) { | ||
| 401 | perf_session__fprintf_nr_events(session, stdout); | ||
| 402 | goto out_delete; | ||
| 403 | } | ||
| 404 | |||
| 405 | if (verbose > 3) | 400 | if (verbose > 3) |
| 406 | perf_session__fprintf(session, stdout); | 401 | perf_session__fprintf(session, stdout); |
| 407 | 402 | ||
| 408 | if (verbose > 2) | 403 | if (verbose > 2) |
| 409 | perf_session__fprintf_dsos(session, stdout); | 404 | perf_session__fprintf_dsos(session, stdout); |
| 410 | 405 | ||
| 406 | if (dump_trace) { | ||
| 407 | perf_session__fprintf_nr_events(session, stdout); | ||
| 408 | goto out_delete; | ||
| 409 | } | ||
| 410 | |||
| 411 | nr_samples = 0; | 411 | nr_samples = 0; |
| 412 | list_for_each_entry(pos, &session->evlist->entries, node) { | 412 | list_for_each_entry(pos, &session->evlist->entries, node) { |
| 413 | struct hists *hists = &pos->hists; | 413 | struct hists *hists = &pos->hists; |
| @@ -533,13 +533,14 @@ setup: | |||
| 533 | } | 533 | } |
| 534 | 534 | ||
| 535 | static int | 535 | static int |
| 536 | parse_branch_mode(const struct option *opt __used, const char *str __used, int unset) | 536 | parse_branch_mode(const struct option *opt __maybe_unused, |
| 537 | const char *str __maybe_unused, int unset) | ||
| 537 | { | 538 | { |
| 538 | sort__branch_mode = !unset; | 539 | sort__branch_mode = !unset; |
| 539 | return 0; | 540 | return 0; |
| 540 | } | 541 | } |
| 541 | 542 | ||
| 542 | int cmd_report(int argc, const char **argv, const char *prefix __used) | 543 | int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) |
| 543 | { | 544 | { |
| 544 | struct perf_session *session; | 545 | struct perf_session *session; |
| 545 | struct stat st; | 546 | struct stat st; |
| @@ -638,6 +639,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __used) | |||
| 638 | "Show a column with the sum of periods"), | 639 | "Show a column with the sum of periods"), |
| 639 | OPT_CALLBACK_NOOPT('b', "branch-stack", &sort__branch_mode, "", | 640 | OPT_CALLBACK_NOOPT('b', "branch-stack", &sort__branch_mode, "", |
| 640 | "use branch records for histogram filling", parse_branch_mode), | 641 | "use branch records for histogram filling", parse_branch_mode), |
| 642 | OPT_STRING(0, "objdump", &objdump_path, "path", | ||
| 643 | "objdump binary to use for disassembly and annotations"), | ||
| 641 | OPT_END() | 644 | OPT_END() |
| 642 | }; | 645 | }; |
| 643 | 646 | ||
| @@ -686,15 +689,19 @@ int cmd_report(int argc, const char **argv, const char *prefix __used) | |||
| 686 | 689 | ||
| 687 | if (strcmp(report.input_name, "-") != 0) | 690 | if (strcmp(report.input_name, "-") != 0) |
| 688 | setup_browser(true); | 691 | setup_browser(true); |
| 689 | else | 692 | else { |
| 690 | use_browser = 0; | 693 | use_browser = 0; |
| 694 | perf_hpp__init(false, false); | ||
| 695 | } | ||
| 696 | |||
| 697 | setup_sorting(report_usage, options); | ||
| 691 | 698 | ||
| 692 | /* | 699 | /* |
| 693 | * Only in the newt browser we are doing integrated annotation, | 700 | * Only in the newt browser we are doing integrated annotation, |
| 694 | * so don't allocate extra space that won't be used in the stdio | 701 | * so don't allocate extra space that won't be used in the stdio |
| 695 | * implementation. | 702 | * implementation. |
| 696 | */ | 703 | */ |
| 697 | if (use_browser > 0) { | 704 | if (use_browser == 1 && sort__has_sym) { |
| 698 | symbol_conf.priv_size = sizeof(struct annotation); | 705 | symbol_conf.priv_size = sizeof(struct annotation); |
| 699 | report.annotate_init = symbol__annotate_init; | 706 | report.annotate_init = symbol__annotate_init; |
| 700 | /* | 707 | /* |
| @@ -717,8 +724,6 @@ int cmd_report(int argc, const char **argv, const char *prefix __used) | |||
| 717 | if (symbol__init() < 0) | 724 | if (symbol__init() < 0) |
| 718 | goto error; | 725 | goto error; |
| 719 | 726 | ||
| 720 | setup_sorting(report_usage, options); | ||
| 721 | |||
| 722 | if (parent_pattern != default_parent_pattern) { | 727 | if (parent_pattern != default_parent_pattern) { |
| 723 | if (sort_dimension__add("parent") < 0) | 728 | if (sort_dimension__add("parent") < 0) |
| 724 | goto error; | 729 | goto error; |
