Skip to main content

WalkAttribution

Struct WalkAttribution 

Source
pub struct WalkAttribution {
    pub wall_ns: u64,
    pub work_ns: u64,
    pub starved_ns: u64,
    pub lock_wait_ns: u64,
    pub send_ns: u64,
    pub claims: u64,
    pub lock_ops: u64,
    pub lock_contended: u64,
}
Expand description

Where a walk’s time went, so “blocked” is never one undifferentiated number.

The performance loop’s standing question is whether a walk is bound by disk I/O, by CPU, or by coordination, and process-level counters cannot answer it: user and system time say how much CPU was burned, but a fused “blocked” number cannot say whether workers were waiting on the filesystem, on the queue lock, or on nothing at all because the queue was empty. These counters split that out at the source.

Everything is measured in chunks, never per file: one timing pair per claimed run of directories, per contended lock, per batch handoff. On the 60k-entry reference tree that is a few thousand Instant reads against hundreds of milliseconds of walking — the instrumentation follows the same amortization rule it exists to verify.

In a parallel walk the fields sum over workers, so wall_ns is worker-seconds (it can exceed the scan’s wall clock) and every other duration is a disjoint slice of it: work_ns + starved_ns + lock_wait_ns + send_ns <= wall_ns, with the remainder being uninstrumented odds and ends (uncontended lock ops, loop bookkeeping). A serial walk fills only wall_ns, work_ns, and send_ns — there is no coordination to attribute.

Fields§

§wall_ns: u64

Total time workers spent in the walk loop, summed across workers.

§work_ns: u64

Reading directories and stating entries — the real work, syscalls plus the compute between them. Separating disk from CPU within this span needs the process-level user/system counters alongside; per-syscall timing would break the chunk-amortization rule.

§starved_ns: u64

Waiting on the queue’s condvar because no work was available. Starvation: either the frontier is momentarily narrower than the worker pool, or the walk is ending.

§lock_wait_ns: u64

Waiting to acquire the queue lock when another worker held it. This is the contention the shared-queue design bets stays negligible; now it is measured instead of argued.

§send_ns: u64

Handing observation batches to the consumer: the channel send in a parallel walk, the inline sink call — which is the consumer actually running — in a serial one.

§claims: u64

Chunks of directories claimed from the queue.

§lock_ops: u64

Queue lock acquisitions, contended or not.

§lock_contended: u64

Lock acquisitions that found the lock already held.

Implementations§

Source§

impl WalkAttribution

Source

pub fn accounted_ns(&self) -> u64

Time attributed to a named cause, as opposed to wall_ns’s total.

Trait Implementations§

Source§

impl Clone for WalkAttribution

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 Copy for WalkAttribution

Source§

impl Debug for WalkAttribution

Source§

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

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

impl Default for WalkAttribution

Source§

fn default() -> Self

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

impl Eq for WalkAttribution

Source§

impl PartialEq for WalkAttribution

Source§

fn eq(&self, other: &Self) -> 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 WalkAttribution

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

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.