SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
|
Basic instrumentation profiler for Google Chrome tracing format. More...
#include <Instrumentor.h>
Public Member Functions | |
Instrumentor () | |
void | beginSession (const std::string &name, const bool storeInMemory=false, const std::string &filePath="Profiling-Results.json") |
void | endSession () |
void | addProfile (const ProfileResult &result) |
void | writeProfile (const ProfileResult &result) |
void | writeHeader () |
void | writeFooter () |
std::string | filePath () |
Static Public Member Functions | |
static Instrumentor & | get () |
Private Attributes | |
InstrumentationSession * | _currentSession |
std::string | _filePath |
std::ofstream | _outputStream |
int | _profileCount |
std::mutex | _mutex |
bool | _storeInMemory = false |
std::vector< ProfileResult > | _profileResults |
Basic instrumentation profiler for Google Chrome tracing format.
Usage: include this header file somewhere in your code. In your most outer function (e.g. main) you have to begin profiling session with: Instrumentor::get().beginSession("Session Name"); If you pass storeInMemory=true the profileResults will be stored in memory instead of being written into the file stream which is pretty slow. Of course the in memory storage can quickly use a lot of memory depending how fine grained your profiling is. In app-demo this is done in slCreateApp.
In between you can add either PROFILE_FUNCTION(); at the beginning of any routine or PROFILE_SCOPE(scopeName) at the beginning of any scope you want to measure.
At the end of your most outer function (e.g. main) you end the session with: Instrumentor::get().endSession();
After the endSession you can drag the Profiling-Results.json file into the chrome://tracing page of the Google Chrome browser. In app-demo this is done in SLInterface::slTerminate.
Definition at line 77 of file Instrumentor.h.
|
inline |
Definition at line 80 of file Instrumentor.h.
|
inline |
addProfile should be as fast as possible for not influencing the profiling by the profiler itself. In addition it must be thread safe.
Definition at line 119 of file Instrumentor.h.
|
inline |
Definition at line 82 of file Instrumentor.h.
|
inline |
Definition at line 97 of file Instrumentor.h.
|
inline |
Definition at line 174 of file Instrumentor.h.
|
inlinestatic |
Definition at line 168 of file Instrumentor.h.
|
inline |
Definition at line 162 of file Instrumentor.h.
|
inline |
Definition at line 156 of file Instrumentor.h.
|
inline |
Definition at line 133 of file Instrumentor.h.
|
private |
Definition at line 178 of file Instrumentor.h.
|
private |
Definition at line 179 of file Instrumentor.h.
|
private |
Definition at line 182 of file Instrumentor.h.
|
private |
Definition at line 180 of file Instrumentor.h.
|
private |
Definition at line 181 of file Instrumentor.h.
|
private |
Definition at line 184 of file Instrumentor.h.
|
private |
Definition at line 183 of file Instrumentor.h.