#[repr(transparent)]pub struct PeakNs(pub u64);Expand description
Lifetime high-water mark, nanoseconds. The kernel updates
these as a max-against-prior in update_stats_* /
update_se / set_next_entity paths
(kernel/sched/stats.c, kernel/sched/fair.c); the value
at any procfs read is the largest single window the thread
has accumulated since its birth. Group reduction takes max
across contributors so the rendered cell surfaces the worst
single window any thread experienced over its lifetime.
§Cross-thread vs cross-snapshot semantics
The Max reduction over a bucket of threads produces the
worst single window observed across DIFFERENT tasks — task
A’s wait_max and task B’s wait_max measure two distinct
scheduling histories, and the bucket-level max picks
whichever task experienced the worst case. The result
belongs to that one worst task, not to the bucket as a
whole; downstream consumers should read the rendered cell
as “this bucket contained at least one task that saw N ns
of wait” rather than “all tasks in this bucket saw at most
N ns of wait” (which is the same shape, but a much weaker
statement).
In COMPARE mode the per-thread PeakNs delta between two
snapshots is peak_after - peak_before — the kernel only
ever raises the field, so the delta is non-negative and
represents the AMOUNT BY WHICH THE LIFETIME HIGH-WATER LINE
ROSE during the (capture-A, capture-B) interval, NOT the
magnitude of the worst event in that interval. A new
scheduling window inside the interval only moves the
high-water line if its own magnitude exceeds every prior
window the task had ever experienced; if every interval
event was strictly smaller than peak_before, the delta is
zero even though events did occur. The delta is therefore
not itself a PeakNs in the same sense as the lifetime
reading — it is a difference of high-water marks. The
bucket reduction takes max over those deltas, surfacing the
worst rise across contributors during the interval; this
can dramatically under-report transient bad windows that
happened earlier in any contributor’s lifetime.
Summing peaks across threads is a category error — does not
implement Summable. Implements Maxable.
Examples: wait_max, sleep_max, block_max, exec_max,
slice_max.
§u64 backing vs kernel s64
Of the *_max schedstat fields, only exec_max is typed
s64 in struct sched_statistics
(include/linux/sched.h); wait_max, sleep_max,
block_max, and slice_max are u64. The capture pipeline
parses every dotted-ms.ns value via parsed_ns_from_dotted
in crate::ctprof, which returns Err(ParseDottedNs::Negative)
on negative dotted values; the parse_sched closure maps that
to None, and the capture-site unwrap_or(0) then collapses
None to zero before the wrapper is constructed. The u64
backing here is therefore safe even for exec_max because
the parser path guarantees non-negative input — NOT because
every kernel-side field promises non-negative. Any new
writer that bypasses parsed_ns_from_dotted must replicate
its non-negative guard.
Tuple Fields§
§0: u64Trait Implementations§
Source§impl<'de> Deserialize<'de> for PeakNs
impl<'de> Deserialize<'de> for PeakNs
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Maxable for PeakNs
impl Maxable for PeakNs
fn max_across(items: impl IntoIterator<Item = Self>) -> Option<Self>
Source§impl Ord for PeakNs
impl Ord for PeakNs
Source§impl PartialOrd for PeakNs
impl PartialOrd for PeakNs
impl Copy for PeakNs
impl Eq for PeakNs
impl StructuralPartialEq for PeakNs
Auto Trait Implementations§
impl Freeze for PeakNs
impl RefUnwindSafe for PeakNs
impl Send for PeakNs
impl Sync for PeakNs
impl Unpin for PeakNs
impl UnwindSafe for PeakNs
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more