pub struct ProcessSnapshot {
pub timestamp: u64,
pub processes: Vec<ProcessInfo>,
pub summary: ProcessSummary,
}Expand description
Process list snapshot at a point in time.
Contains the raw process list, a computed summary, and a timestamp.
Fields§
§timestamp: u64Unix timestamp (seconds) when the snapshot was taken.
processes: Vec<ProcessInfo>Individual process records parsed from ps aux.
summary: ProcessSummaryAggregated summary statistics.
Implementations§
Source§impl ProcessSnapshot
impl ProcessSnapshot
Sourcepub fn capture() -> Self
pub fn capture() -> Self
Captures a full process snapshot via ps aux.
Results are cached for 30 seconds to avoid re-parsing ps aux on
repeated calls within the same execution window.
Sourcepub fn clear_cache()
pub fn clear_cache()
Clears the process snapshot cache.
Use before capturing an after-kill snapshot to ensure fresh data.
Sourcepub fn top_by_cpu(&self, n: usize) -> Vec<&ProcessInfo>
pub fn top_by_cpu(&self, n: usize) -> Vec<&ProcessInfo>
Returns the top n processes by CPU usage.
Sourcepub fn top_by_mem(&self, n: usize) -> Vec<&ProcessInfo>
pub fn top_by_mem(&self, n: usize) -> Vec<&ProcessInfo>
Returns the top n processes by memory usage.
Sourcepub fn print_report(&self)
pub fn print_report(&self)
Prints a human-readable process report to stdout.
Trait Implementations§
Source§impl Clone for ProcessSnapshot
impl Clone for ProcessSnapshot
Source§fn clone(&self) -> ProcessSnapshot
fn clone(&self) -> ProcessSnapshot
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ProcessSnapshot
impl Debug for ProcessSnapshot
Source§impl<'de> Deserialize<'de> for ProcessSnapshot
impl<'de> Deserialize<'de> for ProcessSnapshot
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ProcessSnapshot
impl RefUnwindSafe for ProcessSnapshot
impl Send for ProcessSnapshot
impl Sync for ProcessSnapshot
impl Unpin for ProcessSnapshot
impl UnsafeUnpin for ProcessSnapshot
impl UnwindSafe for ProcessSnapshot
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