2 releases

0.1.1 Mar 5, 2021
0.1.0 Mar 4, 2021

#513 in Unix APIs

Download history 768/week @ 2023-12-17 754/week @ 2023-12-24 754/week @ 2023-12-31 736/week @ 2024-01-07 725/week @ 2024-01-14 647/week @ 2024-01-21 685/week @ 2024-01-28 793/week @ 2024-02-04 715/week @ 2024-02-11 773/week @ 2024-02-18 841/week @ 2024-02-25 765/week @ 2024-03-03 827/week @ 2024-03-10 732/week @ 2024-03-17 746/week @ 2024-03-24 748/week @ 2024-03-31

3,214 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

~340–800KB
~19K SLoC