Skip to main content

StartupSpans

Struct StartupSpans 

Source
pub struct StartupSpans<C: Clock = SystemClock> { /* private fields */ }
Expand description

Named monotonic timestamps from a begin() epoch — a shell records one named span at each startup milestone (see the SPAN_* consts), then calls Self::emit_log once for a single summary line.

Implementations§

Source§

impl StartupSpans<SystemClock>

Source

pub fn begin() -> Self

Begin a span recorder honoring the process-wide enabled switch, using the real system clock — what every shell constructs.

Source§

impl<C: Clock> StartupSpans<C>

Source

pub fn begin_with_enabled(clock: C, is_enabled: bool) -> Self

Test/advanced seam: begin with an explicit clock and enabled flag, bypassing enabled’s cache (see FrameStats::new_enabled’s docs for why).

Source

pub fn record(&mut self, name: &'static str)

Record name at the current clock reading, as a delta from Self::begin’s epoch. A no-op (no clock read, no allocation) when disabled.

Source

pub fn spans(&self) -> &[(&'static str, Duration)]

The recorded (name, delta) pairs in insertion order.

Source

pub fn emit_log(&self)

Emit one frust-perf startup ... line via log::info! containing every recorded span’s name and millisecond delta, in insertion order. A no-op when disabled or when nothing has been recorded.

Auto Trait Implementations§

§

impl<C> Freeze for StartupSpans<C>
where C: Freeze,

§

impl<C> RefUnwindSafe for StartupSpans<C>
where C: RefUnwindSafe,

§

impl<C> Send for StartupSpans<C>
where C: Send,

§

impl<C> Sync for StartupSpans<C>
where C: Sync,

§

impl<C> Unpin for StartupSpans<C>
where C: Unpin,

§

impl<C> UnsafeUnpin for StartupSpans<C>
where C: UnsafeUnpin,

§

impl<C> UnwindSafe for StartupSpans<C>
where C: UnwindSafe,

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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> StorageAccess<T> for T

Source§

fn as_borrowed(&self) -> &T

Borrows the value.
Source§

fn into_taken(self) -> T

Takes the value.
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.