pub struct KTraceBuffer {
pub drop_stats: &'static mut DroppedRecordStats,
pub process_koid: u64,
pub thread_koid: u64,
/* 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.
Fields§
§drop_stats: &'static mut DroppedRecordStats§process_koid: u64§thread_koid: u64Implementations§
Source§impl KTraceBuffer
impl KTraceBuffer
Sourcepub fn new(
buffer: &'static mut Buffer<NoOpAllocator>,
drop_stats: &'static mut DroppedRecordStats,
cpu_ref_header_entry: u16,
process_koid: u64,
thread_koid: u64,
) -> Self
pub fn new( buffer: &'static mut Buffer<NoOpAllocator>, drop_stats: &'static mut DroppedRecordStats, cpu_ref_header_entry: u16, process_koid: u64, thread_koid: u64, ) -> Self
Constructs a KTraceBuffer from a static reference to an existing spsc_buffer::Buffer,
a static reference to DroppedRecordStats, and its metadata.
Sourcepub fn read<F>(&self, copy_fn: F, len: u32) -> Result<u32, Status>where
F: FnMut(u32, &[u8]) -> Result<(), Status>,
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.
Sourcepub fn reserve(&mut self, header: u64) -> Result<KTraceReservation<'_>, Status>
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.
Sourcepub fn emit_drop_stats(&mut self) -> Result<(), Status>
pub fn emit_drop_stats(&mut self) -> Result<(), Status>
Emit the dropped record stats to the trace buffer if we’re currently tracking them.
Sourcepub fn reset_drop_stats(&mut self)
pub fn reset_drop_stats(&mut self)
Resets the dropped records statistics to their initial values.
Trait Implementations§
impl Send for KTraceBuffer
impl Sync for KTraceBuffer
Auto Trait Implementations§
impl !UnwindSafe for KTraceBuffer
impl Freeze for KTraceBuffer
impl RefUnwindSafe for KTraceBuffer
impl Unpin for KTraceBuffer
impl UnsafeUnpin for KTraceBuffer
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Init<T> for T
impl<T> Init<T> for T
§impl<T, U> Into<U> for Twhere
U: From<T>,
impl<T, U> Into<U> for Twhere
U: From<T>,
§impl<T> PinInit<T> for T
impl<T> PinInit<T> for T
§unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
Initializes
slot. Read more§impl<T> ToMutPtr for Twhere
T: ?Sized,
impl<T> ToMutPtr for Twhere
T: ?Sized,
§fn to_mut_ptr(&self) -> *mut T
fn to_mut_ptr(&self) -> *mut T
Casts the reference to a mutable raw pointer.