Function mprober_lib::volume::get_volumes_with_speed [−][src]
pub fn get_volumes_with_speed(
interval: Duration
) -> Result<Vec<(Volume, VolumeSpeed)>, ScannerError>
Get volume information by reading the /proc/diskstats
file and using the statvfs
function in libc. And measure the speed within a specific time interval.
extern crate mprober_lib; use std::time::Duration; use mprober_lib::volume; let volumes_with_speed = volume::get_volumes_with_speed(Duration::from_millis(100)).unwrap(); for (volume, volume_with_speed) in volumes_with_speed { println!("{}: ", volume.device); println!(" Read: {:.1} B/s", volume_with_speed.read); println!(" Write: {:.1} B/s", volume_with_speed.write); }