[][src]Trait sysinfo::ProcessorExt

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; }

Contains all the methods of the Processor struct.

Required methods

fn get_cpu_usage(&self) -> f32

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());
}

fn get_name(&self) -> &str

Returns this processor's name.

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

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

fn get_vendor_id(&self) -> &str

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());
}

fn get_brand(&self) -> &str

Returns the processor's brand.

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

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

fn get_frequency(&self) -> u64

Returns the processor's frequency.

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

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

Implementors

impl ProcessorExt for Processor[src]

fn get_frequency(&self) -> u64[src]

Returns the CPU frequency in MHz.

Loading content...