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) )
57 # define OgreProfile( a )
58 # define OgreProfileBegin( a )
59 # define OgreProfileEnd( a )
60 # define OgreProfileGroup( a, g )
61 # define OgreProfileBeginGroup( a, g )
62 # define OgreProfileEndGroup( a, g )
133 void setTimer(
Timer* t);
167 void endProfile(
const String& profileName,
uint32 groupID = (
uint32)OGREPROF_USER_DEFAULT);
174 void setEnabled(
bool enabled);
177 bool getEnabled()
const;
183 void enableProfile(
const String& profileName);
189 void disableProfile(
const String& profileName);
203 bool watchForMax(
const String& profileName);
210 bool watchForMin(
const String& profileName);
221 bool watchForLimit(
const String& profileName,
Real limit,
bool greaterThan =
true);
245 void setUpdateDisplayFrequency(
uint freq);
248 uint getUpdateDisplayFrequency()
const;
251 void setOverlayDimensions(
Real width,
Real height);
254 void setOverlayPosition(
Real left,
Real top);
256 Real getOverlayWidth()
const;
257 Real getOverlayHeight()
const;
258 Real getOverlayLeft()
const;
259 Real getOverlayTop()
const;
276 static Profiler& getSingleton(
void);
292 static Profiler* getSingletonPtr(
void);
300 void displayResults();
303 void processFrameStats();
306 void changeEnableState();
313 uint fontSize,
const String& caption,
bool show =
true);
317 const String& materialName,
bool show =
true);
String parent
The name of the parent, empty string if root.
float Real
Software floating point type.
Real mGuiLeft
The horz position of the stats window.
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.
Real mGuiHeight
The height of the stats window.
Template class for creating single-instance global classes.
uint mMaxDisplayProfiles
The max number of profiles we can display.
Real mAverageFrameTime
Rolling average of millisecs.
uint hierarchicalLvl
The hierarchical level of this profile, 0 being the main loop.
list< OverlayElement * >::type ProfileBarList
uint32 getProfileGroupMask() const
Get the mask which all profiles must pass to be enabled.
Represents a history of each profile during the duration of the app.
map< String, bool >::type DisabledProfileMap
ProfileStack mProfiles
A stack for each individual profile per frame.
String name
The name of the profile.
uint32 mGroupID
The group ID.
Real mBarLineWidth
The width of the min, avg, and max lines in a profile display.
bool mEnableStateChangePending
Keeps track of whether this profiler has received a request to be enabled/disabled.
A 2D element which contains other OverlayElement instances.
Real currentTimePercent
The current percentage of frame time this profile has taken.
Real maxTimePercent
The maximum percentage of frame time this profile has taken.
uint hierarchicalLvl
The hierarchical level of this profile, 0 being the root profile.
String mName
The name of this profile.
uint numCallsThisFrame
The number of times this profile has been called each frame.
uint mUpdateDisplayFrequency
The number of frames that must elapse before the current frame display is updated.
bool mEnabled
Whether this profiler is enabled.
list< ProfileFrame >::type ProfileFrameList
Real totalTimeMillisecs
The total frame time this profile has taken in milliseconds.
ProfileHistoryMap mProfileHistoryMap
We use this for quick look-ups of profiles in the history list.
Timer * mTimer
The timer used for profiling.
uint calls
The number of times this profile was called this frame.
uint hierarchicalLvl
The hierarchical level of this profile, 0 being the root profile.
The profiler allows you to measure the performance of your code.
Display % frame usage on the overlay.
ProfileGroupMask
List of reserved profiling masks.
Real mGuiWidth
The width of the stats window.
Real maxTimeMillisecs
The maximum frame time this profile has taken in milliseconds.
DisabledProfileMap mDisabledProfiles
Holds the names of disabled profiles.
ulong mMaxTotalFrameTime
The max frame time recorded.
String name
The name of the profile.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
ulong currTime
The time this profile was started.
Real mBarHeight
The height of each bar.
ulong accum
Represents the total time of all child profiles to subtract from this profile.
Represents an individual profile call.
OverlayContainer * mProfileGui
The window that displays the profiler results.
Real mGuiBorderWidth
The width of the border between the profile window and each bar.
ulong frameTime
The total time this profile has taken this frame.
DisplayMode getDisplayMode() const
Get the display mode for the overlay.
Real currentTimeMillisecs
The current frame time this profile has taken in milliseconds.
void setDisplayMode(DisplayMode d)
Set the display mode for the overlay.
ulong totalCalls
The total number of times this profile was called (used to calculate average)
Abstract definition of a 2D element to be displayed in an Overlay.
Real minTimeMillisecs
The minimum 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...
ProfileFrameList mProfileFrame
Accumulates the results of each profile per frame (since a profile can be called more than once a fra...
list< ProfileInstance >::type ProfileStack
void setProfileGroupMask(uint32 mask)
Set the mask which all profiles must pass to be enabled.
ProfileBarList mProfileBars
Holds the display bars for each profile results.
bool mInitialized
Whether the GUI elements have been initialized.
Real mBarIndent
The size of the indent for each profile display bar.
list< ProfileHistory >::type ProfileHistoryList
DisplayMode mDisplayMode
How to display the overlay.
String name
The name of the profile.
ProfileHistoryList mProfileHistory
Keeps track of the statistics of each profile.
All in-built Ogre profiling will match this mask.
Real mGuiTop
The vertical position of the stats window.
Overlay * mOverlay
The overlay which contains our profiler results display.
ulong mTotalFrameTime
The total time each frame takes.
An individual profile that will be processed by the Profiler.
Real minTimePercent
The minimum percentage of frame time this profile has taken.
Represents a layer which is rendered on top of the 'normal' scene contents.
uint32 mProfileMask
Mask to decide whether a type of profile is enabled or not.
map< String, ProfileHistoryList::iterator >::type ProfileHistoryMap
Real totalTimePercent
The total percentage of frame time this profile has taken.
Real mBarSpacing
The distance between bars.