You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add first-class perf attachments with generic read support
Introduce PerfAttachment as the return value for perf_event attach calls,
allowing multiple perf attachments to coexist for the same loaded program.
Lower read(attachment) to attachment-specific perf counter reads and support
detach(attachment) separately from detach(program).
Update perf attach bookkeeping to track attachment ids, preserve per-attachment
perf fds, and emit more specific attach/detach status messages including the
event config. Also add skeleton cleanup registration so generated userspace
programs destroy the libbpf skeleton on exit.
Refresh docs, examples, and tests for the new read()/PerfAttachment API.
Copy file name to clipboardExpand all lines: README.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -270,7 +270,7 @@ fn main() -> i32 {
270
270
271
271
### Hardware Performance Counter Programs
272
272
273
-
Use `@perf_event` to attach eBPF programs to hardware or software performance counters. `perf_options` keeps the kernel's tagged `perf_type + perf_config` model, so adding new perf event families does not require flattening everything into one enum. Only `perf_type` and `perf_config` are required; all other fields have sensible defaults. If you need the current count in userspace, call `perf_read(prog)` after `attach(...)`:
273
+
Use `@perf_event` to attach eBPF programs to hardware or software performance counters. `perf_options` keeps the kernel's tagged `perf_type + perf_config` model, so adding new perf event families does not require flattening everything into one enum. Only `perf_type` and `perf_config` are required; all other fields have sensible defaults. Perf attaches return a first-class attachment value, so if you need the current count in userspace, call `read(att)`:
274
274
275
275
```kernelscript
276
276
// eBPF program fires on every hardware branch-miss sample
@@ -284,11 +284,12 @@ fn main() -> i32 {
284
284
285
285
// Minimal form — defaults: pid=-1 (all procs), cpu=0,
0 commit comments