Skip to main content

DriveLoopProfiler

Struct DriveLoopProfiler 

Source
pub struct DriveLoopProfiler { /* private fields */ }
Expand description

Owns every drive-loop phase/rate ring drive_runtime_until_shutdown writes into once per iteration. Lives on NodeShared behind a std::sync::Mutex that is only ever locked for a push and dropped before the next .await – never held across one, so it does not need tokio::sync::Mutex.

Implementations§

Source§

impl DriveLoopProfiler

Source

pub fn record_runtime_tick(&mut self, elapsed: Duration)

runtime.tick().await – the whole native-runtime tick, whose own six internal phases are separately timed by gate4agent_runtime_native::tick_profile.

Source

pub fn record_event_drain(&mut self, elapsed: Duration)

Draining events.try_recv() in a loop and republishing each control event – includes the per-event managed-record export lookup, but not the detached tokio::spawn’d export task itself.

Source

pub fn record_publish_terminal_frames(&mut self, elapsed: Duration)

shared.publish_terminal_frames() – snapshotting sessions, then diffing and broadcasting any advanced terminal frame.

Source

pub fn record_remainder(&mut self, elapsed: Duration)

Whatever is left of the iteration after the three phases above and before the trailing sleep – today that is the shutdown-progress check (a no-op outside shutdown) plus this profiler’s own bookkeeping.

Source

pub fn note_iteration(&mut self, now: Instant)

Call exactly once per drive-loop iteration, regardless of what that iteration did – rolls the current one-second bucket into iterations_per_sec the moment a full second has elapsed, then counts this iteration toward the (possibly just-rolled) bucket. Rolling before counting means an iteration observed after a second boundary is credited to the new second, not folded into the one being flushed.

Bounded to SAMPLE_WINDOW catch-up rolls for the same reason as hatchery-tui’s tick_second: a long idle gap (e.g. the process paused under a debugger) must resync rather than spin backfilling a zero-sample per elapsed second.

Source

pub fn snapshot(&self) -> DriveLoopProfileSnapshot

Trait Implementations§

Source§

impl Clone for DriveLoopProfiler

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DriveLoopProfiler

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for DriveLoopProfiler

Source§

fn default() -> Self

Returns the “default value” for a type. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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