Crate kstat[][src]


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.


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 ="failed to read kstats");
    println!("{:#?}", stats);



The type of data found in named-value pairs of a kstat



The corresponding data read in from a kstat


KstatReader represents all of the kstats that matched the fields of interest when created with KstatCtl.reader(...)