pub struct ProcStatus { /* private fields */ }
Expand description
A snapshot of the status of a process
It’s stored in a string to ensure consistency and can be kept around and compared.
Implementations§
Source§impl ProcStatus
impl ProcStatus
Sourcepub fn read() -> Result<Self, ProcStatusError>
pub fn read() -> Result<Self, ProcStatusError>
read the proc status info of the current process.
It’s the same than ProcStatus::read(ProcRef::ProcSelf)
Sourcepub fn read_for(proc_ref: ProcRef) -> Result<Self, ProcStatusError>
pub fn read_for(proc_ref: ProcRef) -> Result<Self, ProcStatusError>
read the proc status info of a process.
Sourcepub fn entries(&self) -> ProcEntries<'_> ⓘ
pub fn entries(&self) -> ProcEntries<'_> ⓘ
return an iterator over all key:value entries
Sourcepub fn value(&self, key: &str) -> Result<&str, ProcStatusError>
pub fn value(&self, key: &str) -> Result<&str, ProcStatusError>
return the value of an entry found by key
Example:
println!(
"current process name: {:?}",
proc_status::ProcStatus::read().unwrap().value("Name").unwrap(),
);
Be careful that the values written as “xxx kB” are in KiB, not kB, and are written this way for compatibility.
Sourcepub fn value_KiB(&self, key: &str) -> Result<usize, ProcStatusError>
pub fn value_KiB(&self, key: &str) -> Result<usize, ProcStatusError>
return the value of a memory related entry in KiB
Sourcepub fn mem_usage(&self) -> Result<MemUsage, ProcStatusError>
pub fn mem_usage(&self) -> Result<MemUsage, ProcStatusError>
return the current and peak ram usage of the process
Auto Trait Implementations§
impl Freeze for ProcStatus
impl RefUnwindSafe for ProcStatus
impl Send for ProcStatus
impl Sync for ProcStatus
impl Unpin for ProcStatus
impl UnwindSafe for ProcStatus
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