Skip to main content

ProcessTable

Struct ProcessTable 

Source
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

Source

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.

Source

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.

Source

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.

Source

pub fn is_narrowed(&self) -> bool

Whether this table examined only part of the host’s processes.

Source

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.

Source

pub fn process(&self, pid: u32) -> Option<&ProcessMember>

Source

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.

Source

pub fn observed_at_ms(&self) -> u64

Wall-clock boundary before enumeration, for conservative birth checks.

Source

pub fn birth_baseline(&self) -> BirthBaseline

Capture a reusable birth cutoff in this walk’s clock domain (Linux boot-relative start ticks, otherwise wall-clock epoch milliseconds).

Source

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.

Source

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.

Source

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.

Source

pub fn tree_identities( &self, pid: u32, start_time: u64, include_session: bool, ) -> Option<BTreeSet<(u32, u64)>>

Structural ownership does not depend on readable resource counters. Unknown identities still refuse the result, rather than hiding overlap.

Source

pub fn sum(members: Vec<ProcessMember>) -> Option<TreeUsage>

Sum distinct members, returning at most eight groups by descending memory.

Trait Implementations§

Source§

impl Clone for ProcessTable

Source§

fn clone(&self) -> Self

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 ProcessTable

Source§

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

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

impl Default for ProcessTable

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Forget for ProcessTable

§

impl Freeze for ProcessTable
where *const LeafNode<u32, ProcessMember> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(u32, ProcessMember)>>: Freeze, *const LeafNode<u32, (Option<u32>, Option<u32>)> is !null: Freeze, PhantomData<Box<(u32, (Option<u32>, Option<u32>))>>: Freeze, *const ArcInner<Focus> is !null: Freeze, PhantomData<ArcInner<Focus>>: Freeze,

§

impl Move for ProcessTable

§

impl RefUnwindSafe for ProcessTable

§

impl Send for ProcessTable
where NodeRef<Owned, u32, ProcessMember, LeafOrInternal>: Send, BoxRaw<(u32, ProcessMember)>: Send, NodeRef<Owned, u32, (Option<u32>, Option<u32>), LeafOrInternal>: Send, BoxRaw<(u32, (Option<u32>, Option<u32>))>: Send, Arc<Focus>: Send,

§

impl Sync for ProcessTable
where NodeRef<Owned, u32, ProcessMember, LeafOrInternal>: Sync, BoxRaw<(u32, ProcessMember)>: Sync, NodeRef<Owned, u32, (Option<u32>, Option<u32>), LeafOrInternal>: Sync, BoxRaw<(u32, (Option<u32>, Option<u32>))>: Sync, Arc<Focus>: Sync,

§

impl Unpin for ProcessTable
where *const LeafNode<u32, ProcessMember> is !null: Unpin, Box<(u32, ProcessMember)>: Unpin, *const LeafNode<u32, (Option<u32>, Option<u32>)> is !null: Unpin, Box<(u32, (Option<u32>, Option<u32>))>: Unpin, Arc<Focus>: Unpin,

§

impl UnsafeUnpin for ProcessTable
where *const LeafNode<u32, ProcessMember> is !null: UnsafeUnpin, PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin, PhantomData<Box<(u32, ProcessMember)>>: UnsafeUnpin, *const LeafNode<u32, (Option<u32>, Option<u32>)> is !null: UnsafeUnpin, PhantomData<Box<(u32, (Option<u32>, Option<u32>))>>: UnsafeUnpin, *const ArcInner<Focus> is !null: UnsafeUnpin, PhantomData<ArcInner<Focus>>: UnsafeUnpin,

§

impl UnwindSafe for ProcessTable

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.