Engine integrates tracy for CPU profiling. GPU profiling may be supported in the future. In order to profile your application do the following:
- Build engine with -DURHO3D_PROFILING=ON
- Mark code sections you wish to profile with URHO3D_PROFILE* macros.
- Connect profiler application by pressing Connect:
Macros
URHO3D_PROFILE
Profile a block of code until end of scope. Pass unquoted string as a name of block.
void ProfiledFunction()
{
URHO3D_PROFILE("ProfiledFunctionBlock");
}
URHO3D_PROFILE_C
Profile a block of code until end of scope. Pass unquoted string as a name of block. Displayed block will have a specified rgb color.
void ProfiledFunction()
{
URHO3D_PROFILE_C("ProfiledFunctionBlock", 0xff0000);
}
URHO3D_PROFILE_THREAD
If you use worker threads this macro can be used to give meaningful names to the threads. Place this macro at the start of worker function.
void WorkerFunction()
{
URHO3D_PROFILE_THREAD("MyWorker");
}
URHO3D_PROFILE_VALUE
Keep track of arbitrary numeric values.
void Update()
{
URHO3D_PROFILE_VALUE("FPS", GetFps());
}
URHO3D_PROFILE_MESSAGE
Save a message to profiler log window.
void Update()
{
URHO3D_PROFILE_MESSAGE("Hello world", 11);
}
URHO3D_PROFILE_ZONENAME
Set a custom string name to the profiled block.
void ProfiledFunction()
{
URHO3D_PROFILE("ProfiledFunctionBlock");
URHO3D_PROFILE_ZONENAME("SomethingElse", 13);
}
URHO3D_PROFILE_FRAME
Internal engine macro. Do not use.