pub struct Stats {Show 14 fields
pub opcodes: u64,
pub steps: u64,
pub threads_created: u64,
pub threads_completed: u64,
pub frames_pushed: u64,
pub frames_popped: u64,
pub choices_presented: u64,
pub choices_selected: u64,
pub snapshot_cache_hits: u64,
pub snapshot_cache_misses: u64,
pub materializations: u64,
pub opcode_hist: Vec<u64>,
pub bigram_hist: Vec<u64>,
pub last_disc: Option<u8>,
}Expand description
Lightweight counters tracking VM activity over a story’s lifetime.
Always-on — incrementing a u64 is effectively free compared to opcode
dispatch. Use [Story::stats] to read after a run.
Fields§
§opcodes: u64Total opcodes dispatched.
steps: u64Total vm::step calls from the outer loop.
threads_created: u64Threads forked (via ThreadCall and choice creation).
threads_completed: u64Threads that completed and were popped.
frames_pushed: u64Call frames pushed onto thread stacks.
frames_popped: u64Call frames popped from thread stacks.
choices_presented: u64Choice sets presented to the player.
choices_selected: u64Individual choices selected.
snapshot_cache_hits: u64CallStack::snapshot cache hits (reused existing Arc).
snapshot_cache_misses: u64CallStack::snapshot cache misses (new allocation).
materializations: u64CallStack::materialize calls (flattened inherited prefix).
opcode_hist: Vec<u64>Executed-instruction histogram by discriminant byte (256 entries, sized on first use). Bench instrumentation only: the optimizer’s peephole work needs to know which instructions — and which pairs — actually run, not which exist in the artifact.
bigram_hist: Vec<u64>Executed instruction-pair histogram, indexed prev << 8 | next
(65 536 entries, sized on first use).
last_disc: Option<u8>The previously executed discriminant, for bigram_hist.