TimeTrace class
#include <slang/util/TimeTrace.h>
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 bool isEnabled()
- Indicates whether tracing has been enabled or not.
- static void initialize()
- Initializes time tracing support.
- static void destroy()
- Turns off time tracing and destroys all resources for it.
-
static void write(std::
ostream& os) - Writes the results of time tracing to the given stream.
-
static int64_t getDurationForKey(std::
string_view name) - Gets the duration logged for the given trace key, or zero if such a key has not been traced.
-
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:/
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 |