pub struct EventBuffer { /* private fields */ }
Expand description
Lock-free ring buffer for allocation events
Uses single-producer, single-consumer (SPSC) design where the producer (allocator hook) runs on the application thread and the consumer (aggregator) runs on a dedicated background thread.
Implementations§
Source§impl EventBuffer
impl EventBuffer
Sourcepub fn push(&self, event: AllocationEvent) -> AsyncResult<()>
pub fn push(&self, event: AllocationEvent) -> AsyncResult<()>
Push event to buffer (producer side)
Returns Ok(()) if successful, Err with drop count if buffer full. Never blocks - drops events instead to maintain real-time performance.
Sourcepub fn pop(&self) -> Option<AllocationEvent>
pub fn pop(&self) -> Option<AllocationEvent>
Pop event from buffer (consumer side)
Returns Some(event) if available, None if buffer empty. Only called by the aggregator thread.
Sourcepub fn dropped_count(&self) -> usize
pub fn dropped_count(&self) -> usize
Get number of dropped events
Sourcepub fn drain(&self) -> Vec<AllocationEvent>
pub fn drain(&self) -> Vec<AllocationEvent>
Drain all events from buffer
Returns vector of all current events, clearing the buffer. Used for bulk processing and testing.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for EventBuffer
impl !RefUnwindSafe for EventBuffer
impl Unpin for EventBuffer
impl UnwindSafe for EventBuffer
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
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