Yaets
Loading...
Searching...
No Matches
TraceSession Class Reference

Class to manage a trace session. More...

#include <tracing.hpp>

Public Member Functions

void register_trace (const std::string &trace_name, const std::chrono::nanoseconds &start_time, const std::chrono::nanoseconds &end_time)
 Register a new trace event.
 
void stop ()
 Stop the trace session and flush remaining trace events to the file.
 
 TraceSession (const std::string &filename)
 Construct a new TraceSession object.
 
 ~TraceSession ()
 Destroy the TraceSession object and stop tracing.
 

Detailed Description

Class to manage a trace session.

A TraceSession manages the collection of trace events and stores them in a queue. It also handles the writing of the trace events to a file asynchronously via a separate consumer thread.

Constructor & Destructor Documentation

◆ TraceSession()

TraceSession ( const std::string & filename)
explicit

Construct a new TraceSession object.

Parameters
filenameThe name of the file to write the trace events to.

◆ ~TraceSession()

Destroy the TraceSession object and stop tracing.

Member Function Documentation

◆ register_trace()

void register_trace ( const std::string & trace_name,
const std::chrono::nanoseconds & start_time,
const std::chrono::nanoseconds & end_time )

Register a new trace event.

This function is called by TraceGuard to register the start and end time of a function execution.

Parameters
trace_nameThe name of the function being traced.
start_timeThe start time of the function execution.
end_timeThe end time of the function execution.

◆ stop()

void stop ( )

Stop the trace session and flush remaining trace events to the file.


The documentation for this class was generated from the following files: