[][src]Struct psutil::system::CpuPercentCollector

pub struct CpuPercentCollector { /* fields omitted */ }

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_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for CpuPercentCollector[src]

Auto Trait Implementations

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]