STRUCT PERF_PMU(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

struct perf_pmu β€” and bestie, the tagline slot is literally empty in the original. No description, no subtitle, just the name and a whole lot of mystique. We move anyway πŸ’…


✨ SYNOPSIS ✨

Okay so here's the whole struct, copied exactly, no cap:

struct perf_pmu {
    const char *name;
    char *alias_name;
    const char *id;
    __u32 type;
    bool selectable;
    bool is_core;
    bool is_uncore;
    bool auxtrace;
    bool formats_checked;
    bool config_masks_present;
    bool config_masks_computed;
    int max_precise;
    void (*perf_event_attr_init_default)(const struct perf_pmu *pmu,
struct perf_event_attr *attr);
    struct perf_cpu_map *cpus;
    struct list_head format;
    struct hashmap *aliases;
    const struct pmu_events_table *events_table;
    uint32_t sysfs_aliases;
    uint32_t cpu_json_aliases;
    uint32_t sys_json_aliases;
    uint32_t cpu_common_json_aliases;
    bool sysfs_aliases_loaded;
    bool cpu_aliases_added;
    bool caps_initialized;
    u32 nr_caps;
    struct list_head caps;
    struct list_head list;
    __u64 config_masks[PERF_PMU_FORMAT_VALUE_CONFIG_END];
    struct {
      bool exclude_guest;
      bool checked;
    } missing_features;
    struct perf_mem_event *mem_events;
 };

(That line break in perf_event_attr_init_default's signature? That's how it is in the original, I'm not touching it 🫢)


πŸŽ€ Members πŸŽ€

Time for the member-by-member tour, grab a snack πŸ“

  • name β€” the name of the PMU, like "cpu".
  • alias_name β€” optional alternate name for the PMU, determined in architecture specific code.
  • id β€” optional PMU identifier, read from <sysfs>/bus/event_source/devices/<name>/identifier.
  • type β€” perf event attributed type value, read from <sysfs>/bus/event_source/devices/<name>/type.
  • selectable β€” can the PMU name be selected as if it were an event?
  • is_core β€” is the PMU the core CPU PMU? Determined by the name being "cpu" or by the presence of <sysfs>/bus/event_source/devices/<name>/cpus. Heads up: there may be >1 core PMU on systems like Intel hybrid πŸ‘€
  • is_uncore β€” is the PMU not within the CPU core? Determined by the presence of <sysfs>/bus/event_source/devices/<name>/cpumask.
  • auxtrace β€” are events auxiliary events? Determined in architecture specific code.
  • formats_checked β€” only check the PMU's formats are valid for perf_event_attr once. Efficiency slay ✨
  • config_masks_present β€” are there config format values?
  • config_masks_computed β€” set when masks are lazily computed.
  • max_precise β€” number of levels of :ppp precision supported by the PMU, read from <sysfs>/bus/event_source/devices/<name>/caps/max_precise.
  • perf_event_attr_init_default β€” optional function to default initialize PMU specific parts of the perf_event_attr.
  • cpus β€” empty, or the contents of either of these two:
    • <sysfs>/bus/event_source/devices/<name>/cpumask.
    • <sysfs>/bus/event_source/devices/<cpu>/cpus.
  • format β€” holds the contents of files read from <sysfs>/bus/event_source/devices/<name>/format/. Those contents specify which event parameter changes what config, config1 or config2 bits.
  • aliases β€” list of struct perf_pmu_alias. Each alias corresponds to an event read from <sysfs>/bus/event_source/devices/<name>/events/ or from json events in pmu-events.c.
  • events_table β€” the events table for json events in pmu-events.c.
  • sysfs_aliases β€” number of sysfs aliases loaded.
  • cpu_json_aliases β€” number of json event aliases loaded specific to the CPUID.
  • sys_json_aliases β€” number of json event aliases loaded matching the PMU's identifier.
  • cpu_common_json_aliases β€” number of json events that overlapped with sysfs when loading all sysfs events.
  • sysfs_aliases_loaded β€” are sysfs aliases loaded from disk?
  • cpu_aliases_added β€” have all json events table entries for the PMU been added?
  • caps_initialized β€” has the list caps been initialized?
  • nr_caps β€” the length of the list caps.
  • caps β€” holds the contents of files read from <sysfs>/bus/event_source/devices/<name>/caps/.

So about those caps contents, bestie: they're pairs of the filename with the value of its contents. For example, max_precise (see above πŸ‘†) may have a value of 3. Periodt.

  • list β€” element on pmus list in pmu.c.
  • config_masks β€” derived from the PMU's format data, the bits that are valid within the config value.
  • missing_features β€” features to inhibit when events on this PMU are opened. (It's a nested struct with exclude_guest and checked inside, iykyk πŸ‘‘)
  • mem_events β€” list of the supported mem events.

πŸ¦‹ SEE ALSO πŸ¦‹

Go read these next, fr fr:

  • Kernel file ./tools/perf/util/pmu.h
  • struct perf_pmu_format(9)

Ok that's the whole thing, no notes, you ate πŸ’–

Lives in ./tools/perf/util, dated October 2026 β€” catch you in the next manpage, mwah πŸ§šβ€β™€οΈπŸŒˆ

πŸ“¦ where this page comes from