Skip to main content

Module timing

Module timing 

Source
Expand description

s9vm : pure timing and exit-latency measurement.

This module performs no hardware access: every sample is supplied by the caller (time-stamp counter cycles, nanoseconds, or any other monotonic unit) and all computations are integer arithmetic. It can therefore be compiled and exercised on the host.

ยงUnits

Samples are opaque u64 values. A histogram never converts units: the caller decides whether it records cycles or nanoseconds and must keep the same unit for every sample recorded in a given histogram. Reporting code is responsible for the conversion and for remembering the time-stamp counter frequency.

ยงContents

TypeRoleMemory
ExitLatencyHistogramfixed 32-bucket log histogram~280 bytes
ExitRateMetertotal / sliding window / peak counter~100 bytes
WorldTimingper-exit-class aggregation of both~9 KiB

All counters saturate: a long-running measurement degrades into an imprecise value instead of wrapping or panicking.

Re-exportsยง

use super::exit::ExitClass; ๐Ÿ”’
use super::exit::ExitReason; ๐Ÿ”’

Structsยง

ExitLatencyHistogram
Fixed-memory histogram of exit latencies.
ExitRateMeter
Sliding-window counter for exit rates.
WorldTiming
Timing aggregate of one virtual machine, split by exit class.

Constantsยง

EMPTY_HISTOGRAM ๐Ÿ”’
Empty histogram, used to initialize the per-class array.
EMPTY_RATE_METER ๐Ÿ”’
Empty rate meter, used to initialize the per-class array.
EXIT_CLASS_COUNT
Number of ExitClass variants aggregated by WorldTiming.
EXIT_LATENCY_BUCKETS
Number of latency buckets in an ExitLatencyHistogram.
EXIT_RATE_WINDOW
Number of slots of an ExitRateMeter sliding window.