STRUCT PMU(9)
πΈ NAME πΈ
struct pmu β the generic performance monitoring unit π
like, the blueprint, the moment, the whole vibe
β¨ SYNOPSIS β¨
okay bestie sit down because this struct is long β it's giving "I have a callback for everything" main character energy. here it is, untouched, every single field, no cap:
struct pmu {
struct list_head entry;
spinlock_t events_lock;
struct list_head events;
struct module *module;
struct device *dev;
struct device *parent;
const struct attribute_group **attr_groups;
const struct attribute_group **attr_update;
const char *name;
int type;
int capabilities;
unsigned int scope;
struct perf_cpu_pmu_context * __percpu *cpu_pmu_context;
atomic_t exclusive_cnt;
int task_ctx_nr;
int hrtimer_interval_ms;
unsigned int nr_addr_filters;
void (*pmu_enable) (struct pmu *pmu);
void (*pmu_disable) (struct pmu *pmu);
int (*event_init) (struct perf_event *event);
void (*event_mapped) (struct perf_event *event, struct mm_struct *mm);
void (*event_unmapped) (struct perf_event *event, struct mm_struct *mm);
#define PERF_EF_START 0x01;
#define PERF_EF_RELOAD 0x02;
#define PERF_EF_UPDATE 0x04;
#define PERF_EF_PAUSE 0x08;
#define PERF_EF_RESUME 0x10;
int (*add) (struct perf_event *event, int flags);
void (*del) (struct perf_event *event, int flags);
void (*start) (struct perf_event *event, int flags);
void (*stop) (struct perf_event *event, int flags);
void (*read) (struct perf_event *event);
void (*start_txn) (struct pmu *pmu, unsigned int txn_flags);
int (*commit_txn) (struct pmu *pmu);
void (*cancel_txn) (struct pmu *pmu);
int (*event_idx) (struct perf_event *event);
void (*sched_task) (struct perf_event_pmu_context *pmu_ctx, struct task_struct *task, bool sched_in);
struct kmem_cache *task_ctx_cache;
void *(*setup_aux) (struct perf_event *event, void **pages, int nr_pages, bool overwrite);
void (*free_aux) (void *aux);
long (*snapshot_aux) (struct perf_event *event, struct perf_output_handle *handle, unsigned long size);
int (*addr_filters_validate) (struct list_head *filters);
void (*addr_filters_sync) (struct perf_event *event);
int (*aux_output_match) (struct perf_event *event);
bool (*filter) (struct pmu *pmu, int cpu);
int (*check_period) (struct perf_event *event, u64 value);
};
a few things I need to scream about, bestie:
- the function-pointer section is lowkey a buffet β
pmu_enable,pmu_disable,event_init,add,del,start,stop,read,start_txn,commit_txn,cancel_txn,event_idx,sched_task,setup_aux,free_aux,snapshot_aux,addr_filters_validate,addr_filters_sync,aux_output_match,filter,check_periodβ¦ like, she has options π - there are five
#defines just vibing in the middle of the struct βPERF_EF_START0x01,PERF_EF_RELOAD0x02,PERF_EF_UPDATE0x04,PERF_EF_PAUSE0x08,PERF_EF_RESUME0x10β unhinged placement, but we respect it π«Ά - two
struct list_heads (entryandevents) plus aspinlock_t events_lock, so yeah, list behaviour is very much part of her personality β¨ struct perf_cpu_pmu_context * __percpu *cpu_pmu_contextis a whole triple-star situation, no notes π- and
atomic_t exclusive_cntout here keeping count like the responsible friend π
fr fr everything above is verbatim from the page β don't let the sparkle fool you, those types and names are load-bearing π
π Members π
ngl the Members section is literally empty in the original. nothing. a whole heading with zero content, and honestly? iconic. the struct in SYNOPSIS is doing all the heavy lifting, so scroll back up if you skipped it π¦
π¦ SEE ALSO π¦
- Kernel file
./include/linux/perf_event.h struct hw_perf_event(9)struct perf_addr_filter(9)struct perf_addr_filters_head(9)struct perf_event(9)struct perf_event_context(9)struct perf_ctx_data(9)
that's the whole page bestie, go read perf_event.h, it's right there π
mwah π this came from ./include/linux, dated October 2026, and the page itself is struct pmu(9) β go off, kernel API manual, you ate πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms