Expand description
A ring buffer that can receive events from eBPF programs.
PerfEventArrayBuffer
is a ring buffer that can receive events from eBPF
programs that use bpf_perf_event_output()
. It’s returned by PerfEventArray::open
.
See the PerfEventArray
documentation for an overview of how to use
perf buffers.
Implementations
sourceimpl<T: DerefMut<Target = Map>> PerfEventArrayBuffer<T>
impl<T: DerefMut<Target = Map>> PerfEventArrayBuffer<T>
sourcepub fn readable(&self) -> bool
pub fn readable(&self) -> bool
Returns true if the buffer contains events that haven’t been read.
sourcepub fn read_events(
&mut self,
out_bufs: &mut [BytesMut]
) -> Result<Events, PerfBufferError>
pub fn read_events(
&mut self,
out_bufs: &mut [BytesMut]
) -> Result<Events, PerfBufferError>
Reads events from the buffer.
This method reads events into the provided slice of buffers, filling each buffer in order stopping when there are no more events to read or all the buffers have been filled.
Returns the number of events read and the number of events lost. Events are lost when user space doesn’t read events fast enough and the ring buffer fills up.
Errors
PerfBufferError::NoBuffers
is returned when out_bufs
is empty.
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for PerfEventArrayBuffer<T> where
T: RefUnwindSafe,
impl<T> Send for PerfEventArrayBuffer<T> where
T: Send + Sync,
impl<T> Sync for PerfEventArrayBuffer<T> where
T: Send + Sync,
impl<T> Unpin for PerfEventArrayBuffer<T>
impl<T> UnwindSafe for PerfEventArrayBuffer<T> where
T: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more