pub struct SystemMonitor { /* private fields */ }Expand description
System resource monitor
Efficiently tracks process-specific metrics using sysinfo.
Call update() periodically (e.g., every TUI frame) to refresh stats.
Implementations§
Source§impl SystemMonitor
impl SystemMonitor
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new system monitor for the current process
§Panics
Panics if sysinfo cannot determine the current process ID.
Sourcepub fn update(&mut self) -> SystemStats
pub fn update(&mut self) -> SystemStats
Update and retrieve current system stats
Should be called at regular intervals (e.g., TUI update rate of ~4Hz). First call may return zero for CPU usage - sysinfo needs 2+ samples.
Sourcepub fn current(&self) -> SystemStats
pub fn current(&self) -> SystemStats
Get current stats without refreshing
Returns the last refreshed stats. Useful if you just called update().
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SystemMonitor
impl RefUnwindSafe for SystemMonitor
impl Send for SystemMonitor
impl Sync for SystemMonitor
impl Unpin for SystemMonitor
impl UnsafeUnpin for SystemMonitor
impl UnwindSafe for SystemMonitor
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more