#[repr(transparent)]pub struct MonotonicNs(pub u64);Expand description
Cumulative-time counter, nanoseconds, accumulated by the
kernel from thread birth. Same temporal-window shape as
MonotonicCount but tagged for the ns auto-scale ladder
(ns → µs → ms → s).
Examples: run_time_ns, wait_time_ns, wait_sum,
voluntary_sleep_ns, block_sum, iowait_sum,
core_forceidle_sum.
Cross-field ratios (e.g.
run_time_ns / (run_time_ns + wait_time_ns)) are valid
because every MonotonicNs field on
crate::ctprof::ThreadState is integrated over the
same thread-lifetime window.
§u64 backing vs kernel s64
Some kernel sources for these values are typed s64 —
sum_sleep_runtime and sum_block_runtime live in
struct sched_statistics (include/linux/sched.h) as
s64. The capture pipeline parses these 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 because the parser path guarantees non-negative input
— NOT because the kernel field type promises non-negative.
Any new writer that bypasses parsed_ns_from_dotted must
replicate its non-negative guard. A future capture-side
change that exposes raw kernel s64 directly would need a
sentinel-aware wrapper or a dedicated SignedNs newtype.
Tuple Fields§
§0: u64Trait Implementations§
Source§impl Clone for MonotonicNs
impl Clone for MonotonicNs
Source§fn clone(&self) -> MonotonicNs
fn clone(&self) -> MonotonicNs
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MonotonicNs
impl Debug for MonotonicNs
Source§impl Default for MonotonicNs
impl Default for MonotonicNs
Source§fn default() -> MonotonicNs
fn default() -> MonotonicNs
Source§impl<'de> Deserialize<'de> for MonotonicNs
impl<'de> Deserialize<'de> for MonotonicNs
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 Display for MonotonicNs
impl Display for MonotonicNs
Source§impl From<MonotonicNs> for u64
impl From<MonotonicNs> for u64
Source§fn from(v: MonotonicNs) -> Self
fn from(v: MonotonicNs) -> Self
Source§impl From<u64> for MonotonicNs
impl From<u64> for MonotonicNs
Source§impl Hash for MonotonicNs
impl Hash for MonotonicNs
Source§impl Ord for MonotonicNs
impl Ord for MonotonicNs
Source§fn cmp(&self, other: &MonotonicNs) -> Ordering
fn cmp(&self, other: &MonotonicNs) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for MonotonicNs
impl PartialEq for MonotonicNs
Source§impl PartialOrd for MonotonicNs
impl PartialOrd for MonotonicNs
Source§impl Serialize for MonotonicNs
impl Serialize for MonotonicNs
Source§impl Summable for MonotonicNs
impl Summable for MonotonicNs
Source§fn sum_across(items: impl IntoIterator<Item = Self>) -> Self
fn sum_across(items: impl IntoIterator<Item = Self>) -> Self
u64::MAX.
Empty input collapses to the additive identity (zero).Source§fn try_sum_across(items: impl IntoIterator<Item = Self>) -> Option<Self>
fn try_sum_across(items: impl IntoIterator<Item = Self>) -> Option<Self>
sum_across on every
non-empty input; returns None for an empty iterator so
callers can distinguish “no contributors” from “all
contributors summed to zero.” Useful when a downstream
derived metric (e.g. a ratio) needs to suppress the
row entirely rather than render 0 / 0. Read moreimpl Copy for MonotonicNs
impl Eq for MonotonicNs
impl StructuralPartialEq for MonotonicNs
Auto Trait Implementations§
impl Freeze for MonotonicNs
impl RefUnwindSafe for MonotonicNs
impl Send for MonotonicNs
impl Sync for MonotonicNs
impl Unpin for MonotonicNs
impl UnwindSafe for MonotonicNs
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