summaryrefslogtreecommitdiffstats
path: root/src/data_collection/disks/io_counters.rs
blob: 2b07fa5d64b6b5bb3d67ded5f5be8db659aa104e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use std::ffi::OsStr;

#[derive(Debug, Default)]
pub struct IoCounters {
    name: String,
    read_bytes: u64,
    write_bytes: u64,
}

impl IoCounters {
    pub fn new(name: String, read_bytes: u64, write_bytes: u64) -> Self {
        Self {
            name,
            read_bytes,
            write_bytes,
        }
    }

    pub(crate) fn device_name(&self) -> &OsStr {
        OsStr::new(&self.name)
    }

    pub(crate) fn read_bytes(&self) -> u64 {
        self.read_bytes
    }

    pub(crate) fn write_bytes(&self) -> u64 {
        self.write_bytes
    }
}