Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
System.CGroup.V2.CPU
Description
Types and operations for CPU-related data within a cgroup.
Documentation
getProcessEffectiveCPUQuota :: IO CPUQuota Source #
Get the current process' effective CPU quota
getEffectiveCPUQuota :: CGroup -> IO CPUQuota Source #
Compute the "effective CPU quota" fr a cgroup, which may be smaller than the given cgroup's individual quota.
When a parent (or grandparent, etc) of this cgroup has a lower cpu quota, the lower quota is returned instead.
getCPUQuota :: CGroup -> IO CPUQuota Source #
Read this specific cgroup's "cpu.max" file into a CPUQuota.
For example:
| cpu.max | quota | | -------------- | ---------------- | | 100000 100000 | CPUQuota (1 % 1) | | 200000 100000 | CPUQuota (2 % 1) | | 50000 100000 | CPUQuota (1 % 2) | | max 100000 | NoQuota |
Returns NoQuota for the root cgroup, or when the cpu controller is not enabled in this cgroup.
Most often, you'll want to use getEffectiveCPUQuota
instead.
A CPU quota is the ratio of CPU time our process can use relative to the scheduler period
For example:
| ratio | description | | ---------------- | ----------- | | 100000 / 100000 | (1) | | 200000 / 100000 | (2) | | 50000 / 100000 | (3) | | max / 100000 | (4) |
- : we can use up to a single CPU core
- : we can use up to two CPU cores
- : the scheduler will give us a single CPU core for up to 50% of the time
- : we can use all available CPU resources (there is no quota)