slang::TimeTrace class

Support for performance profiling via hierarchical time tracing.

Record events with beginTrace and endTrace and then dump the results to file with write for viewing with the Chrome Profiler.

Public static functions

static auto isEnabled() -> bool
Indicates whether tracing has been enabled or not.
static void initialize()
Initializes time tracing support.
static void write(std::ostream& os)
Writes the results of time tracing to the given stream.
static void beginTrace(std::string_view name, std::string_view detail)
Starts tracing a section.
static void beginTrace(std::string_view name, function_ref<std::string()> detail)
Starts tracing a section.
static void endTrace()
Ends tracing a section previously started by beginTrace.

Function documentation

static void slang::TimeTrace::write(std::ostream& os)

Writes the results of time tracing to the given stream.

The output is JSON, in Chrome "Trace Event" format, see https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview

static void slang::TimeTrace::beginTrace(std::string_view name, std::string_view detail)

Starts tracing a section.

Parameters
name the name of the section
detail extra details to include in the trace about the section

static void slang::TimeTrace::beginTrace(std::string_view name, function_ref<std::string()> detail)

Starts tracing a section.

Parameters
name the name of the section
detail extra details to include in the trace about the section