Death::Trace namespace

Runtime event tracing implementation, should be used along with Asserts.h.

Classes

class BacktraceStorage
Storage for deferred transit events.
class Logger
Logger enqueues trace items for processing.
class LoggerBackend
Logger backend processes trace items in the background.
class ScopedThreadContext
Handles lifetime of the thread context.
class ThreadContext
Stores information about the current thread and allows to receive logged entries.
class ThreadContextManager
Manages thread contexts for LoggerBackend.
struct TransitEvent
Stores required information about a logged entry to be dispatched to sinks.
class TransitEventBuffer
Circular buffer for transit events.

Functions

void AttachSink(ITraceSink* sink)
Registers the sink and initializes the event logger if no sink was attached before.
void RemoveSink(ITraceSink* sink)
Unregisters the sink and uninitializes the event logger if no sink left.
void Flush() noexcept
Waits until all prior entries are written to all sinks.
void InitializeBacktrace(std::uint32_t maxCapacity, TraceLevel flushLevel = TraceLevel::Unknown)
Initializes the backtrace storage for entries logged with TraceLevel::Deferred.
void FlushBacktraceAsync() noexcept
Writes any deferred entries stored in the backtrace storage to all sinks asynchronously.
void ShrinkThreadLocalQueue(std::size_t capacity) noexcept
Shrinks the thread-local queue to the specified target capacity.
auto GetThreadLocalQueueCapacity() -> std::size_t noexcept
Returns the current capacity of the thread-local queue.

Function documentation

void Death::Trace::AttachSink(ITraceSink* sink)

Registers the sink and initializes the event logger if no sink was attached before.

void Death::Trace::RemoveSink(ITraceSink* sink)

Unregisters the sink and uninitializes the event logger if no sink left.

void Death::Trace::Flush() noexcept

Waits until all prior entries are written to all sinks.

All enqueued entries from all threads will be processed, after which all sinks will be flushed. Deferred entries in the backtrace storage will not be affected, see FlushBacktraceAsync().

void Death::Trace::InitializeBacktrace(std::uint32_t maxCapacity, TraceLevel flushLevel = TraceLevel::Unknown)

Initializes the backtrace storage for entries logged with TraceLevel::Deferred.

If the backtrace storage is not initialized, all deferred entries are written immediately to all sinks. After initialization, deferred entries are stored in the backtrace storage and written to sinks only when the backtrace is flushed. Flush can be triggered by calling FlushBacktraceAsync() or automatically when an entry with a level equal or higher than the flush level is enqueued.

void Death::Trace::FlushBacktraceAsync() noexcept

Writes any deferred entries stored in the backtrace storage to all sinks asynchronously.

void Death::Trace::ShrinkThreadLocalQueue(std::size_t capacity) noexcept

Shrinks the thread-local queue to the specified target capacity.

This function is only available with asynchronous tracing enabled, see DEATH_TRACE_ASYNC in Advanced parameters.

std::size_t Death::Trace::GetThreadLocalQueueCapacity() noexcept

Returns the current capacity of the thread-local queue.

This function is only available with asynchronous tracing enabled, see DEATH_TRACE_ASYNC in Advanced parameters.