Skip to main content

Module perf

Module perf 

Source

Re-exportsΒ§

use libc::pid_t; πŸ”’
use std::os::raw::c_int; πŸ”’
use std::os::raw::c_ulong; πŸ”’
use anyhow::Context as _; πŸ”’
use anyhow::Result; πŸ”’
use libbpf_rs::MapCore; πŸ”’
use libbpf_rs::MapFlags; πŸ”’

ModulesΒ§

bindings
ioctls

StructsΒ§

PerfEventSpec
Perf event specification: either hex (0xN) or a symbolic name (e.g. cache-misses). event_id is the opaque id written to BPF rodata (it must match between install and read); type_/config drive perf_event_open.

ConstantsΒ§

PERF_MAP_STRIDE
Must match lib/pmu.bpf.c SCX_PMU_STRIDE for the perf_events map key layout.

FunctionsΒ§

parse_hardware_event πŸ”’
parse_hw_cache_event πŸ”’
parse_perf_event
Parse a perf event value: hex (0xN) or a symbolic name (e.g. cache-misses, LLC-load-misses, page-faults). Intended for use as a clap value_parser.
parse_software_event πŸ”’
perf_event_open⚠
The perf_event_open system call.
setup_perf_events
Open a perf event on @cpu and register its fd in the given BPF PMU map (the scheduler’s scx_pmu_map) at the slot for (@cpu, @counter_idx). counter_idx 0 is the migration event, 1 the sticky event, matching the PMU library install order.