pub struct CostTracker { /* private fields */ }Expand description
Tracks resource consumption during query execution
Implementations§
Source§impl CostTracker
impl CostTracker
Sourcepub fn new(budget: QueryBudget) -> Self
pub fn new(budget: QueryBudget) -> Self
Create a new cost tracker with the given budget
Sourcepub fn add_ram_bytes(&self, bytes: u64) -> bool
pub fn add_ram_bytes(&self, bytes: u64) -> bool
Add RAM bytes consumed
Sourcepub fn add_ssd_random_read(&self) -> bool
pub fn add_ssd_random_read(&self) -> bool
Add SSD random read
Sourcepub fn add_ssd_sequential_bytes(&self, bytes: u64) -> bool
pub fn add_ssd_sequential_bytes(&self, bytes: u64) -> bool
Add SSD sequential bytes
Sourcepub fn add_cpu_cycles(&self, cycles: u64) -> bool
pub fn add_cpu_cycles(&self, cycles: u64) -> bool
Add CPU cycles
Sourcepub fn check_latency(&self) -> bool
pub fn check_latency(&self) -> bool
Check if latency budget is exceeded
Sourcepub fn is_exhausted(&self) -> bool
pub fn is_exhausted(&self) -> bool
Check if budget is exhausted
Sourcepub fn exhaustion_reason(&self) -> Option<BudgetExhaustionReason>
pub fn exhaustion_reason(&self) -> Option<BudgetExhaustionReason>
Get exhaustion reason if budget is exhausted
Sourcepub fn remaining_ram_bytes(&self) -> u64
pub fn remaining_ram_bytes(&self) -> u64
Get remaining RAM bytes budget
Sourcepub fn remaining_ssd_random_reads(&self) -> u32
pub fn remaining_ssd_random_reads(&self) -> u32
Get remaining SSD random reads budget
Sourcepub fn remaining_time(&self) -> Duration
pub fn remaining_time(&self) -> Duration
Get remaining time budget
Sourcepub fn utilization(&self) -> CostUtilization
pub fn utilization(&self) -> CostUtilization
Get utilization ratios for all resources
Sourcepub fn summary(&self) -> CostSummary
pub fn summary(&self) -> CostSummary
Generate a summary for telemetry
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for CostTracker
impl !RefUnwindSafe for CostTracker
impl Send for CostTracker
impl Sync for CostTracker
impl Unpin for CostTracker
impl UnsafeUnpin for CostTracker
impl UnwindSafe for CostTracker
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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