| 1 | use std::ffi::OsStr; |
| 2 | |
| 3 | #[derive(Debug, Default)] |
| 4 | pub struct IoCounters { |
| 5 | name: String, |
| 6 | read_bytes: u64, |
| 7 | write_bytes: u64, |
| 8 | } |
| 9 | |
| 10 | impl IoCounters { |
| 11 | pub fn new(name: String, read_bytes: u64, write_bytes: u64) -> Self { |
| 12 | Self { |
| 13 | name, |
| 14 | read_bytes, |
| 15 | write_bytes, |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | pub(crate) fn device_name(&self) -> &OsStr { |
| 20 | OsStr::new(&self.name) |
| 21 | } |
| 22 | |
| 23 | pub(crate) fn read_bytes(&self) -> u64 { |
| 24 | self.read_bytes |
| 25 | } |
| 26 | |
| 27 | pub(crate) fn write_bytes(&self) -> u64 { |
| 28 | self.write_bytes |
| 29 | } |
| 30 | } |