Skip to content

tenzr::profiler::ScopedTrace

RAII helper that records a duration for its enclosing scope.

#include <trace.h>

Public Functions

Name
ScopedTrace(std::string name, std::string cat ="op")
void AddArg(std::string key, std::string value)
~ScopedTrace()
int64_t CurrentTimeUs()
uint64_t GetTid()

Public Functions Documentation

function ScopedTrace

inline explicit ScopedTrace(
    std::string name,
    std::string cat ="op"
)

function AddArg

inline void AddArg(
    std::string key,
    std::string value
)

Parameters:

  • key Argument name.
  • value Argument value.

Attach an argument to the recorded event.

function ~ScopedTrace

inline ~ScopedTrace()

function CurrentTimeUs

static int64_t CurrentTimeUs()

Return:

  • Current wall-clock time in microseconds.
  • Microseconds since the clock epoch.

Current wall-clock time in microseconds.

function GetTid

static uint64_t GetTid()

Return:

  • Identifier of the calling thread.
  • Stable per-thread identifier.

Hash of the calling thread's id, used as the trace thread id.