Trait sysinfo::ProcessorExt [−][src]
pub trait ProcessorExt: Debug {
fn cpu_usage(&self) -> f32;
fn name(&self) -> &str;
fn vendor_id(&self) -> &str;
fn brand(&self) -> &str;
fn 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.processors() {
println!("{}%", processor.cpu_usage());
}
Returns this processor’s name.
use sysinfo::{ProcessorExt, System, SystemExt};
let s = System::new();
for processor in s.processors() {
println!("{}", processor.name());
}
Returns the processor’s vendor id.
use sysinfo::{ProcessorExt, System, SystemExt};
let s = System::new();
for processor in s.processors() {
println!("{}", processor.vendor_id());
}
Returns the processor’s brand.
use sysinfo::{ProcessorExt, System, SystemExt};
let s = System::new();
for processor in s.processors() {
println!("{}", processor.brand());
}