pub fn total_cpu_available() -> f32
Expand description
Returns the total number of cpu available as a float.
If running in container, this function will return the cpu limit by the container. If not,
it will return the available_parallelism
by the system. A panic will be invoked if
invoking process does not have permission to read appropriate values by
std::thread::available_parallelism
or if the platform is not supported. The cgroup
mount point is assumed to be at /sys/fs/cgroup by default.
§Examples
Basic usage:
ⓘ
let cpu_available = cpu::total_cpu_available();