pub struct EnergyWindow {
pub window_s: f64,
pub samples: usize,
pub energy_j: f64,
pub mean_power_w: f64,
pub max_power_w: f64,
pub sw_power_cap_frac: Option<f64>,
pub hw_power_brake_frac: Option<f64>,
}Expand description
2026-09-26: The energy integral over one measured window.
Fields§
§window_s: f642026-09-26: Window length the joules span, seconds.
samples: usize2026-09-26: Readings the integral stood on.
energy_j: f642026-09-26: Σ P_i · dt_i: each reading held forward to the next, the
first back-filled to the window start, the last held to the window end,
so Σ dt_i is exactly window_s.
mean_power_w: f64§max_power_w: f64§sw_power_cap_frac: Option<f64>2026-09-26: Of the readings that reported the SW power cap flag, the
fraction (by count, not time) with it asserted; None when none reported it.
hw_power_brake_frac: Option<f64>2026-09-26: Same, for the HW power brake.
Implementations§
Source§impl EnergyWindow
impl EnergyWindow
Sourcepub fn above_idle_j(&self, idle: &EnergyWindow) -> f64
pub fn above_idle_j(&self, idle: &EnergyWindow) -> f64
2026-09-26: Joules above what the box would have drawn idle for the same
duration: energy_j − idle.mean_power_w × window_s. Negative when the
window drew less than the baseline; not clamped.
Sourcepub fn sum(windows: &[EnergyWindow]) -> Option<EnergyWindow>
pub fn sum(windows: &[EnergyWindow]) -> Option<EnergyWindow>
2026-09-26: Several windows as one: joules, seconds and samples add, the
mean is re-derived, the max is the largest max, and each flag fraction is
weighted by the sample counts of the windows that report it. None for
no windows.
Sourcepub fn metrics(
&self,
prefix: &str,
tokens: usize,
idle: Option<&EnergyWindow>,
m: &mut BTreeMap<String, f64>,
)
pub fn metrics( &self, prefix: &str, tokens: usize, idle: Option<&EnergyWindow>, m: &mut BTreeMap<String, f64>, )
2026-09-26: The record keys for one window, under prefix ("c{C}_" from
the concurrency sweep, "" from decode-floor). tokens is the caller’s
count of output tokens delivered inside this window; it is written beside
the joules, and J/token is derived from the pair.
Sourcepub fn one_line(&self, idle: Option<&EnergyWindow>) -> String
pub fn one_line(&self, idle: Option<&EnergyWindow>) -> String
2026-09-26: One log line: joules, seconds, mean and max watts, samples, above-idle joules when a baseline is given, the SW cap fraction, and the HW brake fraction when it is above zero.
Trait Implementations§
Source§impl Clone for EnergyWindow
impl Clone for EnergyWindow
Source§fn clone(&self) -> EnergyWindow
fn clone(&self) -> EnergyWindow
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EnergyWindow
impl Debug for EnergyWindow
Source§impl Default for EnergyWindow
impl Default for EnergyWindow
Source§fn default() -> EnergyWindow
fn default() -> EnergyWindow
Source§impl PartialEq for EnergyWindow
impl PartialEq for EnergyWindow
impl Copy for EnergyWindow
impl StructuralPartialEq for EnergyWindow
Auto Trait Implementations§
impl Freeze for EnergyWindow
impl RefUnwindSafe for EnergyWindow
impl Send for EnergyWindow
impl Sync for EnergyWindow
impl Unpin for EnergyWindow
impl UnwindSafe for EnergyWindow
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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