class Buffer
Defined at line 27 of file ../../zircon/kernel/lib/percpu_writer/include/lib/percpu_writer/buffer.h
percpu_writer::Buffer wraps an SpscBuffer and adds functionality to track dropped trace records.
Public Members
SpscBuffer buffer_
optional first_dropped_
optional last_dropped_
uint32_t num_dropped_
uint32_t bytes_dropped_
uint32_t size_
ThreadRef cpu_ref_
Public Methods
zx_status_t Init (uint32_t size, const char * buffer_name, fxt::ThreadRef<fxt::RefType::kInline> assigned_cpu_ref)
Initializes the underlying SpscBuffer and metadata.
Defined at line 100 of file ../../zircon/kernel/lib/percpu_writer/include/lib/percpu_writer/buffer.h
void Drain ()
Drains the underlying SpscBuffer.
Defined at line 109 of file ../../zircon/kernel/lib/percpu_writer/include/lib/percpu_writer/buffer.h
template <CopyOutFunction CopyFunc>
zx::result<uint32_t> Read (CopyFunc copy_fn, uint32_t len)
Reads from the underlying SpscBuffer.
Defined at line 113 of file ../../zircon/kernel/lib/percpu_writer/include/lib/percpu_writer/buffer.h
zx::result<Reservation> Reserve (uint64_t header)
We interpose ourselves in the Reserve path to ensure that we can emit a record containing
the dropped records statistics if we need to.
Defined at line 119 of file ../../zircon/kernel/lib/percpu_writer/include/lib/percpu_writer/buffer.h
zx_status_t EmitDropStats ()
Emit the dropped record stats to the trace buffer.
If we're not tracking a run of dropped records, this is a no-op.
Defined at line 163 of file ../../zircon/kernel/lib/percpu_writer/include/lib/percpu_writer/buffer.h
void ResetDropStats ()
Resets the dropped records statistics to their initial values.
This is used to clear the stats after they've been emitted to a trace buffer.
Defined at line 191 of file ../../zircon/kernel/lib/percpu_writer/include/lib/percpu_writer/buffer.h
uint32_t Size ()
Defined at line 198 of file ../../zircon/kernel/lib/percpu_writer/include/lib/percpu_writer/buffer.h
DroppedRecordDurationEvent SerializeDropStats ()
Serializes the dropped record statistics into a DroppedRecordDurationEvent.
Defined at line 221 of file ../../zircon/kernel/lib/percpu_writer/include/lib/percpu_writer/buffer.h
void TrackDroppedRecord (uint32_t size)
Adds a dropped record of the given size to the tracked statistics.
Defined at line 254 of file ../../zircon/kernel/lib/percpu_writer/include/lib/percpu_writer/buffer.h