Trait sysinfo::ProcessorExt[][src]

pub trait ProcessorExt: Debug {
    fn get_cpu_usage(&self) -> f32;
fn get_name(&self) -> &str;
fn get_vendor_id(&self) -> &str;
fn get_brand(&self) -> &str;
fn get_frequency(&self) -> u64; }
Expand description

Contains all the methods of the Processor struct.

Required methods

Returns this processor’s usage.

Note: You’ll need to refresh it at least twice (diff between the first and the second is how CPU usage is computed) at first if you want to have a non-zero value.

use sysinfo::{ProcessorExt, System, SystemExt};

let s = System::new();
for processor in s.get_processors() {
    println!("{}%", processor.get_cpu_usage());
}

Returns this processor’s name.

use sysinfo::{ProcessorExt, System, SystemExt};

let s = System::new();
for processor in s.get_processors() {
    println!("{}", processor.get_name());
}

Returns the processor’s vendor id.

use sysinfo::{ProcessorExt, System, SystemExt};

let s = System::new();
for processor in s.get_processors() {
    println!("{}", processor.get_vendor_id());
}

Returns the processor’s brand.

use sysinfo::{ProcessorExt, System, SystemExt};

let s = System::new();
for processor in s.get_processors() {
    println!("{}", processor.get_brand());
}

Returns the processor’s frequency.

use sysinfo::{ProcessorExt, System, SystemExt};

let s = System::new();
for processor in s.get_processors() {
    println!("{}", processor.get_frequency());
}

Implementors