#[repr(transparent)]pub struct PeakBytes(pub u64);Expand description
Lifetime high-water mark, bytes. Same Maxable-only contract
as PeakNs but Bytes-typed so the renderer routes through
the IEC binary auto-scale ladder
(B → KiB → MiB → GiB → TiB) instead of the ns ladder.
The kernel’s taskstats interface (/proc/<tid>/stat does NOT
expose these — they require the genetlink TASKSTATS_CMD_GET
path; see crate::taskstats::TaskstatsClient) carries
hiwater_rss and hiwater_vm as KB-truncated lifetime
watermarks. The capture pipeline multiplies by 1024 at the
boundary so the wire-format value is in bytes, matching the
existing Bytes newtype unit.
§Cross-thread vs cross-snapshot semantics
Sibling threads of the same tgid see the same value:
xacct_add_tsk (kernel/tsacct.c::xacct_add_tsk, lines 99-104)
fills hiwater_rss and hiwater_vm from
get_mm_hiwater_rss(mm) / get_mm_hiwater_vm(mm) — both read
from the shared mm_struct, so every thread of a given tgid
reports the same lifetime watermark. A Max reduction across
sibling threads of the same process is therefore a no-op on
the watermark itself; the meaningful Max is the one across
DIFFERENT processes, where each tgid carries its own
mm_struct and an independent watermark history. Use Max
expecting “the biggest process’s watermark in the bucket”,
not “the worst-behaving thread of any process”.
Kernel threads (mm == NULL) report zero: the same
xacct_add_tsk path guards the assignments behind
if (mm) (line 100), so kernel threads (PF_KTHREAD) leave
the field at the kernel-side zero.
In COMPARE mode the per-thread PeakBytes 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 WATERMARK GREW
during the (capture-A, capture-B) interval, NOT the
allocation size during that interval. A new allocation only
moves the watermark if its peak RSS exceeds the prior
lifetime maximum; an interval full of small allocations that
stayed under peak_before shows a zero delta.
Summing watermarks across threads is a category error — does
not implement Summable. Implements Maxable.
§u64 backing
Bytes are non-negative by definition; the kernel-side
__u64 hiwater_rss / __u64 hiwater_vm in struct taskstats
(include/uapi/linux/taskstats.h) are u64 KB counts, and the
post-multiply byte count fits comfortably in u64 across any
realistic per-process memory footprint.
Tuple Fields§
§0: u64Trait Implementations§
Source§impl<'de> Deserialize<'de> for PeakBytes
impl<'de> Deserialize<'de> for PeakBytes
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 PeakBytes
impl Maxable for PeakBytes
fn max_across(items: impl IntoIterator<Item = Self>) -> Option<Self>
Source§impl Ord for PeakBytes
impl Ord for PeakBytes
Source§impl PartialOrd for PeakBytes
impl PartialOrd for PeakBytes
impl Copy for PeakBytes
impl Eq for PeakBytes
impl StructuralPartialEq for PeakBytes
Auto Trait Implementations§
impl Freeze for PeakBytes
impl RefUnwindSafe for PeakBytes
impl Send for PeakBytes
impl Sync for PeakBytes
impl Unpin for PeakBytes
impl UnwindSafe for PeakBytes
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