Class NamedSharedTrace

Class Documentation

class NamedSharedTrace

Class to manage shared traces across different parts of the code.

The NamedSharedTrace class allows tracing events that can occur in various parts of the code and logs both start and end times to a shared TraceSession. It supports concurrent operations and capacity handling.

Public Functions

NamedSharedTrace(TraceSession &session, const std::string &trace_name)

Construct a new NamedSharedTrace object.

Initializes a named trace session that can be started and ended across different locations.

Parameters:
  • session – The TraceSession associated with the trace events.

  • trace_name – The name of the trace event being recorded.

void start()

Start a new trace event.

Records the start time of a trace event in a thread-safe manner.

void end()

End the current trace event.

Records the end time of a trace event and registers it with the TraceSession. Ensures that a corresponding start time exists.

Public Static Attributes

static const size_t TRACE_SIZE_INIT = 100

Initial size for the start_times_ vector.