1 unstable release
Uses old Rust 2015
0.1.0 | Aug 28, 2018 |
---|
#18 in #illumos
Used in 2 crates
21KB
434 lines
kstat
This rust library provides an ffi wrapper around the native illumos library.
Example
The following is equivalent to kstat -p -n zone_vfs
:
extern crate kstat;
use kstat::KstatReader;
fn main() {
let reader = KstatReader::new(None, None, None, Some("zone_vfs"))
.expect("failed to create kstat reader");
let stats = reader.read().expect("failed to read kstats");
println!("{:#?}", stats);
}
lib.rs
:
kstat
A simple rust crate that allows you to read kernel statistics via the kstat framework on
illumos. The kstat
crate exposes a KstatReader
type that tracks kstats that are of
interest to the consumer, allowing them to call the read
method on the type to read in all of
the named-value pairs associated with those particular kstats. This means that the crate only
allows the consumer to track/read kstats that are of type KSTAT_TYPE_NAMED or KSTAT_TYPE_IO.
Example:
extern crate kstat;
use kstat::KstatReader;
fn main() {
let reader = KstatReader::new(None, None, None, Some("zone_vfs"))
.expect("failed to create kstat reader");
let stats = reader.read().expect("failed to read kstats");
println!("{:#?}", stats);
}
Dependencies
~160KB