#include <GUIProfiler.h>

Public Types | |
| enum | FPSCounterID { INVALID_COUNTER_ID = -1 , DEFAULT_FPS , DEFAULT_ABS_FPS } |
Public Member Functions | |
| void | ClearMemoryLargestBlock () |
| void | ClearMemoryMax () |
| virtual void | DoAnimate (const eC_Value &vTimes=eC_FromInt(1)) |
| eC_UInt | GetCPUUsage () const |
| size_t | GetMemoryAvailable () const |
| size_t | GetMemoryLargestBlock () const |
| size_t | GetMemoryMax () const |
| void | GetMemoryThresholds (eC_UInt &uiMemoryUsageWarning, eC_UInt &uiMemoryUsageAlert) |
| size_t | GetMemoryUsed () const |
| eC_UInt | GetRedrawDuration () const |
| eC_UInt | GetRefreshDuration () const |
| eC_Bool | GetRuntimeActive () const |
| eC_Bool | IsActive () const |
| eC_Bool | IsConsoleActive () const |
| eC_Bool | IsCPUProfilingActive () const |
| eC_Bool | IsDisplayActive () const |
| eC_Bool | IsFPSActive () const |
| eC_Bool | IsGraphicsProfilingActive () const |
| eC_Bool | IsInvalidationActive () const |
| eC_Bool | IsMemoryProfilingActive () const |
| eC_Bool | IsMemoryUsageBarActive () const |
| void | SetActive (const eC_Bool &bActive) |
| void | SetBackColor (const eC_UInt &uiBackColor) |
| void | SetConsoleActive (const eC_Bool &bActive) |
| void | SetCPUProfilingActive (const eC_Bool &bActive) |
| void | SetDisplayActive (const eC_Bool &bActive) |
| void | SetFont (const FontResource_t &eFontID) |
| void | SetFPSActive (const eC_Bool &bActive) |
| void | SetGraphicsProfilingActive (const eC_Bool &bActive) |
| void | SetInvalidationActive (const eC_Bool &bActive) |
| void | SetMemoryAvailable (const size_t &tMemoryAvailable) |
| void | SetMemoryProfilingActive (const eC_Bool &bActive) |
| void | SetMemoryThresholds (const eC_UInt &uiMemoryUsageWarning, const eC_UInt &uiMemoryUsageAlert) |
| void | SetMemoryUsageBarActive (const eC_Bool &bActive) |
| void | SetMemoryUsageBarPosition (const eC_Value &vX, const eC_Value &vY) |
| void | SetMemoryUsageBarSize (const eC_Value &vWidth, const eC_Value &vHeight) |
| void | SetPosition (const eC_Value &vX, const eC_Value &vY) |
| void | SetRuntimeActive (const eC_Bool &bActive) |
| void | SetTextColor (const eC_UInt &uiTextColor) |
| void | SetUpdateInterval (const eC_UInt &uiUpdateInterval) |
Public Member Functions inherited from CGUIAnimatable | |
| virtual | ~CGUIAnimatable () |
| Destructor. Removes all existing animation callbacks. | |
| virtual void | DoAnimate (const eC_Value &vTimes=eC_FromInt(1)) |
| virtual eC_Bool | IsAnimating () const |
| virtual void | StartAnimation () |
| virtual void | StopAnimation () |
Static Public Member Functions | |
| static void | CreateInstance () |
| static void | DeleteInstance () |
Friends | |
| class | CGfxWrap |
| for private access | |
| class | CGUI |
| for private access | |
| class | CGUIComponentManager |
| for private access | |
This class is used for profiling purposes in Guiliani.
You can measure the following things during runtime:
The CPU value is calculated by taking two different time-spans (processing time / complete time for one loop) The first one is the time which internal processing in Guiliani takes up. This one does not include acquiring new events from the InputDevice. This is done because, when there is no event the InputDevice will wait for a timeout. The second value is the time which elapses for the complete run.
So the term CPU-consumption might not be the correct one, since in a multi-tasking environment the scheduler might split one loop of Guiliani into several small parts, which are interrupted by other tasks. It is more like a percentage of the whole timeslice Guiliani has had to the part of the timeslice for processing. So 50% means that 50% of the time inside the Guiliani main-loop was spent for the input-device and 50% for processing, whereas 100% means that there was nearly no time consumed by waiting for events.
There are two different values for the FPS of Guiliani: 1. FPS measures only the time for redrawing the invalidated regions on the screen. This value may get really high if there is nothing to be drawn on the screen.
2. AbsFPS measures the time for a whole cycle through the main-loop of Guiliani, including processing time of internal stuff (Commands, DataPool, etc.) This value is comparable to the FPS-value you are used from games or other applications.
There a several measurements for memory-profiling available: 1. used memory the number of bytes currently used by allocation in Guiliani
2. maximum value for allocated memory 3. largest block ever allocated these two values can be reset during runtime for analyzing different situations
4. number of allocated blocks
Note: please keep in mind that only memory which is allocated by new/delete is counted. if you use the C-functions malloc/free the memory will not be tracked by the profiler.
It is also possible to display a bar of the consumed memory on the screen, where the color of the bar indicated if a threshold (which can be set seperately) was reached. The length of the bar is the total amount of memory available. The colored bar (green, yellow, red) indicates the currently used memory. The blue bar in the background indicates the maximum amount of allocated memory.
for measuring graphics performance in various situations the duration of redraw and refresh are calculated and can be displayed during runtime.
Enumeration for the counter IDs
| void CGUIProfiler::ClearMemoryLargestBlock | ( | ) |
Clear the value for the largest allocated block of memory
| void CGUIProfiler::ClearMemoryMax | ( | ) |
Clear the value for maximum allocated memory
|
static |
Create Instance
|
static |
Delete Instance
|
virtual |
Called when the timer of an animation callback belonging to this animatable has expired.
| vTimes | The factor of the registered callback time in relation to the actually elapsed time. For example, the elapsed time is 80ms, and the standard time is 50ms, then vTimes is 1.6. If the given time in GETTIMER.AddAnimationCallback is 0, It will be set to -1. |
Reimplemented from CGUIAnimatable.
| eC_UInt CGUIProfiler::GetCPUUsage | ( | ) | const |
get the current CPU-Usage
| size_t CGUIProfiler::GetMemoryAvailable | ( | ) | const |
Get the amount of available memory in bytes
| size_t CGUIProfiler::GetMemoryLargestBlock | ( | ) | const |
Get the largest block ever allocated
| size_t CGUIProfiler::GetMemoryMax | ( | ) | const |
Get the maximum amount of memory used
| void CGUIProfiler::GetMemoryThresholds | ( | eC_UInt & | uiMemoryUsageWarning, |
| eC_UInt & | uiMemoryUsageAlert | ||
| ) |
get thresholds for memory usage
| uiMemoryUsageWarning | warning-level |
| uiMemoryUsageAlert | alert-level |
| size_t CGUIProfiler::GetMemoryUsed | ( | ) | const |
Get amount of used memory
| eC_UInt CGUIProfiler::GetRedrawDuration | ( | ) | const |
Get the duration of the last redraw
| eC_UInt CGUIProfiler::GetRefreshDuration | ( | ) | const |
Get the duration of the last refresh
|
inline |
return if Runtime is active
|
inline |
get the active-state of the profiler
|
inline |
return if the console-output is currently active
|
inline |
return if CPU-profiling is currently active
|
inline |
return if the onscreen-display is currently active
|
inline |
return if FPS-measuring is currently active
|
inline |
return if graphics-profiling is currently active
|
inline |
return if invalidation is currently active
|
inline |
return if the memory-profiling is currently active
|
inline |
return if the memory-usage-bar is currently displayed
| void CGUIProfiler::SetActive | ( | const eC_Bool & | bActive | ) |
Set profiler to active.
| bActive |
| void CGUIProfiler::SetBackColor | ( | const eC_UInt & | uiBackColor | ) |
Set the background-color
| uiBackColor | color in ARGB |
| void CGUIProfiler::SetConsoleActive | ( | const eC_Bool & | bActive | ) |
Set logging of profiling-data to the console to active
| bActive |
| void CGUIProfiler::SetCPUProfilingActive | ( | const eC_Bool & | bActive | ) |
Set profiling of CPU
| bActive |
| void CGUIProfiler::SetDisplayActive | ( | const eC_Bool & | bActive | ) |
Set logging of profiling-data on the screen to active
| bActive |
| void CGUIProfiler::SetFont | ( | const FontResource_t & | eFontID | ) |
Set the font-id
| eFontID | used font |
| void CGUIProfiler::SetFPSActive | ( | const eC_Bool & | bActive | ) |
Set display of FPS-counters
| bActive |
| void CGUIProfiler::SetGraphicsProfilingActive | ( | const eC_Bool & | bActive | ) |
Set profiling of graphics
| bActive |
| void CGUIProfiler::SetInvalidationActive | ( | const eC_Bool & | bActive | ) |
Set display of invalidation
| bActive |
| void CGUIProfiler::SetMemoryAvailable | ( | const size_t & | tMemoryAvailable | ) |
Set the amount of available memory
| tMemoryAvailable | number of bytes available |
| void CGUIProfiler::SetMemoryProfilingActive | ( | const eC_Bool & | bActive | ) |
Set profiling of memory-usage
| bActive |
| void CGUIProfiler::SetMemoryThresholds | ( | const eC_UInt & | uiMemoryUsageWarning, |
| const eC_UInt & | uiMemoryUsageAlert | ||
| ) |
set thresholds for memory usage
| uiMemoryUsageWarning | warning-level |
| uiMemoryUsageAlert | alert-level |
| void CGUIProfiler::SetMemoryUsageBarActive | ( | const eC_Bool & | bActive | ) |
Set display of current memory-usage as a bar
| bActive |
| void CGUIProfiler::SetMemoryUsageBarPosition | ( | const eC_Value & | vX, |
| const eC_Value & | vY | ||
| ) |
Set the position for the memory-bar
| vX | x-position |
| vY | y-position |
| void CGUIProfiler::SetMemoryUsageBarSize | ( | const eC_Value & | vWidth, |
| const eC_Value & | vHeight | ||
| ) |
Set the size for the memory-bar
| vWidth | width |
| vHeight | height |
| void CGUIProfiler::SetPosition | ( | const eC_Value & | vX, |
| const eC_Value & | vY | ||
| ) |
Set the position for the output
| vX | x-position |
| vY | y-position |
| void CGUIProfiler::SetRuntimeActive | ( | const eC_Bool & | bActive | ) |
Set display of runtime
| bActive |
| void CGUIProfiler::SetTextColor | ( | const eC_UInt & | uiTextColor | ) |
Set the text-color
| uiTextColor | color in ARGB |
| void CGUIProfiler::SetUpdateInterval | ( | const eC_UInt & | uiUpdateInterval | ) |
Set the updating interval
| uiUpdateInterval | time in milliseconds |