class BufferForwarder

Defined at line 17 of file ../../src/performance/trace_manager/buffer_forwarder.h

Public Members

static const size_t kBytesWrittenLoggingInterval
static const size_t kDefaultSocketBackpressurePercentage

Protected Members

socket destination_
size_t backpressure_percentage_

Public Methods

bool IsSocketBackpressureExceeded ()

Checks if unread streaming buffers in the socket exceed the backpressure threshold.

Defined at line 15 of file ../../src/performance/trace_manager/buffer_forwarder.cc

TransferStatus WaitForSocketDrain ()

Pauses until unread socket buffers drain below the backpressure threshold.

Defined at line 24 of file ../../src/performance/trace_manager/buffer_forwarder.cc

void BufferForwarder (zx::socket destination, size_t backpressure_percentage)

Defined at line 29 of file ../../src/performance/trace_manager/buffer_forwarder.h

size_t backpressure_percentage ()

Get or set the socket backpressure percentage threshold.

Defined at line 34 of file ../../src/performance/trace_manager/buffer_forwarder.h

void set_backpressure_percentage (size_t percentage)

Defined at line 35 of file ../../src/performance/trace_manager/buffer_forwarder.h

TransferStatus WriteMagicNumberRecord ()

Write the FxT Magic Bytes to the underlying socket.

Defined at line 41 of file ../../src/performance/trace_manager/buffer_forwarder.cc

TransferStatus WriteProviderInfoRecord (uint32_t provider_id, const std::string & name)

Defined at line 54 of file ../../src/performance/trace_manager/buffer_forwarder.cc

TransferStatus Flush ()

Defined at line 68 of file ../../src/performance/trace_manager/buffer_forwarder.h

void ~BufferForwarder ()

Defined at line 69 of file ../../src/performance/trace_manager/buffer_forwarder.h

TransferStatus WriteProviderSectionRecord (uint32_t provider_id)

Defined at line 69 of file ../../src/performance/trace_manager/buffer_forwarder.cc

TransferStatus WriteProviderBufferOverflowEvent (uint32_t provider_id)

Defined at line 80 of file ../../src/performance/trace_manager/buffer_forwarder.cc

TransferStatus WriteChunkBy (ForwardStrategy strategy, const zx::vmo & vmo, size_t vmo_offset, size_t size)

Write the records in |buffer| at |vmo_offset| to the output. |size| is the size in bytes of the

chunk to examine, which may be more than was written if |strategy| is

`ForwardStrategy::Record`. It must always be a multiple of 8.

In oneshot mode we assume the end of written records don't look like records and we can just

run through the buffer examining records to compute how many are there. This is problematic

(without extra effort) in circular and streaming modes as records are written and rewritten.

This function handles both cases. If |strategy| is ForwardStrategy::Record then run through the

buffer computing the size of each record until we find no more records. If |strategy| is

ForwardStrategy::Size then |size| is the number of bytes to write.

Defined at line 117 of file ../../src/performance/trace_manager/buffer_forwarder.cc

Protected Methods

TransferStatus WriteBuffer (cpp20::span<const uint8_t> data)

Writes the contents of |data| to the output socket. Returns

TransferStatus::kComplete if the entire buffer has been

successfully transferred. A return value of

TransferStatus::kReceiverDead indicates that the peer was closed

during the transfer.

Defined at line 165 of file ../../src/performance/trace_manager/buffer_forwarder.cc

Enumerations

enum class ForwardStrategy : _Bool
Name Value
Size 0
Records 1

Defined at line 50 of file ../../src/performance/trace_manager/buffer_forwarder.h