-
Notifications
You must be signed in to change notification settings - Fork 0
Profiling
Profiling is done using the easy_profiler.
Visit the repository to learn how to use the easy_profiler.
Using Visual Studio, select the X64-Debug-Profile or X64-Release-Profile build profile. These profiles add the -DQSFML_PROFILING=1 command line argument for the compiler.
The profiler starts automaticly when the first Scene is instantiated.
The profiler also stops automaticly when the last Scene gets destroyed.
All easy_profiler macros can be used.
The QSFML_EditorWidget library implements multiple macros for the usage of the profiler.
These macros are split in different colors.
This is done to prevent a color mess when analyzing the profile.
See QSFML_EditorWidget_debug.h
for the different macros available.
Here are the macros for profiling GameObjects:
Macro name | Parameters | Description |
---|---|---|
QSFMLP_OBJECT_BLOCK_C | text, color | Creates a scoped profiling block |
QSFMLP_OBJECT_NONSCOPED_BLOCK_C | text, color | Creates a non scoped block with a specific color |
QSFMLP_OBJECT_END_BLOCK | Ends a block | |
QSFMLP_OBJECT_FUNCTION_C | color | Creates a function block with a specific color |
QSFMLP_OBJECT_BLOCK | text, colorStage | Creates a block |
QSFMLP_OBJECT_NONSCOPED_BLOCK | text, colorStage | Creates a non scoped block |
QSFMLP_OBJECT_FUNCTION | colorStage | Creates a function block |
QSFMLP_OBJECT_VALUE | name, value | Stores a value |
QSFMLP_OBJECT_TEXT | name, value | Stores a string value |
- "text" Can be any string text.
- "color" profiler::colors::Red50 for example
- "colorStage" Macros: QSFML_COLOR_STAGE_1, QSFML_COLOR_STAGE_X...
The color stage only changes the used number on a profiler::colors::Red"colorStage".
- "name" String name of the value.
- "value" variable that to store.
void CustomObject::someFunction()
{
// Creates a profiling block with the base color for GameObjects
QSFMLP_OBJECT_FUNCTION(QSFML_COLOR_STAGE_1);
// Saves the object name at the profiling block
QSFMLP_OBJECT_TEXT("Name", getName());
// do some work ...
// Create a block with a different color grade
QSFMLP_OBJECT_BLOCK("For loop", QSFML_COLOR_STAGE_2);
for (auto& dataElement : dataList)
{
// Work on data ...
}
QSFMLP_OBJECT_END_BLOCK;
}