diff options
Diffstat (limited to 'tools/perf')
| -rw-r--r-- | tools/perf/Documentation/perf-report.txt | 4 | ||||
| -rw-r--r-- | tools/perf/builtin-report.c | 26 |
2 files changed, 29 insertions, 1 deletions
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt index 1e02c4e1a81f..a7d11ef2fe25 100644 --- a/tools/perf/Documentation/perf-report.txt +++ b/tools/perf/Documentation/perf-report.txt | |||
| @@ -457,6 +457,10 @@ include::itrace.txt[] | |||
| 457 | will be printed. Each entry is function name or file/line. Enabled by | 457 | will be printed. Each entry is function name or file/line. Enabled by |
| 458 | default, disable with --no-inline. | 458 | default, disable with --no-inline. |
| 459 | 459 | ||
| 460 | --stats:: | ||
| 461 | Display overall events statistics without any further processing. | ||
| 462 | (like the one at the end of the perf report -D command) | ||
| 463 | |||
| 460 | include::callchain-overhead-calculation.txt[] | 464 | include::callchain-overhead-calculation.txt[] |
| 461 | 465 | ||
| 462 | SEE ALSO | 466 | SEE ALSO |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 770bf8a614f2..8e67a8c25ab1 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
| @@ -62,6 +62,7 @@ struct report { | |||
| 62 | bool show_threads; | 62 | bool show_threads; |
| 63 | bool inverted_callchain; | 63 | bool inverted_callchain; |
| 64 | bool mem_mode; | 64 | bool mem_mode; |
| 65 | bool stats_mode; | ||
| 65 | bool header; | 66 | bool header; |
| 66 | bool header_only; | 67 | bool header_only; |
| 67 | bool nonany_branch_mode; | 68 | bool nonany_branch_mode; |
| @@ -588,6 +589,20 @@ static void report__output_resort(struct report *rep) | |||
| 588 | ui_progress__finish(); | 589 | ui_progress__finish(); |
| 589 | } | 590 | } |
| 590 | 591 | ||
| 592 | static void stats_setup(struct report *rep) | ||
| 593 | { | ||
| 594 | memset(&rep->tool, 0, sizeof(rep->tool)); | ||
| 595 | rep->tool.no_warn = true; | ||
| 596 | } | ||
| 597 | |||
| 598 | static int stats_print(struct report *rep) | ||
| 599 | { | ||
| 600 | struct perf_session *session = rep->session; | ||
| 601 | |||
| 602 | perf_session__fprintf_nr_events(session, stdout); | ||
| 603 | return 0; | ||
| 604 | } | ||
| 605 | |||
| 591 | static int __cmd_report(struct report *rep) | 606 | static int __cmd_report(struct report *rep) |
| 592 | { | 607 | { |
| 593 | int ret; | 608 | int ret; |
| @@ -619,12 +634,18 @@ static int __cmd_report(struct report *rep) | |||
| 619 | return ret; | 634 | return ret; |
| 620 | } | 635 | } |
| 621 | 636 | ||
| 637 | if (rep->stats_mode) | ||
| 638 | stats_setup(rep); | ||
| 639 | |||
| 622 | ret = perf_session__process_events(session); | 640 | ret = perf_session__process_events(session); |
| 623 | if (ret) { | 641 | if (ret) { |
| 624 | ui__error("failed to process sample\n"); | 642 | ui__error("failed to process sample\n"); |
| 625 | return ret; | 643 | return ret; |
| 626 | } | 644 | } |
| 627 | 645 | ||
| 646 | if (rep->stats_mode) | ||
| 647 | return stats_print(rep); | ||
| 648 | |||
| 628 | report__warn_kptr_restrict(rep); | 649 | report__warn_kptr_restrict(rep); |
| 629 | 650 | ||
| 630 | evlist__for_each_entry(session->evlist, pos) | 651 | evlist__for_each_entry(session->evlist, pos) |
| @@ -781,6 +802,7 @@ int cmd_report(int argc, const char **argv) | |||
| 781 | OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"), | 802 | OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"), |
| 782 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, | 803 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, |
| 783 | "dump raw trace in ASCII"), | 804 | "dump raw trace in ASCII"), |
| 805 | OPT_BOOLEAN(0, "stats", &report.stats_mode, "Display event stats"), | ||
| 784 | OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name, | 806 | OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name, |
| 785 | "file", "vmlinux pathname"), | 807 | "file", "vmlinux pathname"), |
| 786 | OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name, | 808 | OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name, |
| @@ -1042,6 +1064,8 @@ repeat: | |||
| 1042 | report.tool.show_feat_hdr = SHOW_FEAT_HEADER; | 1064 | report.tool.show_feat_hdr = SHOW_FEAT_HEADER; |
| 1043 | if (report.show_full_info) | 1065 | if (report.show_full_info) |
| 1044 | report.tool.show_feat_hdr = SHOW_FEAT_HEADER_FULL_INFO; | 1066 | report.tool.show_feat_hdr = SHOW_FEAT_HEADER_FULL_INFO; |
| 1067 | if (report.stats_mode) | ||
| 1068 | use_browser = 0; | ||
| 1045 | 1069 | ||
| 1046 | if (strcmp(input_name, "-") != 0) | 1070 | if (strcmp(input_name, "-") != 0) |
| 1047 | setup_browser(true); | 1071 | setup_browser(true); |
| @@ -1064,7 +1088,7 @@ repeat: | |||
| 1064 | ret = 0; | 1088 | ret = 0; |
| 1065 | goto error; | 1089 | goto error; |
| 1066 | } | 1090 | } |
| 1067 | } else if (use_browser == 0 && !quiet) { | 1091 | } else if (use_browser == 0 && !quiet && !report.stats_mode) { |
| 1068 | fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n", | 1092 | fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n", |
| 1069 | stdout); | 1093 | stdout); |
| 1070 | } | 1094 | } |
