/// Get various virtual memory statistics
///
/// Since the exact set of statistics will vary from kernel to kernel,
/// and because most of them are not well documented, this function
/// returns a HashMap instead of a struct.  Consult the kernel source
/// code for more details of this data.
///
/// This data is taken from the `/proc/vmstat` file.
///
/// (since Linux 2.6.0)
Get various virtual memory statistics
Since the exact set of statistics will vary from kernel to kernel,
and because most of them are not well documented, this function
returns a HashMap instead of a struct.  Consult the kernel source
code for more details of this data.

This data is taken from the `/proc/vmstat` file.


Get various virtual memory statistics Since the exact set of statistics will vary from kernel to kernel and because most of them are not well documented this function returns a HashMap instead of a struct . Consult the kernel source code for more details of this data . This data is taken from the ` / proc / vmstat ` file .
pub fn vmstat() -> ProcResult<HashMap<String, i64>> {
    let file = FileWrapper::open("/proc/vmstat")?;
    let reader = BufReader::new(file);
    let mut map = HashMap::new();
    for line in reader.lines() {
        let line = line?;
        let mut split = line.split_whitespace();
        let name = expect!(split.next());
        let val = from_str!(i64, expect!(split.next()));
        map.insert(name.to_owned(), val);
    }
    Ok(map)
}
pub fn vmstat ( ) -> ProcResult < HashMap < String , i64 > > { let file = FileWrapper :: open ( " " ) ? ; let reader = BufReader :: new ( file ) ; let mut map = HashMap :: new ( ) ; for line in reader . lines ( ) { let line = line ? ; let mut split = line . split_whitespace ( ) ; let name = expect ! ( split next ( ) ) ; let val = from_str ! ( i64 expect ( split next ( ) ) ) ; map . insert ( name . to_owned ( ) , val ) ; } Ok ( map ) }
Get various virtual memory statistics
Since the exact set of statistics will vary from kernel to kernel,
and because most of them are not well documented, this function
returns a HashMap instead of a struct.
Get various virtual memory statistics Since the exact set of statistics will vary from kernel to kernel and because most of them are not well documented this function returns a HashMap instead of a struct .