pub struct CpuQuota { /* private fields */ }Expand description
A cgroup CPU quota: how much CPU time the group may use per period.
Constructed only from a period that can produce a meaningful ratio, so there is no
representable quota that divides by zero or yields a non-finite core count. An
unlimited group is not a CpuQuota at all — it is
MetricState::Unsupported on CpuSnapshot::cgroup_quota, mirroring how
memory.max reading max becomes unsupported rather than u64::MAX.
Both raw figures are kept, not just the derived core count: someone debugging why
their container is being throttled wants to see the 100000 200000 they configured,
and deriving it back from 2.0 would lose the period.
Implementations§
Source§impl CpuQuota
impl CpuQuota
Sourcepub fn new(quota_us: u64, period_us: u64) -> Option<Self>
pub fn new(quota_us: u64, period_us: u64) -> Option<Self>
Builds a quota, or None when it could not describe a real ceiling.
Rejects a zero period — division by zero — and a ratio that is not finite. A zero quota is accepted: a group allowed no CPU time at all is a real, if hostile, configuration, and reporting it as absent would hide it.