pub struct LocklessRingBuffer { /* private fields */ }Implementations§
Source§impl LocklessRingBuffer
impl LocklessRingBuffer
pub const PAGE_HEADER_SIZE: usize = 16
Sourcepub const TYPE_OR_LENGTH_BITS: u32 = 5
pub const TYPE_OR_LENGTH_BITS: u32 = 5
The number of low bits of an ftrace record header that hold type_or_length.
Sourcepub const TIME_DELTA_BITS: u32 = 27
pub const TIME_DELTA_BITS: u32 = 27
The number of high bits of an ftrace record header that hold the time delta. A TIME_STAMP
record puts the low TIME_DELTA_BITS of its time there.
Sourcepub const MAX_TIME_DELTA_NANOS: u64
pub const MAX_TIME_DELTA_NANOS: u64
The largest time delta, in nanoseconds, that a record header holds.
Sourcepub const RINGBUF_TYPE_TIME_STAMP: u32 = 31
pub const RINGBUF_TYPE_TIME_STAMP: u32 = 31
The type_or_length of a TIME_STAMP record (RINGBUF_TYPE_TIME_STAMP in Linux
include/linux/ring_buffer.h).
Sourcepub const TIME_STAMP_RECORD_SIZE: usize = 8
pub const TIME_STAMP_RECORD_SIZE: usize = 8
The size of a TIME_STAMP record: the header and a u32 with the high bits of the time.
Sourcepub fn new(
size_bytes: usize,
overwrite: bool,
write_event_async_id: Id,
) -> Result<Self, Errno>
pub fn new( size_bytes: usize, overwrite: bool, write_event_async_id: Id, ) -> Result<Self, Errno>
Creates a new LocklessRingBuffer. size_bytes: Size of the ring buffer. Must be at least PAGE_SIZE * 3 and will be rounded up to a multiple of PAGE_SIZE. overwrite: If true, old pages will be dropped when the ring is full. If false, writes will fail until the data is read. write_event_async_id: The async trace event ID for write events.
Source§impl LocklessRingBuffer
impl LocklessRingBuffer
Sourcepub fn reserve(
&self,
size: usize,
) -> Result<(Reservation<'_>, BootInstant, Duration<BootTimeline>), Errno>
pub fn reserve( &self, size: usize, ) -> Result<(Reservation<'_>, BootInstant, Duration<BootTimeline>), Errno>
Reserves size bytes for a record.
Returns the reservation, the record’s time, and the delta from the previous record (0 for
the first record on a page). The delta can exceed what a record header holds; write
Reservation::header_time_delta() into the header instead.
Sourcepub fn reserve_with_clock(
&self,
size: usize,
current_boot_time: impl Fn() -> BootInstant,
) -> Result<(Reservation<'_>, BootInstant, Duration<BootTimeline>), Errno>
pub fn reserve_with_clock( &self, size: usize, current_boot_time: impl Fn() -> BootInstant, ) -> Result<(Reservation<'_>, BootInstant, Duration<BootTimeline>), Errno>
Like reserve(), but reads the current time from current_boot_time, so that tests can
control timestamps.
pub fn commit(&self, reservation: Reservation<'_>)
pub fn read(&self, buf: &mut dyn OutputBuffer) -> Result<usize, Errno>
pub fn size_bytes(&self) -> usize
pub fn is_enabled(&self) -> bool
pub fn disable(&self) -> Result<u64, Errno>
Sourcepub fn enable(&self) -> Result<BootInstant, Errno>
pub fn enable(&self) -> Result<BootInstant, Errno>
If the ring is disabled, resets it to empty, enables it, and returns the time of the reset.
If the ring is already enabled, does nothing, so in-flight writers and readers, and the
tail_page generation, are unaffected. In that case it returns the time of the last reset,
by new() or by an earlier enable().
Trait Implementations§
Source§impl Drop for LocklessRingBuffer
impl Drop for LocklessRingBuffer
impl RcuDroppable for LocklessRingBufferwhere
Vmo: RcuDroppable,
SharedBuffer: RcuDroppable,
Vec<Node>: RcuDroppable,
AtomicUsize: RcuDroppable,
AtomicTailVal: RcuDroppable,
bool: RcuDroppable,
AtomicU64: RcuDroppable,
Id: RcuDroppable,
AtomicBool: RcuDroppable,
LockDepMutex<BootInstant, PerfRingBufferStateLock>: RcuDroppable,
Auto Trait Implementations§
impl !Freeze for LocklessRingBuffer
impl !RefUnwindSafe for LocklessRingBuffer
impl Send for LocklessRingBuffer
impl Sync for LocklessRingBuffer
impl Unpin for LocklessRingBuffer
impl UnsafeUnpin for LocklessRingBuffer
impl UnwindSafe for LocklessRingBuffer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
fn fidl_into_native(self) -> Box<N>
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> ⓘ
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> ⓘ
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