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.
§Usage
§Setup
Add the following to your Cargo.toml:
[dependencies]
linux-procfs = "0.3.17"§Example 1: load average
use linux_procfs::System;
let mut sys = System::new("/");
let loadavg = sys.get_loadavg().unwrap();
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().unwrap();
for disk in diskstats.disks {
println!("{}, {}, {}", disk.name, disk.rblk, disk.wblk);
}Re-exports§
pub use crate::error::ProcError;pub use crate::error::ProcResult;
Modules§
Structs§
- System
- system interface of linux-procfs
- System
Config
Constants§
- DEFAULT_
CAPACITY_ CPUFREQ - DEFAULT_
CAPACITY_ CPUFREQ_ STATS - DEFAULT_
CAPACITY_ DISKSTATS - DEFAULT_
CAPACITY_ LOADAVG - DEFAULT_
CAPACITY_ MEMINFO - DEFAULT_
CAPACITY_ NETDEVS - DEFAULT_
CAPACITY_ PID_ CMDLINE - DEFAULT_
CAPACITY_ PID_ COMM - DEFAULT_
CAPACITY_ PID_ STAT - DEFAULT_
CAPACITY_ PID_ STATM - DEFAULT_
CAPACITY_ PID_ STATUS - DEFAULT_
CAPACITY_ STAT - DEFAULT_
CAPACITY_ UPTIME - DEFAULT_
CAPACITY_ VMSTAT