Skip to main content

ProcessSnapshot

Struct ProcessSnapshot 

Source
pub struct ProcessSnapshot {
Show 14 fields pub identity: ProcessIdentity, pub parent_pid: Option<u32>, pub name: Box<str>, pub command: Box<str>, pub exe: Option<Box<str>>, pub user: MetricState<UserIdentity>, pub state: ProcessState, pub cpu: MetricState<Percent>, pub memory: ProcessMemory, pub io: ProcessIo, pub threads: MetricState<u32>, pub age: MetricState<Duration>, pub started_at: MetricState<SystemTime>, pub is_kernel_thread: bool,
}
Expand description

The cheap per-process fields collected on every fast tick.

Fields§

§identity: ProcessIdentity

Stable identity, safe to pin and to attach to a pending signal.

§parent_pid: Option<u32>

Parent PID.

A bare PID rather than a ProcessIdentity because the parent’s start key is not available from the same read; tree construction resolves it against the rest of the snapshot.

§name: Box<str>

Short process name, as the kernel reports it.

§command: Box<str>

Full command line, arguments joined by single spaces.

Stored pre-joined to avoid a Vec<String> per process per tick. May be empty for kernel threads or another user’s process, and §14.2 requires it to be redacted from logs because arguments can contain secrets.

§exe: Option<Box<str>>

Executable path, where readable.

§user: MetricState<UserIdentity>

Owning user.

§state: ProcessState

Scheduling state.

§cpu: MetricState<Percent>

CPU usage, core-normalized. May exceed 100% (§8.3).

§memory: ProcessMemory

Memory figures.

§io: ProcessIo

Disk I/O.

§threads: MetricState<u32>

Thread count, where reported.

§age: MetricState<Duration>

Time since the process started.

§started_at: MetricState<SystemTime>

Wall-clock start time, for the confirmation dialog (§6.2).

§is_kernel_thread: bool

Whether this is a kernel thread, which §7.2 allows hiding on Linux.

Implementations§

Source§

impl ProcessSnapshot

Source

pub fn command_or_name(&self) -> &str

The command line if non-empty, otherwise the process name.

Kernel threads and processes belonging to other users report no command line; showing an empty cell would look like a collection bug.

Source

pub fn redacted_command(&self) -> &str

The command line with arguments removed, keeping only argv[0].

§15.2 requires JSON export to be able to redact arguments by default, and §14.2 requires the same for logs.

Trait Implementations§

Source§

impl Clone for ProcessSnapshot

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProcessSnapshot

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ProcessSnapshot

Source§

fn eq(&self, other: &ProcessSnapshot) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ProcessSnapshot

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.