Skip to main content

Crate scx_cosmos

Crate scx_cosmos 

Source

Re-exportsΒ§

pub use bpf_intf::*;

ModulesΒ§

bpf_intf
bpf_skel πŸ”’
stats πŸ”’
types

StructsΒ§

BpfLinks
BpfMaps
BpfProgs
BpfSkel
BpfSkelBuilder
CpuTimes πŸ”’
DynamicThresholdState πŸ”’
State for EMA-based dynamic threshold adjustment with hysteresis.
OpenBpfMaps
OpenBpfProgs
OpenBpfSkel
Opts πŸ”’
PerfEventSpec πŸ”’
Perf event specification: either hex (0xN) or symbolic name (e.g. cache-misses). event_id is written to BPF rodata; type_ and config are used for perf_event_open.
Scheduler πŸ”’
StructOps

EnumsΒ§

Powermode πŸ”’

ConstantsΒ§

DYNAMIC_THRESHOLD_EMA_ALPHA πŸ”’
EMA smoothing factor (alpha). Higher values give more weight to recent samples. 0.3 provides good balance between responsiveness and stability.
DYNAMIC_THRESHOLD_HYSTERESIS πŸ”’
Hysteresis band: rate must move by this fraction beyond the target bounds before we act. This prevents oscillation when the rate hovers near the threshold boundaries.
DYNAMIC_THRESHOLD_INIT_VALUE πŸ”’
Initial value for the dynamic threshold (in BPF units).
DYNAMIC_THRESHOLD_MIN_VALUE πŸ”’
Minimum value for the dynamic threshold (in BPF units).
DYNAMIC_THRESHOLD_RATE_HIGH πŸ”’
Target event rate (per second) above which we consider migrations/sticky dispatches too high.
DYNAMIC_THRESHOLD_RATE_LOW πŸ”’
Target event rate (per second) below which we consider migrations/sticky dispatches too low.
DYNAMIC_THRESHOLD_SCALE_MAX πŸ”’
Maximum scale factor when far from target (fast convergence when initial threshold is way off).
DYNAMIC_THRESHOLD_SCALE_MIN πŸ”’
Minimum scale factor when just outside the target band (slow convergence near optimal).
DYNAMIC_THRESHOLD_SLOPE_HIGH πŸ”’
Slope for β€œtoo high” case: scale grows with (rate/HIGH - 1) so we step much harder when rate is many times over target.
DYNAMIC_THRESHOLD_SLOPE_LOW πŸ”’
Slope for β€œtoo low” case: scale grows with deficit so we step harder when rate is near zero.
GPU_SYNC_INTERVAL πŸ”’
Minimum interval between NVML GPU PID syncs. Kept separate from CPU polling so that fast polling (e.g. 100 ms) does not trigger expensive NVML calls every tick.
PERF_MAP_STRIDE πŸ”’
Must match lib/pmu.bpf.c SCX_PMU_STRIDE for perf_events map key layout.
SCHEDULER_NAME πŸ”’

FunctionsΒ§

get_primary_cpus πŸ”’
main πŸ”’
parse_cpu_list
parse_hardware_event πŸ”’
parse_hw_cache_event πŸ”’
parse_perf_event πŸ”’
Parse -e / -y value: hex (0xN) or symbolic name (e.g. cache-misses, LLC-load-misses).
parse_software_event πŸ”’
setup_perf_events πŸ”’
Setup performance counter events for a specific CPU and counter index. counter_idx 0 = migration event (-e), 1 = sticky event (-y).