pub fn io() -> Result<ProcessIo>Expand description
How much this process has read from and written to storage, for a
database’s own write amplification or a backup tool’s throughput. Two
readings subtract; Rate::per turns the difference
into a rate.
use std::time::Duration;
use sys_lib::{self as sys, Rate};
let before = sys::process::io()?;
// ... work ...
let d = sys::process::io()? - before;
println!("wrote {} ({})", d.written, Rate::per(d.written, Duration::from_secs(1)));§Errors
NotFound or PermissionDenied when /proc/self/io is hidden; Os.