[−][src]Struct psutil::system::CpuPercentCollector
To get a CpuPercent struct in non-blocking mode.
Example :
let mut cpu_percent_collector = match psutil::system::CpuPercentCollector::new() { Ok(cpu_percent_collector) => cpu_percent_collector, Err(_) => { println!("Could not initialize cpu_percent_collector"); return; }, }; // {... Your programme ...} let cpu_times_percent = cpu_percent_collector.cpu_times_percent(); let cpu_times_percent_percpu = cpu_percent_collector.cpu_times_percent_percpu();
See an other example in examples/cpu_percent.
Methods
impl CpuPercentCollector
[src]
pub fn new() -> Result<CpuPercentCollector>
[src]
Initialize the CpuPercentCollector struct with the cpu_times informations.
pub fn cpu_times_percent(&mut self) -> Result<CpuTimesPercent>
[src]
Returns a Result of CpuTimesPercent calculate since the last call of the method. For the first call it is since the object creation.
The CpuTimesPercent object contains the detailed CPU utilization as percentage.
pub fn cpu_times_percent_percpu(&mut self) -> Result<Vec<CpuTimesPercent>>
[src]
Returns a Result of vector of CpuTimesPercent calculate since the last call of the method. For the first call it is since the object creation.
Each element of the vector reprensents the detailed CPU utilization as percentage per CPU.
Trait Implementations
impl Clone for CpuPercentCollector
[src]
fn clone(&self) -> CpuPercentCollector
[src]
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for CpuPercentCollector
[src]
Auto Trait Implementations
impl Send for CpuPercentCollector
impl Sync for CpuPercentCollector
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,