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_

Public Methods

const DroppedRecordStats & drop_stats ()

LINT.ThenChange(//zircon/kernel/lib/ktrace/src/lib.rs:DroppedRecordStats)

Defined at line 69 of file ../../zircon/kernel/lib/percpu_writer/include/lib/percpu_writer/buffer.h

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 141 of file ../../zircon/kernel/lib/percpu_writer/include/lib/percpu_writer/buffer.h

void Drain ()

Drains the underlying SpscBuffer.

Defined at line 150 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 154 of file ../../zircon/kernel/lib/percpu_writer/include/lib/percpu_writer/buffer.h

BufferImpl * spsc_buffer ()

Returns a pointer to the underlying SpscBuffer.

Defined at line 159 of file ../../zircon/kernel/lib/percpu_writer/include/lib/percpu_writer/buffer.h

DroppedRecordStats * drop_stats_ptr ()

Returns a pointer to the dropped record statistics.

Defined at line 162 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 166 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 209 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 237 of file ../../zircon/kernel/lib/percpu_writer/include/lib/percpu_writer/buffer.h

uint32_t Size ()

Defined at line 239 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 264 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 299 of file ../../zircon/kernel/lib/percpu_writer/include/lib/percpu_writer/buffer.h

Records