Crate linux_procfs[−][src]
Expand description
The linux-procfs crate is the data snap library for the /proc/
filesystem on the linux os.
This crate reads from /proc
filesystem, scanne it, stores the value into the struct and returns it. This scans and holds only the required values by specifying feature
.
Feature
- minimum supert rustc 1.47.0 (18bf6b4f0 2020-10-07)
Example
Example 1: load average
use linux_procfs::System;
let mut sys = System::new("/");
let loadavg = sys.get_loadavg();
println!("{}, {}, {}, {}", loadavg.a1, loadavg.a5, loadavg.a15, loadavg.last_pid);
Example 2: disk stats
use linux_procfs::System;
let mut sys = System::new("/");
let diskstats = sys.get_diskstats();
for disk in diskstats.disks {
println!("{}, {}, {}", disk.name, disk.rblk, disk.wblk);
}
Modules
Structs
system interface of linux-procfs