Trait tikv_util::sys::ProcessorExt[][src]

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

Contains all the methods of the Processor struct.

Required methods

pub fn get_cpu_usage(&self) -> f32[src]

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

pub fn get_name(&self) -> &str[src]

Returns this processor’s name.

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

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

pub fn get_vendor_id(&self) -> &str[src]

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

pub fn get_brand(&self) -> &str[src]

Returns the processor’s brand.

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

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

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

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...

Implementations on Foreign Types

impl ProcessorExt for Processor[src]

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

Returns the CPU frequency in MHz.

Loading content...

Implementors

Loading content...