pub struct ProcfsSensor { /* private fields */ }Expand description
Sensor that reads a value from a /proc filesystem file by parsing
a key-value format.
Common uses:
/proc/loadavg— CPU load average (first field)/proc/meminfo—MemAvailable:/MemTotal:for memory pressure/proc/stat— CPU time slices
Implementations§
Source§impl ProcfsSensor
impl ProcfsSensor
Sourcepub fn new(
id: impl Into<String>,
kind: SensorKind,
path: impl Into<String>,
parser: SensorParser,
) -> Self
pub fn new( id: impl Into<String>, kind: SensorKind, path: impl Into<String>, parser: SensorParser, ) -> Self
Create a new procfs sensor with a custom parser.
Sourcepub fn mem_pressure() -> Self
pub fn mem_pressure() -> Self
Create a memory pressure sensor from /proc/meminfo.
Returns 1.0 - (MemAvailable / MemTotal), clamped to [0, 1].
Trait Implementations§
Source§impl Debug for ProcfsSensor
impl Debug for ProcfsSensor
Source§impl SensorDevice for ProcfsSensor
impl SensorDevice for ProcfsSensor
Auto Trait Implementations§
impl !RefUnwindSafe for ProcfsSensor
impl !UnwindSafe for ProcfsSensor
impl Freeze for ProcfsSensor
impl Send for ProcfsSensor
impl Sync for ProcfsSensor
impl Unpin for ProcfsSensor
impl UnsafeUnpin for ProcfsSensor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more