Struct procfs::CpuTime[][src]

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
}
Expand description

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

Milliseconds spent in user mode

Time spent in user mode

Milliseconds spent in user mode with low priority (nice)

Time spent in user mode with low priority (nice)

Milliseconds spent in system mode

Time spent in system mode

Milliseconds spent in the idle state

Time spent in the idle state

Milliseconds spent waiting for I/O to complete

Time spent waiting for I/O to complete

Milliseconds spent servicing interrupts

Time spent servicing interrupts

Milliseconds spent servicing softirqs

Time spent servicing softirqs

Milliseconds of stolen time

Amount of stolen time

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

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

Milliseconds spent running a niced guest

Time spent running a niced guest

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.