-
Notifications
You must be signed in to change notification settings - Fork 400
Profiler
The profiler reports how much time is spent in different parts of engine. This is very helpful when you want to optimize your game. Parts of the engine you want to track must be marked by following macros:
- PROFILE_FUNCTION
- PROFILE_BLOCK
Profiler window
void Material::apply(Renderer& renderer, PipelineInstance& pipeline) const
{
PROFILE_FUNCTION();
To start profiling your game it is necessary to check the first checkbox. Once this checkbox is checked the tree view below is filled with data, and a graph is displayed on the bottom of the window. You can navigate in history by clicking on the graph.
Once the profiler is recording there is a very small overhead for each record. However if there is more than a hundred of hits per row, the overhead can become noticable.
Other than tracking time profiler can be used to track integer or string values
void renderMeshes(const Array<RenderableMesh>& meshes)
{
PROFILE_FUNCTION();
if (meshes.empty()) return;
Renderable* renderables = m_scene->getRenderables();
Profiler::pushInt("mesh count", meshes.size());
Profiler::pushString("some msg");
If the PROFILE_INT is called several times per frame, the resulting value is the sum of all calls.