Linux cgroup pressure diagnostics, hierarchical admission and worker reservation lifecycle in MoonBit
///|
test "visible ancestor budget" {
let leaf = @moonpressure.Layer::parse(
"leaf",
memory_max="max",
memory_current="100",
)
let parent = @moonpressure.Layer::parse(
"parent",
cpu_max="50000 100000",
memory_max="1000",
memory_current="900",
)
let limits = @moonpressure.budget([leaf, parent])
assert_eq(limits.quota_cores, Some(0.5))
assert_eq(limits.hard_headroom_bytes, Some(100L))
}pub struct Controller {
// private fields
}fn Controller::update(self : Controller, sample : Interval, limits : Budget) -> Advice raise DeltaErrorpub struct Interval {
identity : String
end_us : Int64
elapsed_us : Int64
cpu_cores_used : Double
throttled_period_percent : Double?
throttled_us : Int64?
memory_current_bytes : Int64
memory_high_events : Int64
memory_max_events : Int64
oom_events : Int64
oom_kills : Int64
cpu_stall : StallDelta?
memory_stall : StallDelta?
io_stall : StallDelta?
} derive(Eq, Debug)fn Layer::parse(name : String, cpu_max? : String, memory_max? : String, memory_high? : String, memory_current? : String) -> Layer raise ParseErrorfn Policy::new(enter_percent? : Double, exit_percent? : Double, enter_intervals? : Int, exit_intervals? : Int, min_headroom_bytes? : Int64) -> Policy raise ParseErrorfn Snapshot::parse(identity : String, time_us : Int64, cpu_stat~ : String, memory_current~ : String, memory_events~ : String, cpu_pressure? : String, memory_pressure? : String, io_pressure? : String) -> Snapshot raise ParseErrorInstall
Download zipLinux cgroup pressure diagnostics, hierarchical admission and worker reservation lifecycle in MoonBit