Skip to main content

Profiler

Struct Profiler 

Source
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>

Source

pub fn new(reservoir_capacity: usize) -> Self

Create a new Profiler with the given reservoir capacity.

Source

pub fn default_capacity() -> Self

Create a Profiler with the default reservoir capacity of 4096.

Source

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.

Source

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.

Source

pub fn process_pending(&mut self) -> usize

Process all pending observations from the channel in batches of 64.

Returns the number of observations processed.

Source

pub fn flush(&mut self)

Flush all pending channel observations and recompute statistics.

Source

pub fn data_shape(&self) -> Option<&DataShape<D>>

Return the last computed DataShape, or None if no data has been observed.

Source

pub fn workload(&self) -> &WorkloadHistory

Return a reference to the query workload history.

Source

pub fn reservoir_len(&self) -> usize

Return the number of points in the reservoir.

Source

pub fn total_observed(&self) -> usize

Return the total number of points observed.

Auto Trait Implementations§

§

impl<C, const D: usize> Freeze for Profiler<C, D>

§

impl<C, const D: usize> RefUnwindSafe for Profiler<C, D>
where C: RefUnwindSafe,

§

impl<C, const D: usize> Send for Profiler<C, D>

§

impl<C, const D: usize> !Sync for Profiler<C, D>

§

impl<C, const D: usize> Unpin for Profiler<C, D>
where C: Unpin,

§

impl<C, const D: usize> UnsafeUnpin for Profiler<C, D>

§

impl<C, const D: usize> UnwindSafe for Profiler<C, D>
where C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.