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 )
244 virtual void initializeSession() = 0;
247 virtual void finializeSession() = 0;
289 void setTimer(
Timer* t);
323 void endProfile(
const String& profileName,
uint32 groupID = (
uint32)OGREPROF_USER_DEFAULT);
328 void beginGPUEvent(
const String& event);
333 void endGPUEvent(
const String& event);
338 void markGPUEvent(
const String& event);
345 void setEnabled(
bool enabled);
348 bool getEnabled()
const;
353 void enableProfile(
const String& profileName);
358 void disableProfile(
const String& profileName);
372 bool watchForMax(
const String& profileName);
379 bool watchForMin(
const String& profileName);
390 bool watchForLimit(
const String& profileName,
Real limit,
bool greaterThan =
true);
399 void setUpdateDisplayFrequency(
uint freq);
402 uint getUpdateDisplayFrequency()
const;
435 static Profiler& getSingleton(
void);
451 static Profiler* getSingletonPtr(
void);
462 void displayResults();
465 void processFrameStats(
void);
470 void changeEnableState();
ProfileSessionListener should be used to visualize profile results.
String name
The name of the profile.
Real maxTimeMillisecs
The maximum frame time this profile has taken in milliseconds.
virtual void changeEnableState(bool enabled)
If the profiler disables this listener then it should hide its panels (if any exists) or stop sending...
float Real
Software floating point type.
uint mCurrentFrame
The number of elapsed frame, used with mUpdateDisplayFrequency.
Template class for creating single-instance global classes.
uint hierarchicalLvl
The hierarchical level of this profile, 0 being the root profile.
Real mAverageFrameTime
Rolling average of millisecs.
virtual ~ProfileInstance(void)
uint32 getProfileGroupMask() const
Get the mask which all profiles must pass to be enabled.
ulong accum
Represents the total time of all child profiles to subtract from this profile.
uint32 mGroupID
The group ID.
void setDisplayMode(DisplayMode d)
Set the display mode for the overlay.
Real currentTimePercent
The current percentage of frame time this profile has taken.
ProfileInstance::ProfileChildren ProfileChildren
ulong frameTime
The total time this profile has taken this frame.
String mName
The name of this profile.
uint mUpdateDisplayFrequency
The number of frames that must elapse before the current frame display is updated.
uint hierarchicalLvl
The hierarchical level of this profile, 0 being the root profile.
bool mEnabled
Whether this profiler is enabled.
TProfileSessionListener mListeners
Represents an individual profile call.
Timer * mTimer
The timer used for profiling.
The profiler allows you to measure the performance of your code.
Real minTimeMillisecs
The minimum frame time this profile has taken in milliseconds.
uint hierarchicalLvl
The hierarchical level of this profile, 0 being the main loop.
ProfileGroupMask
List of reserved profiling masks.
virtual void displayResults(const ProfileInstance &instance, ulong maxTotalFrameTime)
Here we get the real profiling information which we can use.
Real totalTimeMillisecs
The total frame time this profile has taken in milliseconds.
Represents a history of each profile during the duration of the app.
DisplayMode mDisplayMode
How to display the overlay.
DisabledProfileMap mDisabledProfiles
Holds the names of disabled profiles.
ulong mMaxTotalFrameTime
The max frame time recorded.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
set< String >::type DisabledProfileMap
ProfileInstance * mCurrent
ulong totalCalls
The total number of times this profile was called (used to calculate average)
Display % frame usage on the overlay.
ulong currTime
The time this profile was started.
std::map< K, V, P, A > type
DisplayMode getDisplayMode() const
Get the display mode for the overlay.
uint numCallsThisFrame
The number of times this profile has been called each frame.
ProfileInstance * parent
The name of the parent, null if root.
Real currentTimeMillisecs
The current frame time this profile has taken in milliseconds.
bool mNewEnableState
Keeps track of the new enabled/disabled state that the user has requested which will be applied after...
vector< ProfileSessionListener * >::type TProfileSessionListener
void setProfileGroupMask(uint32 mask)
Set the mask which all profiles must pass to be enabled.
bool mInitialized
Whether the GUI elements have been initialized.
Represents the total timing information of a profile since profiles can be called more than once each...
Ogre::map< String, ProfileInstance * >::type ProfileChildren
Real maxTimePercent
The maximum percentage of frame time this profile has taken.
virtual ~ProfileSessionListener()
Real totalTimePercent
The total percentage of frame time this profile has taken.
All in-built Ogre profiling will match this mask.
ulong mTotalFrameTime
The total time each frame takes.
uint calls
The number of times this profile was called this frame.
Real minTimePercent
The minimum percentage of frame time this profile has taken.
An individual profile that will be processed by the Profiler.
uint32 mProfileMask
Mask to decide whether a type of profile is enabled or not.
bool watchForLimit(Real limit, bool greaterThan=true)