Skip to main content

load

Function load 

Source
pub fn load() -> Result<Option<Load>>
Expand description

The load average, or None on Windows, which keeps none (nothing is simulated). Inside a container it is the host’s (with LXCFS, the container’s).

match sys_lib::cpu::load()? {
    Some(load) => println!("load {load} ({:.2} per CPU)", load.per_cpu().one),
    None => println!("this OS keeps no load average"),
}

§Errors

Malformed when /proc/loadavg does not parse.