class RollingBuffer

Defined at line 140 of file ../../zircon/system/ulib/trace-engine/rolling_buffer.h

Public Members

static const size_t kRollingBufferSizeBits
static const size_t kMaxRollingBufferSize

Public Methods

AllocationResult AllocRecord (size_t num_bytes)

Allocate data from the configured buffer. Thread safe.

When we allocate data, we may get:

1) A successful Allocation. We may write our data into the provided pointer.

2) A successful SwitchingAllocation. We may write out data into the provided pointer. However,

this also contains a notification that the previous buffer was full and requires servicing,

as well as includes the state of the buffer directly before writing the record. This is

guaranteed to be returned only once per wrap count.

SAFETY: This notification means that the buffer has filled, but there may still be active

writers in the buffer. The receiver is responsible for ensuring that all writes are complete

before attempting to read or service the buffer.

3) A failure with BufferFull. There's no room in either buffer, and we're waiting for someone

to service the buffers so there's nothing to do.

Defined at line 77 of file ../../zircon/system/ulib/trace-engine/rolling_buffer.cc

size_t BytesAllocated ()

Return the total number of allocated bytes in the current buffer.

Defined at line 43 of file ../../zircon/system/ulib/trace-engine/rolling_buffer.cc

void Reset ()

Set the allocation pointer back to the beginning of the buffer and consider it to be empty.

Defined at line 41 of file ../../zircon/system/ulib/trace-engine/rolling_buffer.cc

bool SetBufferServiced (uint32_t wrapped_count)

Mark that we are done with this buffer, freeing the space for more writes.

SAFETY: Caller is responsible for ensuring that there are no remaining active writers in this

buffer before calling this.

Defined at line 61 of file ../../zircon/system/ulib/trace-engine/rolling_buffer.cc

void SetBufferFull ()

Mark the currently set buffer as full.

Defined at line 48 of file ../../zircon/system/ulib/trace-engine/rolling_buffer.cc

void SetOneshotBuffer (std::span<uint8_t> buffer)

Defined at line 142 of file ../../zircon/system/ulib/trace-engine/rolling_buffer.h

void SetDoubleBuffers (std::span<uint8_t> buffer0, std::span<uint8_t> buffer1)

Defined at line 147 of file ../../zircon/system/ulib/trace-engine/rolling_buffer.h

size_t BufferSize (BufferNumber idx)

Get the per-buffer size of the rolling buffers

Defined at line 174 of file ../../zircon/system/ulib/trace-engine/rolling_buffer.h

size_t MaxBufferSize ()

Get the total size of all the rolling buffers

Defined at line 179 of file ../../zircon/system/ulib/trace-engine/rolling_buffer.h

RollingBufferState State ()

Defined at line 183 of file ../../zircon/system/ulib/trace-engine/rolling_buffer.h