Class TraceRegistry

Class Documentation

class TraceRegistry

Singleton class to manage global NamedSharedTrace instances.

The TraceRegistry maintains a collection of NamedSharedTrace instances, identified by unique IDs, allowing traces to be started and ended globally through macros and without explicit object references.

Public Functions

void registerTrace(const std::string &id, TraceSession &session)

Register a new NamedSharedTrace with a unique identifier.

This function registers a NamedSharedTrace instance associated with a given ID and TraceSession, allowing the trace to be managed globally.

Parameters:
  • id – The unique identifier for the trace.

  • session – The TraceSession associated with the trace.

void startTrace(const std::string &id)

Start a trace identified by a unique ID.

This function starts the NamedSharedTrace associated with the given ID, marking the beginning of a traced section.

Parameters:

id – The unique identifier for the trace to start.

void endTrace(const std::string &id)

End a trace identified by a unique ID.

This function ends the NamedSharedTrace associated with the given ID, marking the end of a traced section.

Parameters:

id – The unique identifier for the trace to end.

Public Static Functions

static inline TraceRegistry &getInstance()

Retrieve the singleton instance of the TraceRegistry.

This function returns the single, globally accessible instance of the TraceRegistry.

Returns:

The singleton instance of TraceRegistry.