sys_metrics

crates.io Docs.rs AGPL License CI

sys_metrics is a WIP project intended to give an alternative to others tools which can be slower or provide too many useless informations. It will try to have at least the same functionality as psutil or heim.

It's a synchronous library which try to be freaking fast (maybe even the fastest) and as dependency-free as possible.

WIP Notes

sys_metrics in it's WIP stage will only support Linux and macOS. The structure is subject to change from version to version. If you have a comment about it or anything else feel free to open an issue.

Usage

Add the dependency to your Cargo.toml toml [dependencies] sys_metrics = "0.2" Example of usage: main.rs ```rust use sys_metrics::{cpu::, disks::, host::, memory::, network::*};

fn main() { dbg!(getcpulogicalcount()); dbg!(getcpufreq()); dbg!(getcpustats()); dbg!(getcputimes()); dbg!(getloadavg()); dbg!(getphysicalioblocks()); dbg!(getpartitionsphysical()); dbg!(gethostinfo()); dbg!(gethostname()); dbg!(getosversion()); dbg!(getloggedusers()); dbg!(getusers()); dbg!(getuuid()); dbg!(getmemory()); dbg!(getswap()); dbg!(hasswap()); dbg!(getphysicalionets()); } ``` For a more complexe example, check speculare-client/src/harvest/dataharvest.rs.

Benchmarks

bash ➜ cargo bench

For reference you can check https://perf-ci.speculare.cloud for comparaison across commits (enabled since #ba799da3).

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.