Telemetry

Struct Telemetry 

Source
pub struct Telemetry {
    pub device_read_errors: Gauge,
    pub energy_mj: Counter,
    pub energy_counter_raw: Gauge,
    pub energy_resets: Counter,
    pub energy_wraps: Counter,
    pub tokens: Counter,
    pub joules_per_token_live: GaugeF64,
    pub kernel: KernelInstruments,
    pub sched: SchedInstruments,
    pub spec: SpecMatrix,
    pub spec_confidence: ConfidenceOutcomes,
    pub requests: RequestInstruments,
    /* private fields */
}

Fields§

§device_read_errors: Gauge§energy_mj: Counter§energy_counter_raw: Gauge§energy_resets: Counter§energy_wraps: Counter§tokens: Counter§joules_per_token_live: GaugeF64§kernel: KernelInstruments§sched: SchedInstruments§spec: SpecMatrix§spec_confidence: ConfidenceOutcomes§requests: RequestInstruments

Implementations§

Source§

impl Telemetry

Source

pub const fn new(clock: &'static dyn Clock) -> Self

2026-09-26: A set at level Off over clock. Allocates nothing.

Source

pub fn configure(&self, cfg: &TelemetryConfig)

2026-09-26: Apply a validated configuration and disarm kernel spans. The energy ring is allocated here, on the first call at Basic or above, and never again.

Source

pub fn level(&self) -> Level

Source

pub fn set_phase_names(&self, names: &'static [&'static str])

2026-09-26: Name the loop phases phase indexes, keeping at most MAX_PHASES. The first call wins.

Source

pub fn phase_names(&self) -> &'static [&'static str]

Source

pub fn tokens(&self, n: u64)

2026-09-26: n more tokens were produced.

Source

pub fn phase(&self, idx: usize, since: Instant)

2026-09-26: Loop phase idx ran from since until now. An idx of MAX_PHASES or more lands in the last histogram.

Source

pub fn sched_tick(&self, shape: &SchedShape)

2026-09-26: This tick’s scheduler shape.

Source

pub fn stream_sync(&self)

Source

pub fn blocking_d2h(&self)

Source

pub fn graph_replay(&self)

Source

pub fn graph_capture(&self)

Source

pub fn spec_verified(&self, drafts: usize, accepted: usize)

2026-09-26: A verify step checked drafts drafts and accepted accepted.

Source

pub fn spec_draft_confidence(&self, lp: f32, accepted: bool)

2026-10-04: A verify step reached a draft whose drafter top-1 log-probability was lp, and accepted it or not.

Source

pub fn request_finished(&self, r: &RequestTiming)

2026-09-26: A request finished. Its energy is attributed from the ring window its lifetime spans, only while the device layer is available.

Source

pub fn step_begin(&self) -> bool

2026-09-26: A scheduler step begins. At level Kernel, arms per-kernel spans on one step in kernel_span_every and returns whether this step is armed; below Kernel, returns false and changes nothing.

Source

pub fn kernel_spans_armed(&self) -> bool

2026-09-26: Whether the kernel launch path should bracket launches this step. Set by step_begin, cleared by configure.

Source

pub fn lane_spans(&self) -> bool

2026-09-26: Whether lane spans are recorded (level Kernel).

Source

pub fn lane_names(&self) -> &'static [&'static str]

Source

pub fn device_state(&self) -> DeviceState

Source

pub fn device_unavailable_reason(&self) -> Option<&str>

Source

pub fn mark_device_unavailable(&self, why: String)

2026-09-26: The device layer cannot read. The first why is kept for Telemetry::device_unavailable_reason.

Source

pub fn absorb_device( &self, tracker: &mut CounterTracker, reading: &DeviceReading, read_errors: u64, )

2026-09-26: Absorb one device reading: publish it and, when it carries the energy counter, advance the energy total; once the ring exists, also push a ring point pairing it with the tokens so far and update the live J/token.

Source

pub fn device_reading(&self) -> Option<(DeviceReading, u64, u64)>

2026-09-26: The latest device reading, its time, and how many readings have been stored; None before the first.

Source

pub fn joules_per_token_cumulative(&self) -> Option<f64>

2026-09-26: GPU-rail J/token since the first energy sample.

Source

pub fn tokens_since_first_sample(&self) -> u64

2026-09-26: Tokens counted since the first energy sample: the denominator for Telemetry::energy_mj, which also starts there.

Source

pub fn now_ns(&self) -> u64

Source§

impl Telemetry

Source

pub fn snapshot(&self) -> TelemetrySnapshot

2026-09-26: The instruments, read now. Allocates (the spec rows), so it is not for a hot path.

Trait Implementations§

Source§

impl Debug for Telemetry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more