heim_process/os/linux/
memory.rs

1use heim_common::units::Information;
2
3/// Linux-specific extension to process [Memory] information.
4///
5/// [Memory]: ../../struct.Memory.html
6pub trait MemoryExt {
7    /// Returns the amount of memory that could be potentially shared with other processes.
8    fn shared(&self) -> Information;
9
10    /// Returns TRS (*text resident set*) - the amount of memory devoted to executable code.
11    fn text(&self) -> Information;
12
13    /// Returns DRS (*data resident set*) - the amount of physical memory
14    /// devoted to other than executable code.
15    fn data(&self) -> Information;
16}
17
18#[cfg(target_os = "linux")]
19impl MemoryExt for crate::Memory {
20    fn shared(&self) -> Information {
21        self.as_ref().shared()
22    }
23
24    fn text(&self) -> Information {
25        self.as_ref().text()
26    }
27
28    fn data(&self) -> Information {
29        self.as_ref().data()
30    }
31}