Public Member Functions | |
void | beginProfile (const std::string &name, bool isSystemProfile=false) |
void | endProfile (const std::string &name, bool isSystemProfile=false) |
void | reset () |
void | logResults (Log::LogTarget lt=Log::LOG_APP) |
NR_FORCEINLINE void | enable () |
NR_FORCEINLINE void | disable () |
NR_FORCEINLINE bool | isEnabled () |
void | setEnable (bool enable) |
NR_FORCEINLINE void | setEnableEngineProfiling (bool e) |
NR_FORCEINLINE bool | isEnabledEngineProfiling () const |
Friends | |
class | Engine |
Only engine can create instance of profiler. | |
Data Structures | |
struct | ProfileFrame |
Represents the total timing information of a profile since profiles can be called more than once each frame. | |
struct | ProfileHistory |
Represents a history of each profile during the duration of the app. | |
struct | ProfileInstance |
Represents an individual profile call. |
Profiler is a singleton object which is created by initializing the engine. Profiler does use a time source provide system time to allow to measure the time differencies.
Profiling is done stack wise. It means every time you starting a profile it will go onto the stack. Every time the profile is ending top most profile from the stack is removed and statistics is computed for it. Every time the stack is empty we compute the whole statistics for each profiles. The time in that the stack is not empty is called frame. We assume that you always profiles framewise.
Definition at line 118 of file Profiler.h.
void nrEngine::Profiler::beginProfile | ( | const std::string & | name, | |
bool | isSystemProfile = false | |||
) |
Begin of profiling. Please use NR_ProfileBegin(name) macro instead of this function, so it can be removed in the release version of you application
name | Unique name of the profile | |
isSystemProfile | Define if the profile is build for the engine |
Definition at line 59 of file Profiler.cpp.
References NR_ASSERT.
Referenced by nrEngine::Profile::Profile().
void nrEngine::Profiler::endProfile | ( | const std::string & | name, | |
bool | isSystemProfile = false | |||
) |
End a profiling for the given profiling scope/name Please use NR_ProfileEnd(name) macro instead of directly calling this function.
name | Unique name of the profile | |
isSystemProfile | Set to true if the profile is created for the engine |
Definition at line 155 of file Profiler.cpp.
References NR_ASSERT.
Referenced by nrEngine::Profile::~Profile().
void nrEngine::Profiler::reset | ( | ) |
Reset the profiler, so we clear all currently using profilers.
Definition at line 300 of file Profiler.cpp.
void nrEngine::Profiler::logResults | ( | Log::LogTarget | lt = Log::LOG_APP |
) |
Log current profile statistics to the log
Definition at line 312 of file Profiler.cpp.
NR_FORCEINLINE void nrEngine::Profiler::enable | ( | ) |
Enable the profiling
Definition at line 155 of file Profiler.h.
NR_FORCEINLINE void nrEngine::Profiler::disable | ( | ) |
Disable profiling
Definition at line 160 of file Profiler.h.
NR_FORCEINLINE bool nrEngine::Profiler::isEnabled | ( | ) |
Is profiler enabled
Definition at line 165 of file Profiler.h.
void nrEngine::Profiler::setEnable | ( | bool | enable | ) |
Set profiler enable/disable state
Definition at line 288 of file Profiler.cpp.
NR_FORCEINLINE void nrEngine::Profiler::setEnableEngineProfiling | ( | bool | e | ) |
Enable or disable profiling of the system components. If you enable this all engine components calling the profiler will be counted in the statistics. Otherwise the engine does not produce any profile information
Definition at line 178 of file Profiler.h.
NR_FORCEINLINE bool nrEngine::Profiler::isEnabledEngineProfiling | ( | ) | const |
Get information about engine profiling status. If true, so engine's components are getting profiled. Otherwise no.
Definition at line 184 of file Profiler.h.