Skip to content

How to attach perf_events? #548

Answered by florianl
mrproliu asked this question in Q&A
Jan 21, 2022 · 1 comments · 9 replies
Discussion options

You must be logged in to vote

cilium/ebpf is a Go implementation around the eBPF ecosystem and it is independent of the perf subsystem of the Linux kernel. BCC decided to do a mix and implement both but also decided to implement only a part of the complete perf userspace API.
Go implementations of the perf subsystem are for example acln0/perf or hodgesds/perf-utils to name only two. Both packages can be used along with cilium/ebpf to attach eBPF programs to perf events.
Also the standard library provides an option to do so with unix#PerfEventOpen.
General speaking there are usually four steps involved to attach an eBPF program to a perf event:

  1. Open the perf event
  2. Load the eBPF program
  3. Set the eBPF program on the perf…

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@ti-mo
Comment options

@mrproliu
Comment options

@ti-mo
Comment options

@mrproliu
Comment options

@ti-mo
Comment options

Answer selected by ti-mo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants