pub struct StopEvaluator { /* private fields */ }Expand description
Runtime evaluator that checks a StopCondition against accumulated counters.
Create one before the processing loop and call update
after each chunk. When it returns true, profiling should stop.
Implementations§
Source§impl StopEvaluator
impl StopEvaluator
pub fn new(condition: StopCondition) -> Self
Sourcepub fn with_estimated_total(self, rows: u64) -> Self
pub fn with_estimated_total(self, rows: u64) -> Self
Provide an estimated total row count (enables ConfidenceThreshold).
Sourcepub fn update(
&mut self,
chunk_rows: u64,
chunk_bytes: u64,
memory_fraction: f64,
) -> bool
pub fn update( &mut self, chunk_rows: u64, chunk_bytes: u64, memory_fraction: f64, ) -> bool
Update counters and evaluate the stop condition.
Returns true when profiling should stop.
chunk_rows: number of rows in the chunk just processedchunk_bytes: number of bytes consumed by this chunkmemory_fraction: current memory usage as a fraction of the limit (0.0..1.0)
Sourcepub fn should_stop(&self) -> bool
pub fn should_stop(&self) -> bool
Returns true if a stop condition has already been triggered.
Sourcepub fn truncation_reason(&self) -> Option<TruncationReason>
pub fn truncation_reason(&self) -> Option<TruncationReason>
The reason profiling stopped, mapped to TruncationReason.
Sourcepub fn rows_processed(&self) -> u64
pub fn rows_processed(&self) -> u64
Total rows processed so far.
Sourcepub fn bytes_consumed(&self) -> u64
pub fn bytes_consumed(&self) -> u64
Total bytes consumed so far.
Auto Trait Implementations§
impl Freeze for StopEvaluator
impl RefUnwindSafe for StopEvaluator
impl Send for StopEvaluator
impl Sync for StopEvaluator
impl Unpin for StopEvaluator
impl UnsafeUnpin for StopEvaluator
impl UnwindSafe for StopEvaluator
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