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) -> StopEvaluator
Sourcepub fn with_estimated_total(self, rows: u64) -> StopEvaluator
pub fn with_estimated_total(self, rows: u64) -> StopEvaluator
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more