Libbpf userspace function bpf_program__attach_perf_event
Attach a BPF_PROG_TYPE_PERF_EVENT
program to a perf event.
Definition
struct bpf_link * bpf_program__attach_perf_event(const struct bpf_program *prog, int pfd);
Parameters
prog
: BPF program to attachpfd
: File descriptor of the perf event to attach to
Usage
The pfd
is obtained by first creating a perf event using the perf_event_open
syscall.
This function calls bpf_program__attach_perf_event_opts
with default values.
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome