[][src]Struct procfs::CpuTime

pub struct CpuTime {
    pub user: u64,
    pub nice: u64,
    pub system: u64,
    pub idle: u64,
    pub iowait: Option<u64>,
    pub irq: Option<u64>,
    pub softirq: Option<u64>,
    pub steal: Option<u64>,
    pub guest: Option<u64>,
    pub guest_nice: Option<u64>,
    // some fields omitted
}

The amount of time, measured in ticks, the CPU has been in specific states

These fields are measured in ticks because the underlying data from the kernel is measured in ticks. The number of ticks per second can be returned by ticks_per_second() and is generally 100 on most systems. To convert this value to seconds, you can divide by the tps. There are also convenience methods that you can use too.

Fields

user: u64

Ticks spent in user mode

nice: u64

Ticks spent in user mode with low priority (nice)

system: u64

Ticks spent in system mode

idle: u64

Ticks spent in the idle state

iowait: Option<u64>

Ticks waiting for I/O to complete

This value is not reliable, for the following reasons:

  1. The CPU will not wait for I/O to complete; iowait is the time that a task is waiting for I/O to complete. When a CPU goes into idle state for outstanding task I/O, another task will be scheduled on this CPU.

  2. On a multi-core CPU, this task waiting for I/O to complete is not running on any CPU, so the iowait for each CPU is difficult to calculate.

  3. The value in this field may decrease in certain conditions.

(Since Linux 2.5.41)

irq: Option<u64>

Ticks servicing interrupts

(Since Linux 2.6.0)

softirq: Option<u64>

Ticks servicing softirqs

(Since Linux 2.6.0)

steal: Option<u64>

Ticks of stolen time.

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

(Since Linux 2.6.11)

guest: Option<u64>

Ticks spent running a virtual CPU for guest operating systems under control of the linux kernel

(Since Linux 2.6.24)

guest_nice: Option<u64>

Ticks spent running a niced guest

(Since Linux 2.6.33)

Implementations

impl CpuTime[src]

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

Milliseconds spent in user mode

pub fn user_duration(&self) -> Duration[src]

Time spent in user mode

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

Milliseconds spent in user mode with low priority (nice)

pub fn nice_duration(&self) -> Duration[src]

Time spent in user mode with low priority (nice)

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

Milliseconds spent in system mode

pub fn system_duration(&self) -> Duration[src]

Time spent in system mode

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

Milliseconds spent in the idle state

pub fn idle_duration(&self) -> Duration[src]

Time spent in the idle state

pub fn iowait_ms(&self) -> Option<u64>[src]

Milliseconds spent waiting for I/O to complete

pub fn iowait_duration(&self) -> Option<Duration>[src]

Time spent waiting for I/O to complete

pub fn irq_ms(&self) -> Option<u64>[src]

Milliseconds spent servicing interrupts

pub fn irq_duration(&self) -> Option<Duration>[src]

Time spent servicing interrupts

pub fn softirq_ms(&self) -> Option<u64>[src]

Milliseconds spent servicing softirqs

pub fn softirq_duration(&self) -> Option<Duration>[src]

Time spent servicing softirqs

pub fn steal_ms(&self) -> Option<u64>[src]

Milliseconds of stolen time

pub fn steal_duration(&self) -> Option<Duration>[src]

Amount of stolen time

pub fn guest_ms(&self) -> Option<u64>[src]

Milliseconds spent running a virtual CPU for guest operating systems under control of the linux kernel

pub fn guest_duration(&self) -> Option<Duration>[src]

Time spent running a virtual CPU for guest operating systems under control of the linux kernel

pub fn guest_nice_ms(&self) -> Option<u64>[src]

Milliseconds spent running a niced guest

pub fn guest_nice_duration(&self) -> Option<Duration>[src]

Time spent running a niced guest

Trait Implementations

impl Debug for CpuTime[src]

Auto Trait Implementations

impl RefUnwindSafe for CpuTime

impl Send for CpuTime

impl Sync for CpuTime

impl Unpin for CpuTime

impl UnwindSafe for CpuTime

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