pub struct AllocationBudget { /* private fields */ }Expand description
Allocation budget monitor with dual CUSUM + e-process detection.
Implementations§
Source§impl AllocationBudget
impl AllocationBudget
Sourcepub fn new(config: BudgetConfig) -> Self
pub fn new(config: BudgetConfig) -> Self
Create monitor with default config.
Sourcepub fn with_evidence_sink(self, sink: EvidenceSink) -> Self
pub fn with_evidence_sink(self, sink: EvidenceSink) -> Self
Attach an evidence sink for JSONL logging.
Sourcepub fn with_evidence_context(
self,
run_id: impl Into<String>,
screen_mode: impl Into<String>,
cols: u16,
rows: u16,
) -> Self
pub fn with_evidence_context( self, run_id: impl Into<String>, screen_mode: impl Into<String>, cols: u16, rows: u16, ) -> Self
Set evidence context fields for JSONL logs.
Sourcepub fn set_evidence_context(
&mut self,
run_id: impl Into<String>,
screen_mode: impl Into<String>,
cols: u16,
rows: u16,
)
pub fn set_evidence_context( &mut self, run_id: impl Into<String>, screen_mode: impl Into<String>, cols: u16, rows: u16, )
Set evidence context fields for JSONL logs.
Sourcepub fn set_evidence_sink(&mut self, sink: Option<EvidenceSink>)
pub fn set_evidence_sink(&mut self, sink: Option<EvidenceSink>)
Set or clear the evidence sink.
Sourcepub fn observe(&mut self, x: f64) -> Option<BudgetAlert>
pub fn observe(&mut self, x: f64) -> Option<BudgetAlert>
Observe an allocation count/byte measurement for the current frame.
Returns Some(alert) if a regression is detected.
Sourcepub fn running_mean(&self) -> f64
pub fn running_mean(&self) -> f64
Running mean of the observation window.
Sourcepub fn cusum_plus(&self) -> f64
pub fn cusum_plus(&self) -> f64
Current CUSUM S⁺ value.
Sourcepub fn cusum_minus(&self) -> f64
pub fn cusum_minus(&self) -> f64
Current CUSUM S⁻ value.
Sourcepub fn total_alerts(&self) -> u64
pub fn total_alerts(&self) -> u64
Total alerts fired.
Sourcepub fn ledger(&self) -> &VecDeque<BudgetEvidence>
pub fn ledger(&self) -> &VecDeque<BudgetEvidence>
Access the evidence ledger.
Sourcepub fn summary(&self) -> BudgetSummary
pub fn summary(&self) -> BudgetSummary
Summary for diagnostics.
Trait Implementations§
Source§impl Clone for AllocationBudget
impl Clone for AllocationBudget
Source§fn clone(&self) -> AllocationBudget
fn clone(&self) -> AllocationBudget
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AllocationBudget
impl RefUnwindSafe for AllocationBudget
impl Send for AllocationBudget
impl Sync for AllocationBudget
impl Unpin for AllocationBudget
impl UnwindSafe for AllocationBudget
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
Mutably borrows from an owned value. Read more