2 releases

0.1.1 Mar 5, 2021
0.1.0 Mar 4, 2021

#700 in Unix APIs

Download history 792/week @ 2024-11-16 744/week @ 2024-11-23 1126/week @ 2024-11-30 837/week @ 2024-12-07 830/week @ 2024-12-14 783/week @ 2024-12-21 948/week @ 2024-12-28 1103/week @ 2025-01-04 1252/week @ 2025-01-11 1191/week @ 2025-01-18 1349/week @ 2025-01-25 1027/week @ 2025-02-01 1630/week @ 2025-02-08 984/week @ 2025-02-15 1206/week @ 2025-02-22 1315/week @ 2025-03-01

5,282 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

~225–670KB
~16K SLoC