Skip to main content

Crate zsys

Crate zsys 

Source
Expand description

Low-overhead system information collection.

Counter models and parsers work without std or an allocator. Linux collection is enabled by std; the optional dylib feature adds shared Linux/macOS/Windows native loading without std or an allocator.

use zsys::cpu::CpuTimes;
let before = CpuTimes { user: 100, idle: 900, ..CpuTimes::default() };
let after = CpuTimes { user: 150, idle: 950, ..CpuTimes::default() };
assert_eq!(after.busy_percent_since(before), Some(50.0));
let mut system = zsys::System::new();
system.refresh_memory()?;
system.refresh_processes()?;
for process in system.processes() {
    println!("{}: {} bytes", process.id.pid, process.memory_bytes);
}

Re-exports§

pub use linux::System;
pub use snapshot::Sample;
pub use snapshot::SystemSnapshot;

Modules§

cpu
Cumulative CPU counters, in kernel clock ticks. Guest time is already in user/nice.
disk
Block-device I/O and filesystem-capacity models. No allocation or OS calls.
linux
Linux collectors using procfs and native operating-system interfaces.
memory
Physical memory and swap counters.
network
Allocation-free network counter model and Linux record parsing.
parse
Allocation-free procfs parsers. These also compile on non-Linux, no_std targets.
process
Process identity and cumulative counters.
sampling
Caller-driven scheduling. No background thread, sleep, or hidden refresh.
snapshot
Shared snapshot types and sampling metadata.