libperf: Add interface for overflow check of sampling events
Get series with b4
b4 am [email protected] change-id 20240726-overflow_check_libperf-88ad144d4dcaVersions newest first
- v2 Latest8 patches 4 repliesIn review
Changes in v2 from the cover letter
- Rebase onto v6.10
- Add a patch to move BPF opts helpers into a global include
- Renamed flags to fcntl_flags
- Changed signal type to int
- Add comment to owner_type member
- Add _cpu to perf_evsel__run_fcntl
- Rename sig to sigact
- Remove "!" from owner.type check
- Removed _GNU_SOURCE addition
- Removed null check for perf_evsel__attr()
- Make timeouts consistent between test-evlist.c and test-evsel.c
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | libperf: Move 'open_flags' from tools/perf to evsel::open_flagstools/ tools/ tools/ | +11 | 0 replies | |
| 2/8 | libbpf: Move opts code into dedicated headertools/ tools/ tools/ +6 more | +76 | 4 replies | |
| 3/8 | libperf: Introduce perf_{evsel, evlist}__open_opt with extensible struct optstools/ tools/ tools/ +3 more | +83 | 0 replies | |
| 4/8 | libperf: Add support for overflow handling of sampling eventstools/ tools/ tools/ +2 more | +90 | 0 replies | |
| 5/8 | libperf: Add perf_evsel__has_fd() functionstools/ tools/ tools/ +1 more | +21 | 0 replies | |
| 6/8 | libperf: Add perf_evsel__{refresh, period}() functionstools/ tools/ tools/ +1 more | +44 | 0 replies | |
| 7/8 | libperf test: Add test_stat_overflow()tools/ | +107 | 0 replies | |
| 8/8 | libperf test: Add test_stat_overflow_event()tools/ tools/ | +121 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 0/8] libperf: Add interface for overflow check of sampling events
I was going to send a similar series but after looking through the mailing list found this approach which fits my use-case exactly. I have rebased the series and applied the suggestions from Namhyung. The original cover letter with minor changes follows.
This patch series adds interface for overflow check of sampling events to libperf.
First patch move 'open_flags' from tools/perf to evsel::open_flags.
Second patch extracts out the opts used by BPF into a common header to be used by perf.
Third patch introduce perf_{evsel, evlist}__open_opt() with extensible structure opts.
Fourth patch adds support for overflow handling of sampling events.
Fifth patch adds a interface to check overflowed events.
Sixth patch adds a interface to perform IOC_REFRESH and IOC_PERIOD.
Seventh and eighth patch adds tests.
---
Previous version at:
https://lore.kernel.org/lkml/[email protected]/
Changes in v2:
- Rebase onto v6.10
- Add a patch to move BPF opts helpers into a global include
- Renamed flags to fcntl_flags
- Changed signal type to int
- Add comment to owner_type member
- Add _cpu to perf_evsel__run_fcntl
- Rename sig to sigact
- Remove "!" from owner.type check
- Removed _GNU_SOURCE addition
- Removed null check for perf_evsel__attr()
- Make timeouts consistent between test-evlist.c and test-evsel.c
Changes in v1:
- Move initialization/reference of evsel->open_flags from the first patch to the second patch
- Move signal-related handling and related fields of the opts structure from the second patch to the third patch
- Move _GNU_SOURCE from test-evlist.c to Makefile
- Delete *_cpu() function
- Refactor the fourth patch
- Fix test to use real-time signals instead of standard signals
Changes in RFC v2:
- Delete perf_evsel__set_close_on_exec() function
- Introduce perf_{evsel, evlist}__open_opt() with extensible structure opts
- Fix perf_evsel__set_signal() to a internal function
- Add bool type argument to perf_evsel__check_{fd, fd_cpu}() to indicate overflow results
---
Charlie Jenkins (1):
libbpf: Move opts code into dedicated header
Shunsuke Nakamura (7):
libperf: Move 'open_flags' from tools/perf to evsel::open_flags
libperf: Introduce perf_{evsel, evlist}__open_opt with extensible struct opts
libperf: Add support for overflow handling of sampling events
libperf: Add perf_evsel__has_fd() functions
libperf: Add perf_evsel__{refresh, period}() functions
libperf test: Add test_stat_overflow()
libperf test: Add test_stat_overflow_event()
tools/include/tools/opts.h | 68 +++++++++++++ tools/lib/bpf/bpf.c | 1 + tools/lib/bpf/btf.c | 1 + tools/lib/bpf/btf_dump.c | 1 + tools/lib/bpf/libbpf.c | 3 +- tools/lib/bpf/libbpf_internal.h | 48 --------- tools/lib/bpf/linker.c | 1 + tools/lib/bpf/netlink.c | 1 + tools/lib/bpf/ringbuf.c | 1 + tools/lib/perf/Documentation/libperf.txt | 17 ++++ tools/lib/perf/Makefile | 1 + tools/lib/perf/evlist.c | 20 ++++ tools/lib/perf/evsel.c | 169 +++++++++++++++++++++++++++++-- tools/lib/perf/include/internal/evsel.h | 2 + tools/lib/perf/include/perf/evlist.h | 3 + tools/lib/perf/include/perf/evsel.h | 30 ++++++ tools/lib/perf/libperf.map | 5 + tools/lib/perf/tests/test-evlist.c | 112 +++++++++++++++++++- tools/lib/perf/tests/test-evsel.c | 107 +++++++++++++++++++ tools/perf/util/evsel.c | 16 +-- tools/perf/util/evsel.h | 1 - 21 files changed, 541 insertions(+), 67 deletions(-)
---
base-commit: 0c3836482481200ead7b416ca80c68a29cfdaabd
change-id: 20240726-overflow_check_libperf-88ad144d4dca
Signature · 1 line
- Charlie