Skip to main content

quota

Function quota 

Source
pub fn quota() -> Result<Option<CpuQuota>>
Expand description

The CPU quota on this process, or None when there is none. Linux: the smallest cgroup v2 cpu.max over the cgroup and its ancestors, or cgroup v1’s cpu.cfs_quota_us over cpu.cfs_period_us. Windows: the job object’s CPU rate cap. macOS: None. available already applies it, rounded up.

if let Some(q) = sys_lib::cpu::quota()? {
    println!("CPU quota {:.1} from {:?}", q.cpus, q.source);
}

§Errors

Malformed when a quota file does not parse; Os when the job-object query fails.