Struct procfs::process::Stat[][src]

pub struct Stat {
    pub pid: i32,
    pub comm: String,
    pub state: char,
    pub ppid: i32,
    pub pgrp: i32,
    pub session: i32,
    pub tty_nr: i32,
    pub tpgid: i32,
    pub flags: u32,
    pub minflt: u64,
    pub cminflt: u64,
    pub majflt: u64,
    pub cmajflt: u64,
    pub utime: u64,
    pub stime: u64,
    pub cutime: i64,
    pub cstime: i64,
    pub priority: i64,
    pub nice: i64,
    pub num_threads: i64,
    pub itrealvalue: i64,
    pub starttime: u64,
    pub vsize: u64,
    pub rss: i64,
    pub rsslim: u64,
    pub startcode: u64,
    pub endcode: u64,
    pub startstack: u64,
    pub kstkesp: u64,
    pub kstkeip: u64,
    pub signal: u64,
    pub blocked: u64,
    pub sigignore: u64,
    pub sigcatch: u64,
    pub wchan: u64,
    pub nswap: u64,
    pub cnswap: u64,
    pub exit_signal: Option<i32>,
    pub processor: Option<i32>,
    pub rt_priority: Option<u32>,
    pub policy: Option<u32>,
    pub delayacct_blkio_ticks: Option<u64>,
    pub guest_time: Option<u64>,
    pub cguest_time: Option<i64>,
    pub start_data: Option<usize>,
    pub end_data: Option<usize>,
    pub start_brk: Option<usize>,
    pub arg_start: Option<usize>,
    pub arg_end: Option<usize>,
    pub env_start: Option<usize>,
    pub env_end: Option<usize>,
    pub exit_code: Option<i32>,
}
[]

Status information about the process, based on the /proc/<pid>/stat file.

To construct one of these structures, you have to first create a Process.

Not all fields are available in every kernel. These fields have Option<T> types.

Fields

pid: i32
[]

The process ID.

comm: String
[]

The filename of the executable, in parentheses.

This is visible whether or not the executable is swapped out.

Note that if the actual comm field contains invalid UTF-8 characters, they will be replaced here by the U+FFFD replacement character.

state: char
[]

Process State.

See state() to get the process state as an enum.

ppid: i32
[]

The PID of the parent of this process.

pgrp: i32
[]

The process group ID of the process.

session: i32
[]

The session ID of the process.

tty_nr: i32
[]

The controlling terminal of the process.

The minor device number is contained in the combination of bits 31 to 20 and 7 to 0; the major device number is in bits 15 to 8.

See tty_nr() to get this value decoded into a (major, minor) tuple

tpgid: i32
[]

The ID of the foreground process group of the controlling terminal of the process.

flags: u32
[]

The kernel flags word of the process.

For bit meanings, see the PF_* defines in the Linux kernel source file include/linux/sched.h.

See flags() to get a StatFlags bitfield object.

minflt: u64
[]

The number of minor faults the process has made which have not required loading a memory page from disk.

cminflt: u64
[]

The number of minor faults that the process’s waited-for children have made.

majflt: u64
[]

The number of major faults the process has made which have required loading a memory page from disk.

cmajflt: u64
[]

The number of major faults that the process’s waited-for children have made.

utime: u64
[]

