2 releases

0.1.1 Mar 5, 2021
0.1.0 Mar 4, 2021

#752 in Unix APIs

Download history 1255/week @ 2025-03-24 874/week @ 2025-03-31 862/week @ 2025-04-07 1226/week @ 2025-04-14 1433/week @ 2025-04-21 1101/week @ 2025-04-28 1219/week @ 2025-05-05 1327/week @ 2025-05-12 1314/week @ 2025-05-19 1499/week @ 2025-05-26 1095/week @ 2025-06-02 1182/week @ 2025-06-09 1165/week @ 2025-06-16 1475/week @ 2025-06-23 1143/week @ 2025-06-30 1172/week @ 2025-07-07

5,125 downloads per month
Used in 2 crates

MIT license

12KB
172 lines

MIT [Latest Version][l0] docs Chat on Miaou

proc-status

basic process information

The data comes from /proc/<pid>/process and is only available on unix-like systems.

This crate aims at keeping very simple. If it doesn't cover your needs, you should probably have a look at the much more complete procfs.

Examples:

Dump memory info about the current process:

let mem = proc_status::mem_usage().unwrap();
println!("Mem usage in bytes: current={}, peak={}", mem.current, mem.peak);

This prints something like

Mem usage in bytes: current=1232896, peak=141430784

Print all the fields of the current process' status:

use proc_status::ProcStatus;

let ps = ProcStatus::read().unwrap();
for entry in ps.entries() {
    let entry = entry.unwrap();
    println!("{} = {:?}", entry.key, entry.value);
}

Get the raw value of specific entries

use proc_status::ProcStatus;

let ps = ProcStatus::read().unwrap();
println!("State: {:?}", ps.value("State").unwrap());
println!("VmPeak in bytes: {:?}", ps.value_KiB("VmPeak").unwrap() * 1024);

Dependencies

~185–610KB
~14K SLoC