pub struct AcquisitionStream { /* private fields */ }Expand description
An interleaved acquisition stream of timing measurements.
Measurement produces an interleaved stream indexed by acquisition time:
{(c_t, y_t)} where c_t is the class label and y_t is the timing.
This structure is critical for correct dependence estimation. The underlying stochastic process operates in continuous time—drift, frequency scaling, and cache state evolution affect nearby samples regardless of class. Bootstrap resampling must preserve adjacency in acquisition order, not per-class position.
See spec Section 2.3.1 for the full rationale.
Implementations§
Source§impl AcquisitionStream
impl AcquisitionStream
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a new acquisition stream with pre-allocated capacity.
Sourcepub fn push(&mut self, class: SampleClass, timing: f64)
pub fn push(&mut self, class: SampleClass, timing: f64)
Push a new sample onto the stream.
Sourcepub fn push_batch_interleaved(&mut self, fixed: &[f64], random: &[f64])
pub fn push_batch_interleaved(&mut self, fixed: &[f64], random: &[f64])
Push a batch of samples, interleaving Fixed and Random classes.
Samples are pushed in interleaved order: F, R, F, R, … Both vectors must have the same length.
Sourcepub fn n_per_class(&self) -> usize
pub fn n_per_class(&self) -> usize
Get the number of samples per class (assumes balanced classes).
Sourcepub fn split_by_class(&self) -> (Vec<f64>, Vec<f64>)
pub fn split_by_class(&self) -> (Vec<f64>, Vec<f64>)
Split the stream into per-class vectors.
Returns (fixed_timings, random_timings).
Sourcepub fn timings(&self) -> impl Iterator<Item = f64> + '_
pub fn timings(&self) -> impl Iterator<Item = f64> + '_
Get an iterator over all timings (ignoring class labels).
Used for ACF computation on the pooled stream.
Sourcepub fn as_slice(&self) -> &[(SampleClass, f64)]
pub fn as_slice(&self) -> &[(SampleClass, f64)]
Get a slice of the raw samples.
Sourcepub fn as_mut_slice(&mut self) -> &mut [(SampleClass, f64)]
pub fn as_mut_slice(&mut self) -> &mut [(SampleClass, f64)]
Get mutable access to the raw samples.
Sourcepub fn iter(&self) -> impl Iterator<Item = &(SampleClass, f64)>
pub fn iter(&self) -> impl Iterator<Item = &(SampleClass, f64)>
Get an iterator over (class, timing) pairs.
Sourcepub fn get(&self, index: usize) -> Option<&(SampleClass, f64)>
pub fn get(&self, index: usize) -> Option<&(SampleClass, f64)>
Get the sample at the given index.
Sourcepub fn from_raw_interleaved(
baseline: &[u64],
sample: &[u64],
ns_per_tick: f64,
) -> Self
pub fn from_raw_interleaved( baseline: &[u64], sample: &[u64], ns_per_tick: f64, ) -> Self
Convert raw u64 measurements to nanoseconds and store as stream.
Interleaves the measurements: baseline[0], sample[0], baseline[1], sample[1], …
Sourcepub fn to_timing_samples(&self) -> Vec<TimingSample>
pub fn to_timing_samples(&self) -> Vec<TimingSample>
Convert to Vec
This is an adapter method that converts the acquisition stream to the
TimingSample format used by the bootstrap covariance estimation functions.
Maps SampleClass::Fixed → Class::Baseline, SampleClass::Random → Class::Sample.
Trait Implementations§
Source§impl Clone for AcquisitionStream
impl Clone for AcquisitionStream
Source§fn clone(&self) -> AcquisitionStream
fn clone(&self) -> AcquisitionStream
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AcquisitionStream
impl Debug for AcquisitionStream
Source§impl Default for AcquisitionStream
impl Default for AcquisitionStream
Source§fn default() -> AcquisitionStream
fn default() -> AcquisitionStream
Source§impl<'de> Deserialize<'de> for AcquisitionStream
impl<'de> Deserialize<'de> for AcquisitionStream
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for AcquisitionStream
impl RefUnwindSafe for AcquisitionStream
impl Send for AcquisitionStream
impl Sync for AcquisitionStream
impl Unpin for AcquisitionStream
impl UnwindSafe for AcquisitionStream
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.