pub struct CountMinSketch { /* private fields */ }Expand description
Fixed-depth Count-Min sketch for compact megakernel telemetry.
The layout is intentionally plain Vec<u64> plus (depth, width) so the
same shape can be mirrored by GPU control buffers later. Hashing is
deterministic and seed-indexed; no host randomness is involved, which keeps
replay and regression tests stable.
Implementations§
Source§impl CountMinSketch
impl CountMinSketch
Sourcepub fn new(depth: usize, width: usize) -> Result<Self, PipelineError>
pub fn new(depth: usize, width: usize) -> Result<Self, PipelineError>
Create a zeroed sketch with the requested dimensions.
§Errors
Returns PipelineError when either dimension is zero or the counter
table size overflows host address space.
Sourcepub fn counters(&self) -> &[u64]
pub fn counters(&self) -> &[u64]
Raw row-major counters. Intended for readback, replay, and tests.
Sourcepub fn reset_shape(
&mut self,
depth: usize,
width: usize,
) -> Result<(), PipelineError>
pub fn reset_shape( &mut self, depth: usize, width: usize, ) -> Result<(), PipelineError>
Resize this sketch shape and clear counters.
§Errors
Returns PipelineError when either dimension is zero or the counter
table size overflows host address space.
Sourcepub fn try_add(&mut self, key: u32, amount: u64) -> Result<(), PipelineError>
pub fn try_add(&mut self, key: u32, amount: u64) -> Result<(), PipelineError>
Checked add of amount to every row bucket selected for key.
§Errors
Returns PipelineError when a counter would overflow u64.
Sourcepub fn merge(&mut self, other: &Self) -> Result<(), PipelineError>
pub fn merge(&mut self, other: &Self) -> Result<(), PipelineError>
Merge another sketch with identical dimensions into this sketch.
§Errors
Returns PipelineError if the sketches have different shapes.
Trait Implementations§
Source§impl Clone for CountMinSketch
impl Clone for CountMinSketch
Source§fn clone(&self) -> CountMinSketch
fn clone(&self) -> CountMinSketch
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CountMinSketch
impl Debug for CountMinSketch
impl Eq for CountMinSketch
Source§impl PartialEq for CountMinSketch
impl PartialEq for CountMinSketch
Source§fn eq(&self, other: &CountMinSketch) -> bool
fn eq(&self, other: &CountMinSketch) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for CountMinSketch
Auto Trait Implementations§
impl Freeze for CountMinSketch
impl RefUnwindSafe for CountMinSketch
impl Send for CountMinSketch
impl Sync for CountMinSketch
impl Unpin for CountMinSketch
impl UnsafeUnpin for CountMinSketch
impl UnwindSafe for CountMinSketch
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.