procfs 0.14.2

Interface to the linux procfs pseudo-filesystem
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
extern crate procfs;

fn main() {
    let pid = std::env::args().nth(1).and_then(|s| s.parse::<i32>().ok());

    let prc = if let Some(pid) = pid {
        println!("Info for pid={}", pid);
        procfs::process::Process::new(pid).unwrap()
    } else {
        procfs::process::Process::myself().unwrap()
    };
    println!("{:#?}", prc);

    let stat = prc.stat().unwrap();
    println!("State: {:?}", stat.state());
    println!("RSS:   {} bytes", stat.rss_bytes().unwrap());
}