pub struct ProcessTable { /* private fields */ }Expand description
One process-table walk, reusable for any number of roots.
A table read with ProcessTable::read_for is narrowed: only the
processes its interest set can reach were examined, and Self::covers
says which pids it answers for exactly as a full walk would.
Implementations§
Source§impl ProcessTable
impl ProcessTable
Sourcepub fn read() -> Result<Self>
pub fn read() -> Result<Self>
Read all visible processes once. Unreadable identities are retained as uncertainty, so a related tree cannot silently become a partial sum.
Sourcepub fn read_for(interest: &BTreeSet<u32>) -> Result<Self>
pub fn read_for(interest: &BTreeSet<u32>) -> Result<Self>
Read only what interest can reach, answering exactly as Self::read
would for every pid Self::covers accepts.
One listing supplies every process’s parent and start. The per-process reads (identity, session, resources and the exit fence) then cover only: the interest pids; every listed process whose session is led by an interest pid, or whose session or parent is unknown; all their descendants; and every ancestor of all of those. That is every process a tree rooted at an interest pid can select or be made uncertain by, with or without its session, and every parent an ancestry walk from a covered process can visit. Windows reads the full table.
Sourcepub fn covers(&self, pid: u32) -> bool
pub fn covers(&self, pid: u32) -> bool
Whether queries about pid match a full walk. Always true for a full
table; for a narrowed one, true for examined pids and for pids the
walk’s listing did not contain at all.
Sourcepub fn is_narrowed(&self) -> bool
pub fn is_narrowed(&self) -> bool
Whether this table examined only part of the host’s processes.
Sourcepub fn started_at(&self) -> Option<Instant>
pub fn started_at(&self) -> Option<Instant>
Start of the walk, so exit confirmations can distinguish a genuinely newer snapshot from a slow, earlier walk completing late.
pub fn process(&self, pid: u32) -> Option<&ProcessMember>
Sourcepub fn revision(&self) -> u64
pub fn revision(&self) -> u64
A process-local walk sequence, allocated before the walk starts. A slow old walk cannot overwrite a newer accounting observation that finished first.
Sourcepub fn observed_at_ms(&self) -> u64
pub fn observed_at_ms(&self) -> u64
Wall-clock boundary before enumeration, for conservative birth checks.
Sourcepub fn identity_alive(&self, pid: u32, start: u64) -> Option<bool>
pub fn identity_alive(&self, pid: u32, start: u64) -> Option<bool>
None means the PID was visible but its identity was unreadable, not that
the tracked process has exited. A different readable start identity is gone.
Sourcepub fn members(&self) -> impl Iterator<Item = &ProcessMember>
pub fn members(&self) -> impl Iterator<Item = &ProcessMember>
All identities successfully read in this walk, including resources that could not be read. Consumers must not interpret those resources as zero.
Sourcepub fn tree(
&self,
pid: u32,
start_time: u64,
include_session: bool,
) -> Option<TreeUsage>
pub fn tree( &self, pid: u32, start_time: u64, include_session: bool, ) -> Option<TreeUsage>
Resolve descendants, optionally including a command leader’s session. The root must still have the expected native kernel start identity.