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    #[cfg(feature = "has_stat_cguest")]
16    pub cguest: u64,
17}
18
19#[derive(Debug, Default, Clone)]
20pub struct Stat {
21    //
22    pub cpu: Cpu,
23    //
24    pub cpus: Vec<Cpu>,
25    //
26    pub ctxt: u64,
27    //
28    #[cfg(feature = "has_stat_btime")]
29    pub btime: u32,
30    //
31    // total forks
32    pub processes: u32,
33    //
34    // nr_running
35    #[cfg(feature = "has_stat_procs_running")]
36    pub procs_running: u32,
37    //
38    // nr_iowait
39    #[cfg(feature = "has_stat_procs_blocked")]
40    pub procs_blocked: u32,
41}
42
43impl Stat {
44    pub fn with_capacity(n: usize) -> Self {
45        Self {
46            cpus: Vec::with_capacity(n),
47            ..Self::default()
48        }
49    }
50}