struct trace_context

Defined at line 52 of file ../../zircon/system/ulib/trace-engine/context_impl.h

Maintains state for a single trace session.

This structure is accessed concurrently from many threads which hold trace

context references.

Implements the opaque type declared in

<trace

-engine/context.h>.

Public Methods

void get_header (trace_buffer_header * dest)

Copy the current header state into dest

Defined at line 59 of file ../../zircon/system/ulib/trace-engine/context_impl.h

size_t min_buffer_size ()

Defined at line 64 of file ../../zircon/system/ulib/trace-engine/context_impl.h

size_t max_buffer_size ()

Defined at line 66 of file ../../zircon/system/ulib/trace-engine/context_impl.h

uint32_t generation ()

Defined at line 68 of file ../../zircon/system/ulib/trace-engine/context_impl.h

trace_handler_t * handler ()

Defined at line 70 of file ../../zircon/system/ulib/trace-engine/context_impl.h

trace_buffering_mode_t buffering_mode ()

Defined at line 72 of file ../../zircon/system/ulib/trace-engine/context_impl.h

uint64_t num_records_dropped ()

Defined at line 74 of file ../../zircon/system/ulib/trace-engine/context_impl.h

bool UsingDurableBuffer ()

Defined at line 78 of file ../../zircon/system/ulib/trace-engine/context_impl.h

bool WasRecordDropped ()

Return true if at least one record was dropped.

Defined at line 81 of file ../../zircon/system/ulib/trace-engine/context_impl.h

void trace_context (void * buffer, size_t buffer_num_bytes, trace_buffering_mode_t buffering_mode, trace_handler_t * handler)

Defined at line 98 of file ../../zircon/system/ulib/trace-engine/context.cc

void ~trace_context ()

Defined at line 112 of file ../../zircon/system/ulib/trace-engine/context.cc

void ResetRollingBufferPointers ()
void ResetBufferPointers ()

Defined at line 245 of file ../../zircon/system/ulib/trace-engine/context.cc

void InitBufferHeader ()

Defined at line 250 of file ../../zircon/system/ulib/trace-engine/context.cc

void ClearEntireBuffer ()

Defined at line 263 of file ../../zircon/system/ulib/trace-engine/context.cc

void ClearRollingBuffers ()

Defined at line 268 of file ../../zircon/system/ulib/trace-engine/context.cc

void UpdateBufferHeaderAfterStopped ()

Defined at line 270 of file ../../zircon/system/ulib/trace-engine/context.cc

void ServiceBuffers ()

Defined at line 281 of file ../../zircon/system/ulib/trace-engine/context.cc

uint64_t * AllocRecord (size_t num_bytes)

Defined at line 114 of file ../../zircon/system/ulib/trace-engine/context.cc

uint64_t * AllocDurableRecord (size_t num_bytes)

Defined at line 154 of file ../../zircon/system/ulib/trace-engine/context.cc

bool AllocThreadIndex (trace_thread_index_t * out_index)

Defined at line 168 of file ../../zircon/system/ulib/trace-engine/context.cc

bool AllocStringIndex (trace_string_index_t * out_index)

Defined at line 179 of file ../../zircon/system/ulib/trace-engine/context.cc

void MarkRollingBufferSaved (uint32_t wrapped_count, uint64_t durable_data_end)

This is called by the handler when it has been notified that a buffer

has been saved.

|wrapped_count| is the wrapped count at the time the buffer save request

was made. Similarly for |durable_data_end|.

Defined at line 345 of file ../../zircon/system/ulib/trace-engine/context.cc

void FlushBuffer ()

Requests to prepare the buffer to be read. Only has effect in streaming mode.

Normally streaming mode only sends data once it has enough data to require a buffer swap and

data flush. This produces fewer, but larger and bursty data transfers. Some clients may want

more regular smaller data transfers. These clients may instead manually invoke FlushBuffer

whenever they are ready for data.

Once received, trace-engine will prepare the buffer to be read, and send a callback

requesting a buffer save when it is ready.

Defined at line 353 of file ../../zircon/system/ulib/trace-engine/context.cc

void HandleSaveRollingBufferRequest (uint32_t wrapped_count, uint64_t durable_data_end)

This is only called from the engine to initiate a buffer save.

Defined at line 333 of file ../../zircon/system/ulib/trace-engine/context.cc