diff options
-rw-r--r-- | tools/perf/Documentation/perf-report.txt | 17 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 10 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt index 987261d158d4..7315f155803f 100644 --- a/tools/perf/Documentation/perf-report.txt +++ b/tools/perf/Documentation/perf-report.txt | |||
@@ -438,6 +438,23 @@ OPTIONS | |||
438 | 438 | ||
439 | perf report --time 0%-10%,30%-40% | 439 | perf report --time 0%-10%,30%-40% |
440 | 440 | ||
441 | --switch-on EVENT_NAME:: | ||
442 | Only consider events after this event is found. | ||
443 | |||
444 | This may be interesting to measure a workload only after some initialization | ||
445 | phase is over, i.e. insert a perf probe at that point and then using this | ||
446 | option with that probe. | ||
447 | |||
448 | --switch-off EVENT_NAME:: | ||
449 | Stop considering events after this event is found. | ||
450 | |||
451 | --show-on-off-events:: | ||
452 | Show the --switch-on/off events too. This has no effect in 'perf report' now | ||
453 | but probably we'll make the default not to show the switch-on/off events | ||
454 | on the --group mode and if there is only one event besides the off/on ones, | ||
455 | go straight to the histogram browser, just like 'perf report' with no events | ||
456 | explicitely specified does. | ||
457 | |||
441 | --itrace:: | 458 | --itrace:: |
442 | Options for decoding instruction tracing data. The options are: | 459 | Options for decoding instruction tracing data. The options are: |
443 | 460 | ||
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index d4288dcce156..5e003d02821e 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include "util/debug.h" | 25 | #include "util/debug.h" |
26 | #include "util/evlist.h" | 26 | #include "util/evlist.h" |
27 | #include "util/evsel.h" | 27 | #include "util/evsel.h" |
28 | #include "util/evswitch.h" | ||
28 | #include "util/header.h" | 29 | #include "util/header.h" |
29 | #include "util/session.h" | 30 | #include "util/session.h" |
30 | #include "util/tool.h" | 31 | #include "util/tool.h" |
@@ -60,6 +61,7 @@ | |||
60 | struct report { | 61 | struct report { |
61 | struct perf_tool tool; | 62 | struct perf_tool tool; |
62 | struct perf_session *session; | 63 | struct perf_session *session; |
64 | struct evswitch evswitch; | ||
63 | bool use_tui, use_gtk, use_stdio; | 65 | bool use_tui, use_gtk, use_stdio; |
64 | bool show_full_info; | 66 | bool show_full_info; |
65 | bool show_threads; | 67 | bool show_threads; |
@@ -243,6 +245,9 @@ static int process_sample_event(struct perf_tool *tool, | |||
243 | return 0; | 245 | return 0; |
244 | } | 246 | } |
245 | 247 | ||
248 | if (evswitch__discard(&rep->evswitch, evsel)) | ||
249 | return 0; | ||
250 | |||
246 | if (machine__resolve(machine, &al, sample) < 0) { | 251 | if (machine__resolve(machine, &al, sample) < 0) { |
247 | pr_debug("problem processing %d event, skipping it.\n", | 252 | pr_debug("problem processing %d event, skipping it.\n", |
248 | event->header.type); | 253 | event->header.type); |
@@ -1189,6 +1194,7 @@ int cmd_report(int argc, const char **argv) | |||
1189 | OPT_CALLBACK(0, "time-quantum", &symbol_conf.time_quantum, "time (ms|us|ns|s)", | 1194 | OPT_CALLBACK(0, "time-quantum", &symbol_conf.time_quantum, "time (ms|us|ns|s)", |
1190 | "Set time quantum for time sort key (default 100ms)", | 1195 | "Set time quantum for time sort key (default 100ms)", |
1191 | parse_time_quantum), | 1196 | parse_time_quantum), |
1197 | OPTS_EVSWITCH(&report.evswitch), | ||
1192 | OPT_END() | 1198 | OPT_END() |
1193 | }; | 1199 | }; |
1194 | struct perf_data data = { | 1200 | struct perf_data data = { |
@@ -1257,6 +1263,10 @@ repeat: | |||
1257 | if (session == NULL) | 1263 | if (session == NULL) |
1258 | return -1; | 1264 | return -1; |
1259 | 1265 | ||
1266 | ret = evswitch__init(&report.evswitch, session->evlist, stderr); | ||
1267 | if (ret) | ||
1268 | return ret; | ||
1269 | |||
1260 | if (zstd_init(&(session->zstd_data), 0) < 0) | 1270 | if (zstd_init(&(session->zstd_data), 0) < 0) |
1261 | pr_warning("Decompression initialization failed. Reported data may be incomplete.\n"); | 1271 | pr_warning("Decompression initialization failed. Reported data may be incomplete.\n"); |
1262 | 1272 | ||