pub struct Profiler<C: CoordType, const D: usize> { /* private fields */ }Expand description
The Profiler orchestrates reservoir sampling, statistics computation, and query workload tracking.
Observations are sent via the Profiler::sender handle and processed
in batches of 64 when Profiler::flush or Profiler::process_pending
is called.
Implementations§
Source§impl<C: CoordType, const D: usize> Profiler<C, D>
impl<C: CoordType, const D: usize> Profiler<C, D>
Sourcepub fn new(reservoir_capacity: usize) -> Self
pub fn new(reservoir_capacity: usize) -> Self
Create a new Profiler with the given reservoir capacity.
Sourcepub fn default_capacity() -> Self
pub fn default_capacity() -> Self
Create a Profiler with the default reservoir capacity of 4096.
Sourcepub fn sender(&self) -> Sender<Observation<C, D>>
pub fn sender(&self) -> Sender<Observation<C, D>>
Return a clone of the sender handle for submitting observations.
Multiple senders can be created from this handle for multi-producer use.
Sourcepub fn observe(&mut self, obs: Observation<C, D>)
pub fn observe(&mut self, obs: Observation<C, D>)
Submit an observation directly (bypasses the channel).
Convenience method for single-threaded use. Call Profiler::flush to
force an immediate stats recompute.
Sourcepub fn process_pending(&mut self) -> usize
pub fn process_pending(&mut self) -> usize
Process all pending observations from the channel in batches of 64.
Returns the number of observations processed.
Sourcepub fn data_shape(&self) -> Option<&DataShape<D>>
pub fn data_shape(&self) -> Option<&DataShape<D>>
Return the last computed DataShape, or None if no data has been observed.
Sourcepub fn workload(&self) -> &WorkloadHistory
pub fn workload(&self) -> &WorkloadHistory
Return a reference to the query workload history.
Sourcepub fn reservoir_len(&self) -> usize
pub fn reservoir_len(&self) -> usize
Return the number of points in the reservoir.
Sourcepub fn total_observed(&self) -> usize
pub fn total_observed(&self) -> usize
Return the total number of points observed.