class FxtWriter
Defined at line 42 of file ../../src/performance/cpu_profiler/fxt_writer.h
Writes FXT records to a socket without ever blocking the calling thread.
The profiler services thread and process start/exit exceptions for every profiled task on the
same dispatcher that writes samples out. Those exceptions keep the starting or exiting thread
paused until they are handled, so blocking on a full socket (e.g. because the host is draining
it slowly) stalls thread creation and teardown in every profiled process. Instead, records that
do not fit in the socket are buffered in memory and drained asynchronously on `dispatcher` as
the socket becomes writable.
All methods must be called on `dispatcher`.
Public Members
static const size_t kDefaultMaxBufferedBytes
Public Methods
void FxtWriter (zx::socketsocket,async_dispatcher_t *dispatcher,size_tmax_buffered_bytes)
Defined at line 35 of file ../../src/performance/cpu_profiler/fxt_writer.cc
void ~FxtWriter ()
Defined at line 42 of file ../../src/performance/cpu_profiler/fxt_writer.cc
void FxtWriter (const FxtWriter & )
Defined at line 52 of file ../../src/performance/cpu_profiler/fxt_writer.h
zx::result<FxtRecordBuffer> Reserve (uint64_t header)
Defined at line 52 of file ../../src/performance/cpu_profiler/fxt_writer.cc
FxtWriter & operator= (const FxtWriter & )
Defined at line 53 of file ../../src/performance/cpu_profiler/fxt_writer.h
void Write (const void * data, size_t num_bytes)
Write a complete record. The record is either written in full (possibly asynchronously) or
dropped in full; it is never truncated.
Defined at line 56 of file ../../src/performance/cpu_profiler/fxt_writer.cc
size_t buffered_bytes ()
Defined at line 65 of file ../../src/performance/cpu_profiler/fxt_writer.h
uint64_t dropped_records ()
Defined at line 66 of file ../../src/performance/cpu_profiler/fxt_writer.h
void FlushAndClose (std::unique_ptr<FxtWriter> writer)
Stop accepting records and close the socket once all buffered data has been written or the
peer has gone away. The writer keeps itself alive on its dispatcher until then.
Defined at line 186 of file ../../src/performance/cpu_profiler/fxt_writer.cc