pub struct StatsHandle { /* private fields */ }Expand description
Read-only handle exposing auto-counted [SessionStatus] metrics to
the Lua bridge (e.g. alc.stats.llm_calls()).
Cloned per session and per fork-child VM. Each holds an
Arc<Mutex<SessionStatus>> shared with the observer that writes to
llm_calls on every paused-cycle complete.
§Poison policy
Read methods return 0 (or sensible defaults) on mutex poison —
they are observational and non-fatal, mirroring BudgetHandle::remaining.
Reads do not mutate SessionStatus.
Implementations§
Source§impl StatsHandle
impl StatsHandle
Sourcepub fn llm_calls(&self) -> u64
pub fn llm_calls(&self) -> u64
Total LLM calls observed in the current session so far.
Returns 0 on mutex poison (observational; matches the
Null fallback used by BudgetHandle::remaining). Within a
single session the Lua thread is the only writer path, so
poison only occurs when an observer callback panicked under
the lock — an unrecoverable state where 0 is acceptable.
Trait Implementations§
Source§impl Clone for StatsHandle
impl Clone for StatsHandle
Source§fn clone(&self) -> StatsHandle
fn clone(&self) -> StatsHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more