pub struct VmMetrics {
pub instructions_executed: u64,
pub typed_trusted_ops: u64,
pub typed_guarded_ops: u64,
pub jit_dispatches: u64,
pub interpreter_calls: u64,
pub tier_events: RingBuffer<TierEvent, 256>,
pub gc_pauses: RingBuffer<GcPauseEvent, 256>,
pub gc_pause_histogram: Histogram,
/* private fields */
}Expand description
Aggregated VM metrics with bounded memory usage.
When enabled on a [VirtualMachine], counters are bumped inline and events
are pushed into fixed-size ring buffers. The structure is Option-wrapped
in the VM so disabled metrics have zero per-instruction overhead.
Fields§
§instructions_executed: u64Total bytecode instructions dispatched.
typed_trusted_ops: u64Typed opcodes that ran without a guard check.
typed_guarded_ops: u64Typed opcodes that required a runtime type guard.
jit_dispatches: u64Calls dispatched through JIT-compiled code.
interpreter_calls: u64Calls dispatched through the interpreter.
tier_events: RingBuffer<TierEvent, 256>Recent tier transition events (last 256).
gc_pauses: RingBuffer<GcPauseEvent, 256>Recent GC pause events (last 256).
gc_pause_histogram: HistogramGC pause duration histogram.
Implementations§
Source§impl VmMetrics
impl VmMetrics
pub fn record_instruction(&mut self)
pub fn record_trusted_op(&mut self)
pub fn record_guarded_op(&mut self)
pub fn record_jit_dispatch(&mut self)
pub fn record_interpreter_call(&mut self)
Sourcepub fn record_deopt_fallback(&mut self)
pub fn record_deopt_fallback(&mut self)
Record a deopt fallback (re-exec-from-entry) — should be rare in production.
pub fn record_tier_event(&mut self, event: TierEvent)
pub fn record_gc_pause(&mut self, event: GcPauseEvent)
Sourcepub fn elapsed_us(&self) -> u64
pub fn elapsed_us(&self) -> u64
Microseconds elapsed since this metrics session started.
Sourcepub fn summary(&self) -> MetricsSummary
pub fn summary(&self) -> MetricsSummary
Compute a summary snapshot for logging / display.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VmMetrics
impl RefUnwindSafe for VmMetrics
impl Send for VmMetrics
impl Sync for VmMetrics
impl Unpin for VmMetrics
impl UnsafeUnpin for VmMetrics
impl UnwindSafe for VmMetrics
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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