Crates.io | proc-status |
lib.rs | proc-status |
version | 0.1.1 |
source | src |
created_at | 2021-03-04 17:49:32.499184 |
updated_at | 2021-03-05 11:16:59.124191 |
description | simple access to proc/status info on unix |
homepage | |
repository | https://github.com/Canop/proc-status |
max_upload_size | |
id | 363806 |
size | 11,524 |
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.
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
use proc_status::ProcStatus;
let ps = ProcStatus::read().unwrap();
for entry in ps.entries() {
let entry = entry.unwrap();
println!("{} = {:?}", entry.key, entry.value);
}
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);