Struct tabin_plugins::procfs::Calculations[][src]

pub struct Calculations {
    pub user: Jiffies,
    pub nice: Jiffies,
    pub system: Jiffies,
    pub idle: Jiffies,
    pub iowait: Jiffies,
    pub irq: Jiffies,
    pub softirq: Jiffies,
    pub steal: Jiffies,
    pub guest: Jiffies,
    pub guest_nice: Option<Jiffies>,
}

The number of calculations that have occured on this computer in a time period

Fields

user: Jiffies

Time spent in user mode.

nice: Jiffies

Time spent in user mode with low priority (nice).

system: Jiffies

Time spent in system mode.

idle: Jiffies

Time spent not doing anything in particular

iowait: Jiffies

Time forced to be idle waiting for I/O to complete.

irq: Jiffies

Time spent servicing hardware interrupts

softirq: Jiffies

Time spent servicing software interrupts

steal: Jiffies

Stolen time, which is the time spent in other operating systems when running in a virtualized environment

guest: Jiffies

Time spent running a virtual CPU for a guest operating system. AKA time we lent out to virtual machines.

guest_nice: Option<Jiffies>

Time spent running a niced guest

Implementations

impl Calculations[src]

pub fn load() -> Result<Calculations>[src]

Build a new Calculations for total CPU jiffies from the /proc/stat pseudofile. See load_per_cpu for per-cpu metrics.

pub fn load_per_cpu() -> Result<Vec<Calculations>>[src]

Build a list of per-cpu metrics from the /proc/stat file

This does not include the total line, use load() for that.

pub fn active(&self) -> Jiffies[src]

Jiffies spent non-idle

This includes all processes in user space, kernel space, and time stolen by other VMs.

pub fn idle(&self) -> Jiffies[src]

Jiffies spent with nothing to do

pub fn virt(&self) -> Jiffies[src]

Jiffies spent running child VMs

This is included in active() by the nature of the way that /proc/stats reports things, so don’t add this to that when totalling.

pub fn total(&self) -> Jiffies[src]

All jiffies since the kernel started tracking

pub fn percent_util_since(&self, kind: &WorkSource, start: &Calculations) -> f64[src]

Return how much cpu time the specific worksource took

The number returned is between 0 and 100

Trait Implementations

impl Clone for Calculations[src]

impl Debug for Calculations[src]

impl Display for Calculations[src]

impl FromStr for Calculations[src]

type Err = ProcFsError

The associated error which can be returned from parsing.

fn from_str(contents: &str) -> Result<Calculations>[src]

Parse the entire /proc/stat file into a single Calculations object for total CPU

impl PartialEq<Calculations> for Calculations[src]

impl StructuralPartialEq for Calculations[src]

impl<'a> Sub<&'a Calculations> for &'a Calculations[src]

type Output = Calculations

The resulting type after applying the - operator.

impl Sub<Calculations> for Calculations[src]

type Output = Self

The resulting type after applying the - operator.

Auto Trait Implementations

impl RefUnwindSafe for Calculations

impl Send for Calculations

impl Sync for Calculations

impl Unpin for Calculations

impl UnwindSafe for Calculations

Blanket Implementations

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

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

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

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

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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.