get_cpu

Function get_cpu 

Source
pub fn get_cpu(
    cpu_brand: bool,
    show_freq: bool,
    show_cores: bool,
    show_temp: bool,
    speed_shorthand: bool,
    temp_unit: Option<char>,
) -> Option<String>
Expand description

Gets the CPU model, number of cores, speed, and temperature.

CPU model is sanitized to remove generic brand prefixes if cpu_brand is false. The number of cores is only included if show_cores is true. The speed is only included if show_speed is true. The temperature is only included if show_temp is true.

The speed is formatted as “XMHz” if it is less than 1000, and as “X.YGHz” if it is greater than or equal to 1000. If speed_shorthand is true, the speed is rounded to the nearest tenth of a GHz before formatting.

The temperature is formatted as “[X.Y]°C” or “[X.Y]°F” depending on temp_unit. If temp_unit is not specified, the temperature is in Celsius.