diff options
author | Andi Kleen <ak@linux.intel.com> | 2018-10-01 15:59:27 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-11-05 12:37:10 -0500 |
commit | cf99ad1424c54fc84b84d3a3deb57a48c340c30a (patch) | |
tree | 32c11d477bba453be94db8246269d40111e3b233 | |
parent | c3537fc251503af18085b8f84126d13743663970 (diff) |
perf record: Support weak groups
Implement a weak group fallback for 'perf record', similar to the
existing 'perf stat' support. This allows to use groups that might be
longer than the available counters without failing.
Before:
$ perf record -e '{cycles,cache-misses,cache-references,cpu_clk_unhalted.thread,cycles,cycles,cycles}' -a sleep 1
Error:
The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cycles).
/bin/dmesg | grep -i perf may provide additional information.
After:
$ ./perf record -e '{cycles,cache-misses,cache-references,cpu_clk_unhalted.thread,cycles,cycles,cycles}:W' -a sleep 1
WARNING: No sample_id_all support, falling back to unordered processing
[ perf record: Woken up 3 times to write data ]
[ perf record: Captured and wrote 8.136 MB perf.data (134069 samples) ]
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/20181001195927.14211-2-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/Documentation/perf-list.txt | 1 | ||||
-rw-r--r-- | tools/perf/builtin-record.c | 7 |
2 files changed, 6 insertions, 2 deletions
diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt index 236b9b97dfdb..667c14e56031 100644 --- a/tools/perf/Documentation/perf-list.txt +++ b/tools/perf/Documentation/perf-list.txt | |||
@@ -55,7 +55,6 @@ counted. The following modifiers exist: | |||
55 | S - read sample value (PERF_SAMPLE_READ) | 55 | S - read sample value (PERF_SAMPLE_READ) |
56 | D - pin the event to the PMU | 56 | D - pin the event to the PMU |
57 | W - group is weak and will fallback to non-group if not schedulable, | 57 | W - group is weak and will fallback to non-group if not schedulable, |
58 | only supported in 'perf stat' for now. | ||
59 | 58 | ||
60 | The 'p' modifier can be used for specifying how precise the instruction | 59 | The 'p' modifier can be used for specifying how precise the instruction |
61 | address should be. The 'p' modifier can be specified multiple times: | 60 | address should be. The 'p' modifier can be specified multiple times: |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 10cf889c6d75..488779bc4c8d 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -391,7 +391,12 @@ try_again: | |||
391 | ui__warning("%s\n", msg); | 391 | ui__warning("%s\n", msg); |
392 | goto try_again; | 392 | goto try_again; |
393 | } | 393 | } |
394 | 394 | if ((errno == EINVAL || errno == EBADF) && | |
395 | pos->leader != pos && | ||
396 | pos->weak_group) { | ||
397 | pos = perf_evlist__reset_weak_group(evlist, pos); | ||
398 | goto try_again; | ||
399 | } | ||
395 | rc = -errno; | 400 | rc = -errno; |
396 | perf_evsel__open_strerror(pos, &opts->target, | 401 | perf_evsel__open_strerror(pos, &opts->target, |
397 | errno, msg, sizeof(msg)); | 402 | errno, msg, sizeof(msg)); |