#[non_exhaustive]pub enum DerivedValue {
Scalar(f64),
}Expand description
Output value of a derived metric.
Derived metrics carry an f64 scalar. The f64 carrier is
chosen because the value range varies across derivations:
[0, 1]ratios:cpu_efficiency,affine_success_ratio,involuntary_csw_ratio.[0, ∞)ratios:disk_io_fraction(readahead can pull more block-device bytes than the syscall requested, so the ratio exceeds 1.0 in practice).[0, ∞)per-event means:avg_wait_ns,avg_slice_ns,avg_iowait_ns— sum over count, both non-negative.(-∞, ∞)signed differences:live_heap_estimate=allocated_bytes - deallocated_bytescan go negative when the deallocation total exceeds the allocation total (a freelist drains memory allocated before capture began, or the per-thread TSD counters were sampled mid-update on a thread that has just released a large arena).
All four shapes flow through the same f64 carrier. The
per-derivation auto-scale ladder lives on
DerivedMetricDef::ladder (not on the value type) so the
renderer picks the right magnitude (ns / Bytes / unitless)
per row regardless of whether the value is positive, zero,
negative, fractional, or in the millions. The is_ratio
flag on DerivedMetricDef toggles between the auto-scaled
path (e.g. 1.500ms, 7.500GiB) and the raw three-decimal
path (0.873 for ratios).
Sign preservation: the auto_scale step uses abs() for
the threshold check but propagates the original signed value
through the scaled output, and format_derived_value_cell
/ format_derived_delta_cell both render with {value:.2}
or {value:.3} formatters that preserve the explicit - for
negatives. The auto_scale_preserves_sign_on_negative_input
regression test pins this for the Bytes and ns ladders.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Scalar(f64)
Floating-point value. Render via the
DerivedMetricDef::ladder + DerivedMetricDef::is_ratio
pair: ratios format with three decimals (0.873,
+0.100); ladder-bearing values
(ScaleLadder::Ns / ScaleLadder::Bytes / etc.)
route through the same auto-scale ladders the main table
uses.
Implementations§
Trait Implementations§
Source§impl Clone for DerivedValue
impl Clone for DerivedValue
Source§fn clone(&self) -> DerivedValue
fn clone(&self) -> DerivedValue
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DerivedValue
impl Debug for DerivedValue
Source§impl PartialEq for DerivedValue
impl PartialEq for DerivedValue
impl Copy for DerivedValue
impl StructuralPartialEq for DerivedValue
Auto Trait Implementations§
impl Freeze for DerivedValue
impl RefUnwindSafe for DerivedValue
impl Send for DerivedValue
impl Sync for DerivedValue
impl Unpin for DerivedValue
impl UnwindSafe for DerivedValue
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<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