perf_event_c...rnel_counter(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– perf_event_c...rnel_counter(9) πŸ’–

okay so bestie, welcome to the Kernel API Manual β€” yes THE kernel API manual, we're in the big leagues now πŸŽ€ this one's about perf_event_create_kernel_counter, and the name is literally truncated in the header but we're not gonna let a lil ... stop us, we're reading the whole thing πŸ’…


✨ NAME ✨

perf_event_create_kernel_counter β€”

and that's... it. that's the description. the NAME section gave us a name and then a dash and then nothing, and honestly? iconic minimalism πŸ’€ the manpage said "figure it out bestie" and moved on. the real tea is down in ARGUMENTS, keep scrolling 🫢


🌸 SYNOPSIS 🌸

struct perf_event * perf_event_create_kernel_counter (struct
perf_event_attr *attr , int cpu , struct task_struct *task ,
perf_overflow_handler_t overflow_handler , void *context );

so it hands you back a struct perf_event * β€” that's your shiny new counter, bestie ✨ β€” and it takes five things to make it happen. let's get into them πŸ‘‘


πŸ¦‹ ARGUMENTS πŸ¦‹

  • attr β€” the attributes of the counter you're creating. this is the whole vibe spec for your event, no cap πŸŽ€
  • cpu β€” the cpu in which the counter is bound. yes, it's bound to a cpu, it's very committed, main character energy fr πŸ”₯
  • task β€” the task to profile. and here's the moment: NULL means percpu 🫢 so if you pass NULL you're profiling per-cpu instead of a specific task. noted.
  • overflow_handler β€” the callback that triggers when we hit the event πŸ’₯ this is the one that fires off, don't forget about it
  • context β€” context data that could be used in the overflow_handler callback. lil care package for your handler πŸ“

πŸ‘‘ SEE ALSO πŸ‘‘

all of these are right there in SEE ALSO, i'm just passing them along bestie, no gatekeeping here 🌈


lowkey reminder: task being NULL meaning percpu is doing a lot of heavy lifting in this manpage, so don't sleep on it 😭

and that's the whole page, bestie!! short, sweet, absolutely slayed ✨ this cutie lives in ./kernel/events and the date on the tin is October 2026 β€” go be iconic with your counters πŸ’–πŸ§šβ­

πŸ“¦ where this page comes from