SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
|
A timer for profiling functions and scopes. More...
#include <Profiler.h>
Public Member Functions | |
ProfilerTimer (const char *name) | |
~ProfilerTimer () | |
Private Attributes | |
const char * | _name |
uint32_t | _depth |
std::chrono::time_point< std::chrono::high_resolution_clock > | _startPoint |
bool | _running |
Static Private Attributes | |
static constexpr uint32_t | INVALID_THREAD_ID = -1 |
static thread_local uint32_t | threadId = INVALID_THREAD_ID |
static thread_local uint32_t | threadDepth = 0 |
Friends | |
class | Profiler |
A timer for profiling functions and scopes.
This class should be instantiated at the start of functions and scopes that should be profiled. The object will record the current time at it's construction and the current time at it's destruction (when the scope ends) and the depth in the call stack. The destructor automatically calls Profiler::instance().recordResult().
Definition at line 101 of file Profiler.h.
|
explicit |
Constructor for ProfilerTimer that saves the current time as the start time, the thread-local depth as the scope depth and increases the thread-local depth since we have just entered a scope. PROFILE_THREAD must be called in the current thread before this function or else the current thread can't be identified and the application exits.
name | Name of the scope |
Definition at line 187 of file Profiler.cpp.
ProfilerTimer::~ProfilerTimer | ( | ) |
Destructor for ProfilerTimer that creates a ProfilingResult with the scope name, the depth, the start time, the current time as the end time and the current thread ID. The ProfilingResult is then registered with the Profiler and the thread-local depth is decreased since we have just exited a scope.
Definition at line 213 of file Profiler.cpp.
|
friend |
Definition at line 103 of file Profiler.h.
|
private |
Definition at line 115 of file Profiler.h.
|
private |
Definition at line 114 of file Profiler.h.
|
private |
Definition at line 117 of file Profiler.h.
|
private |
Definition at line 116 of file Profiler.h.
|
staticconstexprprivate |
Definition at line 110 of file Profiler.h.
|
staticprivate |
Definition at line 112 of file Profiler.h.
|
staticprivate |
Definition at line 111 of file Profiler.h.