Go to the documentation of this file.
41 #ifndef __Profiler_H__
42 #define __Profiler_H__
49 #if OGRE_PROFILING == 1
50 # define OgreProfile( a ) Ogre::Profile _OgreProfileInstance( (a) )
51 # define OgreProfileBegin( a ) Ogre::Profiler::getSingleton().beginProfile( (a) )
52 # define OgreProfileEnd( a ) Ogre::Profiler::getSingleton().endProfile( (a) )
53 # define OgreProfileGroup( a, g ) Ogre::Profile _OgreProfileInstance( (a), (g) )
54 # define OgreProfileBeginGroup( a, g ) Ogre::Profiler::getSingleton().beginProfile( (a), (g) )
55 # define OgreProfileEndGroup( a, g ) Ogre::Profiler::getSingleton().endProfile( (a), (g) )
56 # define OgreProfileBeginGPUEvent( g ) Ogre::Profiler::getSingleton().beginGPUEvent(g)
57 # define OgreProfileEndGPUEvent( g ) Ogre::Profiler::getSingleton().endGPUEvent(g)
58 # define OgreProfileMarkGPUEvent( e ) Ogre::Profiler::getSingleton().markGPUEvent(e)
60 # define OgreProfile( a )
61 # define OgreProfileBegin( a )
62 # define OgreProfileEnd( a )
63 # define OgreProfileGroup( a, g )
64 # define OgreProfileBeginGroup( a, g )
65 # define OgreProfileEndGroup( a, g )
66 # define OgreProfileBeginGPUEvent( e )
67 # define OgreProfileEndGPUEvent( e )
68 # define OgreProfileMarkGPUEvent( e )
String mName
The name of this profile.
uint getUpdateDisplayFrequency() const
Gets the frequency that the Profiler display is updated.
void enableProfile(const String &profileName)
Enables a previously disabled profile.
Real totalTimeMillisecs
The total frame time this profile has taken in milliseconds.
DisabledProfileMap mDisabledProfiles
Holds the names of disabled profiles.
uint mUpdateDisplayFrequency
The number of frames that must elapse before the current frame display is updated.
An individual profile that will be processed by the Profiler.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Ogre::map< String, ProfileInstance * >::type ProfileChildren
virtual ~ProfileSessionListener()
ProfileInstance::ProfileChildren ProfileChildren
@ OGREPROF_ALL
All in-built Ogre profiling will match this mask.
uint hierarchicalLvl
The hierarchical level of this profile, 0 being the root profile.
DisplayMode mDisplayMode
How to display the overlay.
Timer * mTimer
The timer used for profiling.
void disableProfile(const String &profileName)
Disables a profile.
DisplayMode getDisplayMode() const
Get the display mode for the overlay.
ulong mTotalFrameTime
The total time each frame takes.
void removeListener(ProfileSessionListener *listener)
void endGPUEvent(const String &event)
Mark the end of a GPU event group.
Profile(const String &profileName, uint32 groupID=(uint32) OGREPROF_USER_DEFAULT)
void initialize()
Initializes the profiler's GUI elements.
void changeEnableState()
Handles a change of the profiler's enabled state.
bool watchForMax(const String &profileName)
Returns true if the specified profile reaches a new frame time maximum.
void setEnabled(bool enabled)
Sets whether this profiler is enabled.
static Profiler * getSingletonPtr(void)
Override standard Singleton retrieval.
@ OGREPROF_CULLING
Culling.
ulong mMaxTotalFrameTime
The max frame time recorded.
void setDisplayMode(DisplayMode d)
Set the display mode for the overlay.
bool watchForMin(const String &profileName)
ulong frameTime
The total time this profile has taken this frame.
void processFrameStats(ProfileInstance *instance, Real &maxFrameTime)
Processes specific ProfileInstance and it's children recursively.
uint calls
The number of times this profile was called this frame.
Timer * getTimer()
Retrieves the timer for the profiler.
ProfileGroupMask
List of reserved profiling masks.
uint32 mGroupID
The group ID.
Real maxTimeMillisecs
The maximum frame time this profile has taken in milliseconds.
Represents an individual profile call.
Real currentTimePercent
The current percentage of frame time this profile has taken.
ulong totalCalls
The total number of times this profile was called (used to calculate average)
set< String >::type DisabledProfileMap
String name
The name of the profile.
ProfileInstance * mCurrent
uint32 mProfileMask
Mask to decide whether a type of profile is enabled or not.
vector< ProfileSessionListener * >::type TProfileSessionListener
Real currentTimeMillisecs
The current frame time this profile has taken in milliseconds.
Represents a history of each profile during the duration of the app.
uint hierarchicalLvl
The hierarchical level of this profile, 0 being the root profile.
TProfileSessionListener mListeners
bool watchForMin(const String &profileName)
Returns true if the specified profile reaches a new frame time minimum.
Template class for creating single-instance global classes.
void reset()
Clears the profiler statistics.
uint numCallsThisFrame
The number of times this profile has been called each frame.
void markGPUEvent(const String &event)
Mark a specific, ungrouped, GPU event.
uint hierarchicalLvl
The hierarchical level of this profile, 0 being the main loop.
bool watchForLimit(const String &profileName, Real limit, bool greaterThan=true)
Real mAverageFrameTime
Rolling average of millisecs.
ProfileSessionListener should be used to visualize profile results.
virtual ~ProfileInstance(void)
bool watchForMax(const String &profileName)
Real maxTimePercent
The maximum percentage of frame time this profile has taken.
ulong accum
Represents the total time of all child profiles to subtract from this profile.
void beginGPUEvent(const String &event)
Mark the beginning of a GPU event group.
@ DISPLAY_PERCENTAGE
Display % frame usage on the overlay.
bool watchForLimit(Real limit, bool greaterThan=true)
void addListener(ProfileSessionListener *listener)
@ OGREPROF_RENDERING
Rendering.
The profiler allows you to measure the performance of your code.
virtual void displayResults(const ProfileInstance &instance, ulong maxTotalFrameTime)
Here we get the real profiling information which we can use.
virtual void finializeSession()=0
All internal resources should be deleted here.
std::map< K, V, P, A > type
ulong currTime
The time this profile was started.
void setProfileGroupMask(uint32 mask)
Set the mask which all profiles must pass to be enabled.
void endProfile(const String &profileName, uint32 groupID=(uint32) OGREPROF_USER_DEFAULT)
Ends a profile.
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.
ProfileInstance * parent
The name of the parent, null if root.
@ OGREPROF_GENERAL
General processing.
float Real
Software floating point type.
void setUpdateDisplayFrequency(uint freq)
Sets the Profiler so the display of results are updated every n frames.
Real totalTimePercent
The total percentage of frame time this profile has taken.
void beginProfile(const String &profileName, uint32 groupID=(uint32) OGREPROF_USER_DEFAULT)
Begins a profile.
Real minTimePercent
The minimum percentage of frame time this profile has taken.
Represents the total timing information of a profile since profiles can be called more than once each...
uint mCurrentFrame
The number of elapsed frame, used with mUpdateDisplayFrequency.
uint32 getProfileGroupMask() const
Get the mask which all profiles must pass to be enabled.
virtual void initializeSession()=0
Create the internal resources.
void processFrameStats(void)
Processes frame stats for all of the mRoot's children.
@ OGREPROF_USER_DEFAULT
User default profile.
Real minTimeMillisecs
The minimum frame time this profile has taken in milliseconds.
bool mInitialized
Whether the GUI elements have been initialized.
void logResults()
Outputs current profile statistics to the log.
virtual void changeEnableState(bool enabled)
If the profiler disables this listener then it should hide its panels (if any exists) or stop sending...
void setTimer(Timer *t)
Sets the timer for the profiler.
bool mNewEnableState
Keeps track of the new enabled/disabled state that the user has requested which will be applied after...
bool getEnabled() const
Gets whether this profiler is enabled.
bool mEnabled
Whether this profiler is enabled.
static Profiler & getSingleton(void)
Override standard Singleton retrieval.
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.