SLProject 4.0.000
|
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-SLProject this is done in SLInterface::slCreateAppAndScene.
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-SLProject this is done in SLInterface::slTerminate.
|
inline |
|
inline |
addProfile should be as fast as possible for not influencing the profiling by the profiler itself. In addition it must be thread safe.
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
inline |
|
inline |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |