MIRA
|
The main Profiler class. More...
#include <utils/Profiler.h>
Classes | |
struct | Scope |
Public Types | |
typedef Base::Type | Type |
Public Member Functions | |
Profiler () | |
~Profiler () | |
double | getCPUSpeed () |
Returns the set or calibrated CPU speed (in cycles/second i.e. More... | |
void | setCPUSpeed (double speed) |
Overwrites the calibrated CPU speed with the specified value (in Hz!). More... | |
Static Public Member Functions | |
static void | writeReport (const std::string &directory, const std::string &dotCommand="", const std::string &imgFormat="png") |
static uint64 | getCycleCount () |
static Type & | instance () |
Returns a reference to the singleton instance. More... | |
static bool | isDestroyed () |
Returns true, if the singleton was already destroyed. More... | |
Static Protected Member Functions | |
static Type * | makeInstance () |
static void | destroyInstance (void) |
Friends | |
struct | ThreadInfo |
The main Profiler class.
This class is used as singleton. The global instance can be obtained using Profiler::instance().
USAGE:
Add a pair of MIRA_PROFILE_BEGIN and MIRA_PROFILE_END macros around the code you want to profile, or add the MIRA_PROFILE_SCOPE macro into the scope of code you want to profile (see example below). To enable profiling add the following compiler option:
e.g. by adding
to your CMakeLists.txt file.
EXAMPLE:
Within the for-loop the MIRA_PROFILE_SCOPE macro is used to profile the execution time of the code within the for-loop. However, sometimes you need more control where to place the start and ending point of the timing measurements. In these cases you can use the MIRA_PROFILE_BEGIN and MIRA_PROFILE_END macro pair.
|
inherited |
Profiler | ( | ) |
~Profiler | ( | ) |
|
inlinestatic |
double getCPUSpeed | ( | ) |
Returns the set or calibrated CPU speed (in cycles/second i.e.
Hz). If this function is called the first time AND setCPUSpeed was not called before, the CPU speed will be calibrated automatically by sleeping one second.
|
inline |
Overwrites the calibrated CPU speed with the specified value (in Hz!).
|
inlinestatic |
|
inlinestaticinherited |
Returns a reference to the singleton instance.
XSingleton | If the singleton was already destroyed (dead reference) or not yet created (when using ExplicitInstantiation). |
|
inlinestaticinherited |
Returns true, if the singleton was already destroyed.
Trying to access it will result in an exception.
|
inlinestaticprotectedinherited |
|
inlinestaticprotectedinherited |
|
friend |