pub struct ExecutionCounters {
pub commands: usize,
pub function_depth: usize,
pub loop_iterations: usize,
pub total_loop_iterations: usize,
pub session_commands: u64,
pub session_exec_calls: u64,
}Expand description
Execution counters for tracking resource usage
Fields§
§commands: usizeNumber of commands executed
function_depth: usizeCurrent function call depth
loop_iterations: usizeNumber of iterations in current loop (reset per-loop)
total_loop_iterations: usizeTotal loop iterations across all loops (never reset)
session_commands: u64Total commands across all exec() calls in this session.
session_exec_calls: u64Number of exec() invocations in this session.
Implementations§
Source§impl ExecutionCounters
impl ExecutionCounters
Sourcepub fn reset_for_execution(&mut self)
pub fn reset_for_execution(&mut self)
Reset counters for a new exec() invocation. Each exec() is a separate script and gets its own budget. This prevents a prior exec() from permanently poisoning the session.
Sourcepub fn tick_command(
&mut self,
limits: &ExecutionLimits,
) -> Result<(), LimitExceeded>
pub fn tick_command( &mut self, limits: &ExecutionLimits, ) -> Result<(), LimitExceeded>
Increment command counter, returns error if limit exceeded
Sourcepub fn check_session_limits(
&self,
session_limits: &SessionLimits,
) -> Result<(), LimitExceeded>
pub fn check_session_limits( &self, session_limits: &SessionLimits, ) -> Result<(), LimitExceeded>
Check session-level limits. Called at exec() entry and during execution.
Sourcepub fn tick_exec_call(&mut self)
pub fn tick_exec_call(&mut self)
Increment exec call counter for session tracking.
Sourcepub fn tick_loop(
&mut self,
limits: &ExecutionLimits,
) -> Result<(), LimitExceeded>
pub fn tick_loop( &mut self, limits: &ExecutionLimits, ) -> Result<(), LimitExceeded>
Increment loop iteration counter, returns error if limit exceeded
Sourcepub fn reset_loop(&mut self)
pub fn reset_loop(&mut self)
Reset loop iteration counter (called when entering a new loop)
Sourcepub fn push_function(
&mut self,
limits: &ExecutionLimits,
) -> Result<(), LimitExceeded>
pub fn push_function( &mut self, limits: &ExecutionLimits, ) -> Result<(), LimitExceeded>
Push function call, returns error if depth exceeded
Sourcepub fn pop_function(&mut self)
pub fn pop_function(&mut self)
Pop function call
Trait Implementations§
Source§impl Clone for ExecutionCounters
impl Clone for ExecutionCounters
Source§fn clone(&self) -> ExecutionCounters
fn clone(&self) -> ExecutionCounters
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more