diff options
| -rw-r--r-- | tools/perf/builtin-report.c | 1 | ||||
| -rw-r--r-- | tools/perf/builtin-script.c | 1 | ||||
| -rw-r--r-- | tools/perf/util/auxtrace.c | 10 | ||||
| -rw-r--r-- | tools/perf/util/auxtrace.h | 2 |
4 files changed, 14 insertions, 0 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 1174a426d090..79a33eb1a10d 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
| @@ -557,6 +557,7 @@ static int __cmd_report(struct report *rep) | |||
| 557 | ui__error("failed to set cpu bitmap\n"); | 557 | ui__error("failed to set cpu bitmap\n"); |
| 558 | return ret; | 558 | return ret; |
| 559 | } | 559 | } |
| 560 | session->itrace_synth_opts->cpu_bitmap = rep->cpu_bitmap; | ||
| 560 | } | 561 | } |
| 561 | 562 | ||
| 562 | if (rep->show_threads) { | 563 | if (rep->show_threads) { |
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index b458a0cc3544..83cdc0a61fd6 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
| @@ -2992,6 +2992,7 @@ int cmd_script(int argc, const char **argv) | |||
| 2992 | err = perf_session__cpu_bitmap(session, cpu_list, cpu_bitmap); | 2992 | err = perf_session__cpu_bitmap(session, cpu_list, cpu_bitmap); |
| 2993 | if (err < 0) | 2993 | if (err < 0) |
| 2994 | goto out_delete; | 2994 | goto out_delete; |
| 2995 | itrace_synth_opts.cpu_bitmap = cpu_bitmap; | ||
| 2995 | } | 2996 | } |
| 2996 | 2997 | ||
| 2997 | if (!no_callchain) | 2998 | if (!no_callchain) |
diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c index 651c01dfa5d3..5547457566a7 100644 --- a/tools/perf/util/auxtrace.c +++ b/tools/perf/util/auxtrace.c | |||
| @@ -322,6 +322,13 @@ static int auxtrace_queues__add_event_buffer(struct auxtrace_queues *queues, | |||
| 322 | return auxtrace_queues__add_buffer(queues, idx, buffer); | 322 | return auxtrace_queues__add_buffer(queues, idx, buffer); |
| 323 | } | 323 | } |
| 324 | 324 | ||
| 325 | static bool filter_cpu(struct perf_session *session, int cpu) | ||
| 326 | { | ||
| 327 | unsigned long *cpu_bitmap = session->itrace_synth_opts->cpu_bitmap; | ||
| 328 | |||
| 329 | return cpu_bitmap && cpu != -1 && !test_bit(cpu, cpu_bitmap); | ||
| 330 | } | ||
| 331 | |||
| 325 | int auxtrace_queues__add_event(struct auxtrace_queues *queues, | 332 | int auxtrace_queues__add_event(struct auxtrace_queues *queues, |
| 326 | struct perf_session *session, | 333 | struct perf_session *session, |
| 327 | union perf_event *event, off_t data_offset, | 334 | union perf_event *event, off_t data_offset, |
| @@ -331,6 +338,9 @@ int auxtrace_queues__add_event(struct auxtrace_queues *queues, | |||
| 331 | unsigned int idx; | 338 | unsigned int idx; |
| 332 | int err; | 339 | int err; |
| 333 | 340 | ||
| 341 | if (filter_cpu(session, event->auxtrace.cpu)) | ||
| 342 | return 0; | ||
| 343 | |||
| 334 | buffer = zalloc(sizeof(struct auxtrace_buffer)); | 344 | buffer = zalloc(sizeof(struct auxtrace_buffer)); |
| 335 | if (!buffer) | 345 | if (!buffer) |
| 336 | return -ENOMEM; | 346 | return -ENOMEM; |
diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h index 68e0aa40b24a..33b5e6cdf38c 100644 --- a/tools/perf/util/auxtrace.h +++ b/tools/perf/util/auxtrace.h | |||
| @@ -74,6 +74,7 @@ enum itrace_period_type { | |||
| 74 | * @period: 'instructions' events period | 74 | * @period: 'instructions' events period |
| 75 | * @period_type: 'instructions' events period type | 75 | * @period_type: 'instructions' events period type |
| 76 | * @initial_skip: skip N events at the beginning. | 76 | * @initial_skip: skip N events at the beginning. |
| 77 | * @cpu_bitmap: CPUs for which to synthesize events, or NULL for all | ||
| 77 | */ | 78 | */ |
| 78 | struct itrace_synth_opts { | 79 | struct itrace_synth_opts { |
| 79 | bool set; | 80 | bool set; |
| @@ -96,6 +97,7 @@ struct itrace_synth_opts { | |||
| 96 | unsigned long long period; | 97 | unsigned long long period; |
| 97 | enum itrace_period_type period_type; | 98 | enum itrace_period_type period_type; |
| 98 | unsigned long initial_skip; | 99 | unsigned long initial_skip; |
| 100 | unsigned long *cpu_bitmap; | ||
| 99 | }; | 101 | }; |
| 100 | 102 | ||
| 101 | /** | 103 | /** |
