Skip to main content

KTraceBuffer

Struct KTraceBuffer 

Source
pub struct KTraceBuffer { /* private fields */ }
Expand description

A Rust implementation of percpu_writer::Buffer that wraps a static reference to an existing spsc_buffer::Buffer and tracks dropped trace records.

Implementations§

Source§

impl KTraceBuffer

Source

pub fn size(&self) -> u32

Returns the size of the backing storage.

Source

pub fn drain(&self) -> Result<(), Status>

Drains the underlying Buffer.

Source

pub fn read<F>(&self, copy_fn: F, len: u32) -> Result<u32, Status>
where F: FnMut(u32, &[u8]) -> Result<(), Status>,

Copies len bytes out of the buffer using the provided copy_fn.

Source

pub fn reserve(&mut self, header: u64) -> Result<KTraceReservation<'_>, Status>

Reserves a block of the given size in the buffer, interposing to write dropped record statistics if any were tracked.

Source

pub fn emit_drop_stats(&mut self) -> Result<(), Status>

Emit the dropped record stats to the trace buffer if we’re currently tracking them.

Source

pub fn reset_drop_stats(&mut self)

Resets the dropped records statistics to their initial values.

Trait Implementations§

Source§

impl Send for KTraceBuffer

Source§

impl Sync for KTraceBuffer

Auto Trait Implementations§

§

impl Freeze for KTraceBuffer

§

impl RefUnwindSafe for KTraceBuffer

§

impl Unpin for KTraceBuffer

§

impl UnsafeUnpin for KTraceBuffer

§

impl !UnwindSafe for KTraceBuffer

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.