extern structstd.os.linux.perf_event_attr[src]

Fields

type: PERF.TYPE = undefined

Major type: hardware/software/tracepoint/etc.

size: u32 = @sizeOf(perf_event_attr)

Size of the attr structure, for fwd/bwd compat.

config: u64 = 0

Type specific configuration information.

sample_period_or_freq: u64 = 0
sample_type: u64 = 0
read_format: u64 = 0
flags: packed struct {
    /// off by default
    disabled: bool = false,
    /// children inherit it
    inherit: bool = false,
    /// must always be on PMU
    pinned: bool = false,
    /// only group on PMU
    exclusive: bool = false,
    /// don't count user
    exclude_user: bool = false,
    /// ditto kernel
    exclude_kernel: bool = false,
    /// ditto hypervisor
    exclude_hv: bool = false,
    /// don't count when idle
    exclude_idle: bool = false,
    /// include mmap data
    mmap: bool = false,
    /// include comm data
    comm: bool = false,
    /// use freq, not period
    freq: bool = false,
    /// per task counts
    inherit_stat: bool = false,
    /// next exec enables
    enable_on_exec: bool = false,
    /// trace fork/exit
    task: bool = false,
    /// wakeup_watermark
    watermark: bool = false,
    /// precise_ip:
    ///
    ///  0 - SAMPLE_IP can have arbitrary skid
    ///  1 - SAMPLE_IP must have constant skid
    ///  2 - SAMPLE_IP requested to have 0 skid
    ///  3 - SAMPLE_IP must have 0 skid
    ///
    ///  See also PERF_RECORD_MISC_EXACT_IP
    /// skid constraint
    precise_ip: u2 = 0,
    /// non-exec mmap data
    mmap_data: bool = false,
    /// sample_type all events
    sample_id_all: bool = false,

    /// don't count in host
    exclude_host: bool = false,
    /// don't count in guest
    exclude_guest: bool = false,

    /// exclude kernel callchains
    exclude_callchain_kernel: bool = false,
    /// exclude user callchains
    exclude_callchain_user: bool = false,
    /// include mmap with inode data
    mmap2: bool = false,
    /// flag comm events that are due to an exec
    comm_exec: bool = false,
    /// use @clockid for time fields
    use_clockid: bool = false,
    /// context switch data
    context_switch: bool = false,
    /// Write ring buffer from end to beginning
    write_backward: bool = false,
    /// include namespaces data
    namespaces: bool = false,

    __reserved_1: u35 = 0,
} = .{}
wakeup_events_or_watermark: u32 = 0

wakeup every n events, or bytes before wakeup

bp_type: u32 = 0
config1: u64 = 0

This field is also used for: bp_addr kprobe_func for perf_kprobe uprobe_path for perf_uprobe

config2: u64 = 0

This field is also used for: bp_len kprobe_addr when kprobe_func == null probe_offset for perf_[k,u]probe

branch_sample_type: u64 = 0

enum perf_branch_sample_type

sample_regs_user: u64 = 0

Defines set of user regs to dump on samples. See asm/perf_regs.h for details.

sample_stack_user: u32 = 0

Defines size of the user stack to dump on samples.

clockid: clockid_t = .REALTIME
sample_regs_intr: u64 = 0

Defines set of regs to dump for each sample state captured on:

  • precise = 0: PMU interrupt
  • precise > 0: sampled instruction

See asm/perf_regs.h for details.

aux_watermark: u32 = 0

Wakeup watermark for AUX area

sample_max_stack: u16 = 0
__reserved_2: u16 = 0

Align to u64

Source Code

Source code
pub const perf_event_attr = extern struct {
    /// Major type: hardware/software/tracepoint/etc.
    type: PERF.TYPE = undefined,
    /// Size of the attr structure, for fwd/bwd compat.
    size: u32 = @sizeOf(perf_event_attr),
    /// Type specific configuration information.
    config: u64 = 0,

    sample_period_or_freq: u64 = 0,
    sample_type: u64 = 0,
    read_format: u64 = 0,

    flags: packed struct {
        /// off by default
        disabled: bool = false,
        /// children inherit it
        inherit: bool = false,
        /// must always be on PMU
        pinned: bool = false,
        /// only group on PMU
        exclusive: bool = false,
        /// don't count user
        exclude_user: bool = false,
        /// ditto kernel
        exclude_kernel: bool = false,
        /// ditto hypervisor
        exclude_hv: bool = false,
        /// don't count when idle
        exclude_idle: bool = false,
        /// include mmap data
        mmap: bool = false,
        /// include comm data
        comm: bool = false,
        /// use freq, not period
        freq: bool = false,
        /// per task counts
        inherit_stat: bool = false,
        /// next exec enables
        enable_on_exec: bool = false,
        /// trace fork/exit
        task: bool = false,
        /// wakeup_watermark
        watermark: bool = false,
        /// precise_ip:
        ///
        ///  0 - SAMPLE_IP can have arbitrary skid
        ///  1 - SAMPLE_IP must have constant skid
        ///  2 - SAMPLE_IP requested to have 0 skid
        ///  3 - SAMPLE_IP must have 0 skid
        ///
        ///  See also PERF_RECORD_MISC_EXACT_IP
        /// skid constraint
        precise_ip: u2 = 0,
        /// non-exec mmap data
        mmap_data: bool = false,
        /// sample_type all events
        sample_id_all: bool = false,

        /// don't count in host
        exclude_host: bool = false,
        /// don't count in guest
        exclude_guest: bool = false,

        /// exclude kernel callchains
        exclude_callchain_kernel: bool = false,
        /// exclude user callchains
        exclude_callchain_user: bool = false,
        /// include mmap with inode data
        mmap2: bool = false,
        /// flag comm events that are due to an exec
        comm_exec: bool = false,
        /// use @clockid for time fields
        use_clockid: bool = false,
        /// context switch data
        context_switch: bool = false,
        /// Write ring buffer from end to beginning
        write_backward: bool = false,
        /// include namespaces data
        namespaces: bool = false,

        __reserved_1: u35 = 0,
    } = .{},
    /// wakeup every n events, or
    /// bytes before wakeup
    wakeup_events_or_watermark: u32 = 0,

    bp_type: u32 = 0,

    /// This field is also used for:
    /// bp_addr
    /// kprobe_func for perf_kprobe
    /// uprobe_path for perf_uprobe
    config1: u64 = 0,
    /// This field is also used for:
    /// bp_len
    /// kprobe_addr when kprobe_func == null
    /// probe_offset for perf_[k,u]probe
    config2: u64 = 0,

    /// enum perf_branch_sample_type
    branch_sample_type: u64 = 0,

    /// Defines set of user regs to dump on samples.
    /// See asm/perf_regs.h for details.
    sample_regs_user: u64 = 0,

    /// Defines size of the user stack to dump on samples.
    sample_stack_user: u32 = 0,

    clockid: clockid_t = .REALTIME,
    /// Defines set of regs to dump for each sample
    /// state captured on:
    ///  - precise = 0: PMU interrupt
    ///  - precise > 0: sampled instruction
    ///
    /// See asm/perf_regs.h for details.
    sample_regs_intr: u64 = 0,

    /// Wakeup watermark for AUX area
    aux_watermark: u32 = 0,
    sample_max_stack: u16 = 0,
    /// Align to u64
    __reserved_2: u16 = 0,
}