The profiler allows you to measure the performance of your code. More...
#include <OgreProfiler.h>
Classes | |
struct | ProfileFrame |
Represents the total timing information of a profile since profiles can be called more than once each frame. More... | |
struct | ProfileHistory |
Represents a history of each profile during the duration of the app. More... | |
class | ProfileInstance |
Represents an individual profile call. More... | |
Public Types | |
enum | DisplayMode { DISPLAY_PERCENTAGE, DISPLAY_MILLISECONDS } |
Public Member Functions | |
Profiler () | |
~Profiler () | |
void | setTimer (Timer *t) |
Sets the timer for the profiler. | |
Timer * | getTimer () |
Retrieves the timer for the profiler. | |
void | beginProfile (const String &profileName, uint32 groupID=(uint32) OGREPROF_USER_DEFAULT) |
Begins a profile. | |
void | endProfile (const String &profileName, uint32 groupID=(uint32) OGREPROF_USER_DEFAULT) |
Ends a profile. | |
void | beginGPUEvent (const String &event) |
Mark the beginning of a GPU event group. | |
void | endGPUEvent (const String &event) |
Mark the end of a GPU event group. | |
void | markGPUEvent (const String &event) |
Mark a specific, ungrouped, GPU event. | |
void | setEnabled (bool enabled) |
Sets whether this profiler is enabled. | |
bool | getEnabled () const |
Gets whether this profiler is enabled. | |
void | enableProfile (const String &profileName) |
Enables a previously disabled profile. | |
void | disableProfile (const String &profileName) |
Disables a profile. | |
void | setProfileGroupMask (uint32 mask) |
Set the mask which all profiles must pass to be enabled. | |
uint32 | getProfileGroupMask () const |
Get the mask which all profiles must pass to be enabled. | |
bool | watchForMax (const String &profileName) |
Returns true if the specified profile reaches a new frame time maximum. | |
bool | watchForMin (const String &profileName) |
Returns true if the specified profile reaches a new frame time minimum. | |
bool | watchForLimit (const String &profileName, Real limit, bool greaterThan=true) |
Returns true if the specified profile goes over or under the given limit frame time. | |
void | logResults () |
Outputs current profile statistics to the log. | |
void | reset () |
Clears the profiler statistics. | |
void | setDisplayMode (DisplayMode d) |
Set the display mode for the overlay. | |
DisplayMode | getDisplayMode () const |
Get the display mode for the overlay. | |
void | setUpdateDisplayFrequency (uint freq) |
Sets the Profiler so the display of results are updated every n frames. | |
uint | getUpdateDisplayFrequency () const |
Gets the frequency that the Profiler display is updated. | |
void | setOverlayDimensions (Real width, Real height) |
Set the size of the profiler overlay, in pixels. | |
void | setOverlayPosition (Real left, Real top) |
Set the position of the profiler overlay, in pixels. | |
Real | getOverlayWidth () const |
Real | getOverlayHeight () const |
Real | getOverlayLeft () const |
Real | getOverlayTop () const |
void * | operator new (size_t sz, const char *file, int line, const char *func) |
operator new, with debug line info | |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *ptr) |
placement operator new | |
void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
array operator new, with debug line info | |
void * | operator new[] (size_t sz) |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, void *) |
void | operator delete (void *ptr, const char *, int, const char *) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *ptr, const char *, int, const char *) |
Static Public Member Functions | |
static Profiler & | getSingleton (void) |
Override standard Singleton retrieval. | |
static Profiler * | getSingletonPtr (void) |
Override standard Singleton retrieval. | |
Protected Types | |
typedef list< OverlayElement * > ::type | ProfileBarList |
typedef set< String >::type | DisabledProfileMap |
typedef ProfileInstance::ProfileChildren | ProfileChildren |
Protected Member Functions | |
void | initialize () |
Initializes the profiler's GUI elements. | |
void | displayResults (void) |
void | displayResults (ProfileInstance *instance, ProfileBarList::iterator &bIter, Real &maxTimeMillisecs, Real &newGuiHeight, int &profileCount) |
Prints the profiling results of each frame. | |
void | processFrameStats (void) |
Processes frame stats for all of the mRoot's children. | |
void | processFrameStats (ProfileInstance *instance, Real &maxFrameTime) |
Processes specific ProfileInstance and it's children recursively. | |
void | changeEnableState () |
Handles a change of the profiler's enabled state. | |
OverlayContainer * | createContainer () |
An internal function to create the container which will hold our display elements. | |
OverlayElement * | createTextArea (const String &name, Real width, Real height, Real top, Real left, uint fontSize, const String &caption, bool show=true) |
An internal function to create a text area. | |
OverlayElement * | createPanel (const String &name, Real width, Real height, Real top, Real left, const String &materialName, bool show=true) |
An internal function to create a panel. | |
Protected Attributes | |
ProfileInstance * | mCurrent |
ProfileInstance * | mLast |
ProfileInstance | mRoot |
DisabledProfileMap | mDisabledProfiles |
Holds the names of disabled profiles. | |
ProfileBarList | mProfileBars |
Holds the display bars for each profile results. | |
bool | mInitialized |
Whether the GUI elements have been initialized. | |
uint | mMaxDisplayProfiles |
The max number of profiles we can display. | |
Overlay * | mOverlay |
The overlay which contains our profiler results display. | |
OverlayContainer * | mProfileGui |
The window that displays the profiler results. | |
Real | mBarHeight |
The height of each bar. | |
Real | mGuiHeight |
The height of the stats window. | |
Real | mGuiWidth |
The width of the stats window. | |
Real | mGuiLeft |
The horz position of the stats window. | |
Real | mGuiTop |
The vertical position of the stats window. | |
Real | mBarIndent |
The size of the indent for each profile display bar. | |
Real | mGuiBorderWidth |
The width of the border between the profile window and each bar. | |
Real | mBarLineWidth |
The width of the min, avg, and max lines in a profile display. | |
Real | mBarSpacing |
The distance between bars. | |
uint | mUpdateDisplayFrequency |
The number of frames that must elapse before the current frame display is updated. | |
uint | mCurrentFrame |
The number of elapsed frame, used with mUpdateDisplayFrequency. | |
Timer * | mTimer |
The timer used for profiling. | |
ulong | mTotalFrameTime |
The total time each frame takes. | |
bool | mEnabled |
Whether this profiler is enabled. | |
bool | mNewEnableState |
Keeps track of the new enabled/disabled state that the user has requested which will be applied after the frame ends. | |
uint32 | mProfileMask |
Mask to decide whether a type of profile is enabled or not. | |
DisplayMode | mDisplayMode |
How to display the overlay. | |
ulong | mMaxTotalFrameTime |
The max frame time recorded. | |
Real | mAverageFrameTime |
Rolling average of millisecs. | |
bool | mResetExtents |
Static Protected Attributes | |
static Profiler * | msSingleton |
Friends | |
class | ProfileInstance |
The profiler allows you to measure the performance of your code.
Definition at line 134 of file OgreProfiler.h.
typedef set<String>::type Ogre::Profiler::DisabledProfileMap [protected] |
Definition at line 457 of file OgreProfiler.h.
typedef list<OverlayElement*>::type Ogre::Profiler::ProfileBarList [protected] |
Definition at line 326 of file OgreProfiler.h.
typedef ProfileInstance::ProfileChildren Ogre::Profiler::ProfileChildren [protected] |
Definition at line 458 of file OgreProfiler.h.
DISPLAY_PERCENTAGE |
Display % frame usage on the overlay. |
DISPLAY_MILLISECONDS |
Display milliseconds on the overlay. |
Definition at line 252 of file OgreProfiler.h.
void Ogre::Profiler::beginGPUEvent | ( | const String & | event | ) |
Mark the beginning of a GPU event group.
void Ogre::Profiler::beginProfile | ( | const String & | profileName, |
uint32 | groupID = (uint32) OGREPROF_USER_DEFAULT |
||
) |
Begins a profile.
profileName | Must be unique and must not be an empty string |
groupID | A profile group identifier, which can allow you to mask profiles |
void Ogre::Profiler::changeEnableState | ( | ) | [protected] |
Handles a change of the profiler's enabled state.
OverlayContainer* Ogre::Profiler::createContainer | ( | ) | [protected] |
An internal function to create the container which will hold our display elements.
OverlayElement* Ogre::Profiler::createPanel | ( | const String & | name, |
Real | width, | ||
Real | height, | ||
Real | top, | ||
Real | left, | ||
const String & | materialName, | ||
bool | show = true |
||
) | [protected] |
An internal function to create a panel.
OverlayElement* Ogre::Profiler::createTextArea | ( | const String & | name, |
Real | width, | ||
Real | height, | ||
Real | top, | ||
Real | left, | ||
uint | fontSize, | ||
const String & | caption, | ||
bool | show = true |
||
) | [protected] |
An internal function to create a text area.
void Ogre::Profiler::disableProfile | ( | const String & | profileName | ) |
Disables a profile.
void Ogre::Profiler::displayResults | ( | void | ) | [protected] |
void Ogre::Profiler::displayResults | ( | ProfileInstance * | instance, |
ProfileBarList::iterator & | bIter, | ||
Real & | maxTimeMillisecs, | ||
Real & | newGuiHeight, | ||
int & | profileCount | ||
) | [protected] |
Prints the profiling results of each frame.
void Ogre::Profiler::enableProfile | ( | const String & | profileName | ) |
Enables a previously disabled profile.
void Ogre::Profiler::endGPUEvent | ( | const String & | event | ) |
Mark the end of a GPU event group.
void Ogre::Profiler::endProfile | ( | const String & | profileName, |
uint32 | groupID = (uint32) OGREPROF_USER_DEFAULT |
||
) |
Ends a profile.
profileName | Must be unique and must not be an empty string |
groupID | A profile group identifier, which can allow you to mask profiles |
DisplayMode Ogre::Profiler::getDisplayMode | ( | ) | const |
Get the display mode for the overlay.
Definition at line 265 of file OgreProfiler.h.
bool Ogre::Profiler::getEnabled | ( | ) | const |
Gets whether this profiler is enabled.
Real Ogre::Profiler::getOverlayHeight | ( | ) | const |
Real Ogre::Profiler::getOverlayLeft | ( | ) | const |
Real Ogre::Profiler::getOverlayTop | ( | ) | const |
Real Ogre::Profiler::getOverlayWidth | ( | ) | const |
uint32 Ogre::Profiler::getProfileGroupMask | ( | ) | const |
Get the mask which all profiles must pass to be enabled.
Definition at line 219 of file OgreProfiler.h.
static Profiler& Ogre::Profiler::getSingleton | ( | void | ) | [static] |
Override standard Singleton retrieval.
Reimplemented from Ogre::Singleton< Profiler >.
static Profiler* Ogre::Profiler::getSingletonPtr | ( | void | ) | [static] |
Override standard Singleton retrieval.
Reimplemented from Ogre::Singleton< Profiler >.
Retrieves the timer for the profiler.
Gets the frequency that the Profiler display is updated.
void Ogre::Profiler::initialize | ( | ) | [protected] |
Initializes the profiler's GUI elements.
void Ogre::Profiler::logResults | ( | ) |
Outputs current profile statistics to the log.
void Ogre::Profiler::markGPUEvent | ( | const String & | event | ) |
Mark a specific, ungrouped, GPU event.
void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr | ) | [inherited] |
Definition at line 95 of file OgreMemoryAllocatedObject.h.
void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr, |
void * | |||
) | [inherited] |
Definition at line 101 of file OgreMemoryAllocatedObject.h.
void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr, |
const char * | , | ||
int | , | ||
const char * | |||
) | [inherited] |
Definition at line 107 of file OgreMemoryAllocatedObject.h.
void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr | ) | [inherited] |
Definition at line 112 of file OgreMemoryAllocatedObject.h.
void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr, |
const char * | , | ||
int | , | ||
const char * | |||
) | [inherited] |
Definition at line 118 of file OgreMemoryAllocatedObject.h.
void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz, |
const char * | file, | ||
int | line, | ||
const char * | func | ||
) | [inherited] |
operator new, with debug line info
Definition at line 67 of file OgreMemoryAllocatedObject.h.
void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz | ) | [inherited] |
Definition at line 72 of file OgreMemoryAllocatedObject.h.
void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz, |
void * | ptr | ||
) | [inherited] |
placement operator new
Definition at line 78 of file OgreMemoryAllocatedObject.h.
void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz, |
const char * | file, | ||
int | line, | ||
const char * | func | ||
) | [inherited] |
array operator new, with debug line info
Definition at line 85 of file OgreMemoryAllocatedObject.h.
void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz | ) | [inherited] |
Definition at line 90 of file OgreMemoryAllocatedObject.h.
void Ogre::Profiler::processFrameStats | ( | void | ) | [protected] |
Processes frame stats for all of the mRoot's children.
void Ogre::Profiler::processFrameStats | ( | ProfileInstance * | instance, |
Real & | maxFrameTime | ||
) | [protected] |
Processes specific ProfileInstance and it's children recursively.
void Ogre::Profiler::reset | ( | ) |
Clears the profiler statistics.
void Ogre::Profiler::setDisplayMode | ( | DisplayMode | d | ) |
Set the display mode for the overlay.
Definition at line 262 of file OgreProfiler.h.
void Ogre::Profiler::setEnabled | ( | bool | enabled | ) |
Sets whether this profiler is enabled.
Only takes effect after the the frame has ended.
void Ogre::Profiler::setOverlayDimensions | ( | Real | width, |
Real | height | ||
) |
Set the size of the profiler overlay, in pixels.
void Ogre::Profiler::setOverlayPosition | ( | Real | left, |
Real | top | ||
) |
Set the position of the profiler overlay, in pixels.
void Ogre::Profiler::setProfileGroupMask | ( | uint32 | mask | ) |
Set the mask which all profiles must pass to be enabled.
Definition at line 216 of file OgreProfiler.h.
void Ogre::Profiler::setTimer | ( | Timer * | t | ) |
Sets the timer for the profiler.
void Ogre::Profiler::setUpdateDisplayFrequency | ( | uint | freq | ) |
Sets the Profiler so the display of results are updated every n frames.
bool Ogre::Profiler::watchForLimit | ( | const String & | profileName, |
Real | limit, | ||
bool | greaterThan = true |
||
) |
Returns true if the specified profile goes over or under the given limit frame time.
limit | A number between 0 and 1 representing the percentage of frame time |
greaterThan | If true, this will return whether the limit is exceeded. Otherwise, it will return if the frame time has gone under this limit. |
bool Ogre::Profiler::watchForMax | ( | const String & | profileName | ) |
Returns true if the specified profile reaches a new frame time maximum.
bool Ogre::Profiler::watchForMin | ( | const String & | profileName | ) |
Returns true if the specified profile reaches a new frame time minimum.
friend class ProfileInstance [friend] |
Definition at line 324 of file OgreProfiler.h.
Real Ogre::Profiler::mAverageFrameTime [protected] |
Rolling average of millisecs.
Definition at line 539 of file OgreProfiler.h.
Real Ogre::Profiler::mBarHeight [protected] |
The height of each bar.
Definition at line 483 of file OgreProfiler.h.
Real Ogre::Profiler::mBarIndent [protected] |
The size of the indent for each profile display bar.
Definition at line 498 of file OgreProfiler.h.
Real Ogre::Profiler::mBarLineWidth [protected] |
The width of the min, avg, and max lines in a profile display.
Definition at line 504 of file OgreProfiler.h.
Real Ogre::Profiler::mBarSpacing [protected] |
The distance between bars.
Definition at line 507 of file OgreProfiler.h.
ProfileInstance* Ogre::Profiler::mCurrent [protected] |
Definition at line 460 of file OgreProfiler.h.
uint Ogre::Profiler::mCurrentFrame [protected] |
The number of elapsed frame, used with mUpdateDisplayFrequency.
Definition at line 514 of file OgreProfiler.h.
DisabledProfileMap Ogre::Profiler::mDisabledProfiles [protected] |
Holds the names of disabled profiles.
Definition at line 465 of file OgreProfiler.h.
DisplayMode Ogre::Profiler::mDisplayMode [protected] |
How to display the overlay.
Definition at line 533 of file OgreProfiler.h.
bool Ogre::Profiler::mEnabled [protected] |
Whether this profiler is enabled.
Definition at line 523 of file OgreProfiler.h.
Real Ogre::Profiler::mGuiBorderWidth [protected] |
The width of the border between the profile window and each bar.
Definition at line 501 of file OgreProfiler.h.
Real Ogre::Profiler::mGuiHeight [protected] |
The height of the stats window.
Definition at line 486 of file OgreProfiler.h.
Real Ogre::Profiler::mGuiLeft [protected] |
The horz position of the stats window.
Definition at line 492 of file OgreProfiler.h.
Real Ogre::Profiler::mGuiTop [protected] |
The vertical position of the stats window.
Definition at line 495 of file OgreProfiler.h.
Real Ogre::Profiler::mGuiWidth [protected] |
The width of the stats window.
Definition at line 489 of file OgreProfiler.h.
bool Ogre::Profiler::mInitialized [protected] |
Whether the GUI elements have been initialized.
Definition at line 471 of file OgreProfiler.h.
ProfileInstance* Ogre::Profiler::mLast [protected] |
Definition at line 461 of file OgreProfiler.h.
uint Ogre::Profiler::mMaxDisplayProfiles [protected] |
The max number of profiles we can display.
Definition at line 474 of file OgreProfiler.h.
ulong Ogre::Profiler::mMaxTotalFrameTime [protected] |
The max frame time recorded.
Definition at line 536 of file OgreProfiler.h.
bool Ogre::Profiler::mNewEnableState [protected] |
Keeps track of the new enabled/disabled state that the user has requested which will be applied after the frame ends.
Definition at line 527 of file OgreProfiler.h.
Overlay* Ogre::Profiler::mOverlay [protected] |
The overlay which contains our profiler results display.
Definition at line 477 of file OgreProfiler.h.
ProfileBarList Ogre::Profiler::mProfileBars [protected] |
Holds the display bars for each profile results.
Definition at line 468 of file OgreProfiler.h.
OverlayContainer* Ogre::Profiler::mProfileGui [protected] |
The window that displays the profiler results.
Definition at line 480 of file OgreProfiler.h.
uint32 Ogre::Profiler::mProfileMask [protected] |
Mask to decide whether a type of profile is enabled or not.
Definition at line 530 of file OgreProfiler.h.
bool Ogre::Profiler::mResetExtents [protected] |
Definition at line 540 of file OgreProfiler.h.
ProfileInstance Ogre::Profiler::mRoot [protected] |
Definition at line 462 of file OgreProfiler.h.
Profiler * Ogre::Singleton< Profiler >::msSingleton [static, protected, inherited] |
Definition at line 75 of file OgreSingleton.h.
Timer* Ogre::Profiler::mTimer [protected] |
The timer used for profiling.
Definition at line 517 of file OgreProfiler.h.
ulong Ogre::Profiler::mTotalFrameTime [protected] |
The total time each frame takes.
Definition at line 520 of file OgreProfiler.h.
uint Ogre::Profiler::mUpdateDisplayFrequency [protected] |
The number of frames that must elapse before the current frame display is updated.
Definition at line 511 of file OgreProfiler.h.
Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sun Sep 2 2012 07:27:34