Amount of time that this process has been scheduled in user mode, measured in clock ticks (divide by ticks_per_second().

This includes guest time, guest_time (time spent running a virtual CPU, see below), so that applications that are not aware of the guest time field do not lose that time from their calculations.

stime: u64
[]

Amount of time that this process has been scheduled in kernel mode, measured in clock ticks (divide by ticks_per_second()).

cutime: i64
[]

Amount of time that this process’s waited-for children have been scheduled in user mode, measured in clock ticks (divide by ticks_per_second()).

This includes guest time, cguest_time (time spent running a virtual CPU, see below).

cstime: i64
[]

Amount of time that this process’s waited-for children have been scheduled in kernel mode, measured in clock ticks (divide by ticks_per_second()).

priority: i64
[]

For processes running a real-time scheduling policy (policy below; see sched_setscheduler(2)), this is the negated scheduling priority, minus one;

That is, a number in the range -2 to -100, corresponding to real-time priority orities 1 to 99. For processes running under a non-real-time scheduling policy, this is the raw nice value (setpriority(2)) as represented in the kernel. The kernel stores nice values as numbers in the range 0 (high) to 39 (low), corresponding to the user-visible nice range of -20 to 19. (This explanation is for Linux 2.6)

Before Linux 2.6, this was a scaled value based on the scheduler weighting given to this process.

nice: i64
[]

The nice value (see setpriority(2)), a value in the range 19 (low priority) to -20 (high priority).

num_threads: i64
[]

Number of threads in this process (since Linux 2.6). Before kernel 2.6, this field was hard coded to 0 as a placeholder for an earlier removed field.

itrealvalue: i64
[]

The time in jiffies before the next SIGALRM is sent to the process due to an interval timer.

Since kernel 2.6.17, this field is no longer maintained, and is hard coded as 0.

starttime: u64
[]

The time the process started after system boot.

In kernels before Linux 2.6, this value was expressed in jiffies. Since Linux 2.6, the value is expressed in clock ticks (divide by sysconf(_SC_CLK_TCK)).

See also the Stat::starttime() method to get the starttime as a DateTime object

vsize: u64
[]

Virtual memory size in bytes.

rss: i64
[]

Resident Set Size: number of pages the process has in real memory.

This is just the pages which count toward text, data, or stack space. This does not include pages which have not been demand-loaded in, or which are swapped out.

rsslim: u64
[]

Current soft limit in bytes on the rss of the process; see the description of RLIMIT_RSS in getrlimit(2).

startcode: u64
[]

The address above which program text can run.

endcode: u64
[]

The address below which program text can run.

startstack: u64
[]

The address of the start (i.e., bottom) of the stack.

kstkesp: u64
[]

The current value of ESP (stack pointer), as found in the kernel stack page for the process.

kstkeip: u64
[]

The current EIP (instruction pointer).

signal: u64
[]

The bitmap of pending signals, displayed as a decimal number. Obsolete, because it does not provide information on real-time signals; use /proc/<pid>/status instead.

blocked: u64
[]

The bitmap of blocked signals, displayed as a decimal number. Obsolete, because it does not provide information on real-time signals; use /proc/<pid>/status instead.

sigignore: u64
[]

The bitmap of ignored signals, displayed as a decimal number. Obsolete, because it does not provide information on real-time signals; use /proc/<pid>/status instead.

sigcatch: u64
[]

The bitmap of caught signals, displayed as a decimal number. Obsolete, because it does not provide information on real-time signals; use /proc/<pid>/status instead.

wchan: u64
[]

This is the “channel” in which the process is waiting. It is the address of a location in the kernel where the process is sleeping. The corresponding symbolic name can be found in /proc/<pid>/wchan.

nswap: u64
[]

Number of pages swapped (not maintained).

cnswap: u64
[]

Cumulative nswap for child processes (not maintained).

exit_signal: Option<i32>
[]

Signal to be sent to parent when we die.

(since Linux 2.1.22)

processor: Option<i32>
[]

CPU number last executed on.

(since Linux 2.2.8)

rt_priority: Option<u32>
[]

Real-time scheduling priority

Real-time scheduling priority, a number in the range 1 to 99 for processes scheduled under a real-time policy, or 0, for non-real-time processes

(since Linux 2.5.19)

policy: Option<u32>
[]

Scheduling policy (see sched_setscheduler(2)).

Decode using the SCHED_* constants in linux/sched.h.

(since Linux 2.5.19)

delayacct_blkio_ticks: Option<u64>
[]

Aggregated block I/O delays, measured in clock ticks (centiseconds).

(since Linux 2.6.18)

guest_time: Option<u64>
[]

Guest time of the process (time spent running a virtual CPU for a guest operating system), measured in clock ticks (divide by ticks_per_second())

(since Linux 2.6.24)

cguest_time: Option<i64>
[]

Guest time of the process’s children, measured in clock ticks (divide by ticks_per_second()).

(since Linux 2.6.24)

start_data: Option<usize>
[]

Address above which program initialized and uninitialized (BSS) data are placed.

(since Linux 3.3)

end_data: Option<usize>
[]

Address below which program initialized and uninitialized (BSS) data are placed.

(since Linux 3.3)

start_brk: Option<usize>
[]

Address above which program heap can be expanded with brk(2).

(since Linux 3.3)

arg_start: Option<usize>
[]

Address above which program command-line arguments (argv) are placed.

(since Linux 3.5)

arg_end: Option<usize>
[]

Address below program command-line arguments (argv) are placed.

(since Linux 3.5)

env_start: Option<usize>
[]

Address above which program environment is placed.

(since Linux 3.5)

env_end: Option<usize>
[]

Address below which program environment is placed.

(since Linux 3.5)

exit_code: Option<i32>
[]

The thread’s exit status in the form reported by waitpid(2).

(since Linux 3.5)

Implementations

impl Stat[src][]

pub fn from_reader<R: Read>(r: R) -> ProcResult<Stat>[src]

pub fn state(&self) -> ProcResult<ProcState>[src]

pub fn tty_nr(&self) -> (i32, i32)[src]

pub fn flags(&self) -> ProcResult<StatFlags>[src][]

The kernel flags word of the process, as a bitfield

See also the Stat::flags field.

pub fn starttime(&self) -> ProcResult<DateTime<Local>>[src][]

Get the starttime of the process as a DateTime object.

See also the starttime field.

pub fn rss_bytes(&self) -> i64[src][]

Gets the Resident Set Size (in bytes)

The rss field will return the same value in pages

Trait Implementations

impl Clone for Stat[src][+]

impl Debug for Stat[src][+]

Auto Trait Implementations

impl RefUnwindSafe for Stat

impl Send for Stat

impl Sync for Stat

impl Unpin for Stat

impl UnwindSafe for Stat

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> ToOwned for T where
    T: Clone
[src][+]

type Owned = T

The resulting type after obtaining ownership.

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.