linux_procfs/
stat.rs

1#[derive(Debug, Default, Clone)]
2pub struct Cpu {
3    pub name: String,
4    pub user: u64,
5    pub nice: u64,
6    pub system: u64,
7    pub idle: u64,
8    pub iowait: u64,
9    pub irq: u64,
10    pub softirq: u64,
11    pub steal: u64,
12    // up to here, on linux v2.6.18
13    pub guest: u64,
14    pub guest_nice: u64,
15}
16
17#[derive(Debug, Default, Clone)]
18pub struct Stat {
19    //
20    pub cpu: Cpu,
21    //
22    pub cpus: Vec<Cpu>,
23    //
24    pub ctxt: u64,
25    //
26    #[cfg(feature = "has_stat_btime")]
27    pub btime: u32,
28    //
29    // total forks
30    pub processes: u32,
31    //
32    // nr_running
33    #[cfg(feature = "has_stat_procs_running")]
34    pub procs_running: u32,
35    //
36    // nr_iowait
37    #[cfg(feature = "has_stat_procs_blocked")]
38    pub procs_blocked: u32,
39}
40
41impl Stat {
42    pub fn with_capacity(n: usize) -> Self {
43        Self {
44            cpus: Vec::with_capacity(n),
45            ..Self::default()
46        }
47    }
48}