Measuring the performance of your application
Kanzi provides different means of measuring the performance of your application and displays various performance parameters. Use these means and parameters to improve the performance of your application.
Viewing the application performance in Kanzi Studio
To analyze the performance and inner structure of your application in Kanzi Studio in the Preview click , and use the drop-down menu to select:
- Performance HUD shows the overall performance indicators of your Kanzi application during the last 300 frames including:
- Frame duration shows the time in milliseconds it took to render a frame. The top value in the Frame duration graph shows the longest, and the bottom value the average time it took to render a frame during the last 300 frames.
Use this information to identify performance bottlenecks in your Kanzi application. For example, you can use it to find out how to improve the performance of your application by distributing rendering across several frames. See Distributing rendering across several frames.
- Batch count shows how many individual draw calls were executed (
glDrawElements
and glDrawArrays
).
You can access the batch count using the Kanzi Engine API by calling getBatchCount()
.
The top value in the Batch count graph shows the highest number of batches during the last 300 frames, and the bottom value the number of batches in the last frame.
- Triangle count shows how many individual triangles were drawn in total during a frame.
You can access the triangle count in the Kanzi Engine API by calling getTriangleCount()
. - Texture switches shows how many times new texture was bound to GPU.
You can access the texture switch count in the Kanzi Engine API by calling getTextureSwitchCount()
. - Framebuffer object (FBO) switches shows how many framebuffer objects were bound to GPU. See Rendering best practices.
You can access the buffer switch count in the Kanzi Engine API by calling getFramebufferSwitchCount()
. - Shader shows how many times a new shader was bound for the newly applied batch and how many individual shader uniforms were sent for the last frame. See Reducing shader switches.
You can access the shader switch count in the Kanzi Engine API by calling getShaderSwitchCount()
.
You can access the uniforms sent in the Kanzi Engine API by calling getUniformSendCount()
. - Buffer switches shows how many vertex, index, and uniform buffer objects were bound to GPU.
You can access the buffer switch count in the Kanzi Engine API by calling getBufferSwitchCount()
. - Buffer/texture data updates shows how many times new vertex buffer or texture data was uploaded to the GPU. If the same buffer is accessed for write and read operations, these heavyweight operations can cause delay in GPU execution. The ideal value is 0. For example, this value can increase when the text glyph cache needs frequent updates. In this case, to decrease the value reduce the Font Size.
You can access this in the Kanzi Engine API by calling getHeavyweightCallCount()
. - View camera shows which Camera node is used for displaying the scene in your application.
- Resource memory consumption shows how much VRAM and RAM your Kanzi application uses.
- Animation player shows the current time in your application.
- Animation HUD shows animation performance statistics:
- Total time shows the amount of time used per frame for the execution of animation.
- Entries shows the amount of time used for the entry tree iteration.
- Samples(n) shows the amount of time used by animation data that consists keyframe interpolation for a single property attribute. The number in parentheses shows how many such animations were iterated.
- Blended(n) shows the amount of time used by animation data under Timeline Entry where the Timeline Entry contains Blend Mode other than None. The number in parentheses shows the number of such samples.
- Layout total time shows the amount of time Kanzi Engine used for iterating the layout nodes, such as Grid Layout and Stack Layout nodes.
- Currently running Timeline Entry graph. The smaller the graph, the faster the animation module of Kanzi Engine executes. It also shows if the graph has completed entries that still belong to the animation graph.
See Viewing the overall performance and Animations best practices.
- Overdraw draws nodes in x-ray view to enable you to identify the overlapping that causes overdraw. See Preventing overdraw with the Sorting Filter.
- Framebuffer objects marks with orange stripes nodes that are rendered into textures and cause a framebuffer object switch. See Rendering best practices.
- Transparency marks transparent nodes with blue stripes. See Setting nodes for efficient rendering.
Viewing the overall performance
To view the overall performance of your Kanzi application:
- In the Kanzi Studio Preview, click and use the drop-down menu to select Performance HUD.
- Enable the display of the Performance HUD in the application.cfg configuration file:
FPSInfoEnabled = 1
See Show the performance information.
- Enable the display of Performance HUD in the C++ application in the
onConfigure()
function:configuration.previewProperties.fpsInfoEnabled = 1;
See Show the performance information.
- Enable it on-the-fly using the
kzu_preview_system.h
interface:
struct KzuPreviewSystem* previewSystem;
previewSystem = kzaApplicationGetPreviewSystem(application);
result = kzuPreviewSystemEnableFeature(previewSystem, KZU_PREVIEW_SYSTEM_FEATURE_HUD);
kzsErrorForward(result);
result = kzuPreviewSystemSetPreviewOptionInteger(previewSystem, KZU_PREVIEW_SYSTEM_OPTION_PERFORMANCE_HUD, 1);
kzsErrorForward(result);
- To write the frame rate values to a log file, you can retrieve the current frame rate value from the Kanzi Engine by calling
getFramesPerSecond
. You can retrieve Kanzi Engine from the application by calling getEngine()
.
- To get the amount of time it takes to render a frame you can use the
default_render_target.hpp
:
for (size_t i = 0, count = getRenderTargetCount(); i < count; ++i)
{
RenderTarget& renderTarget = *getRenderTarget(i).get();
unsigned int frameTime = renderTarget.getLastFrameTime();
}
The frame time is the time between the last two calls to RenderTarget::swapBuffers(), and as such it is specific to RenderTarget. There is no global frame duration time.
- Enable trigger function call profiling to print every 100th frame the information from the function call tree and how much time (in milliseconds) specific functions took:
configuration.previewProperties.functionCallProfilingEnabled = KZ_TRUE;
Viewing the loading times of resources
To view in the Kanzi debug console how much time it takes to load the resources and the scene graph in the .kzb your application uses, enable the profiling in the C++ application in the onConfigure()
function:
configuration.previewProperties.loadingTimeProfilingEnabled = KZ_TRUE;
Viewing the overdraw of objects
Overdraw visualization shows a lot of intensity in areas where fragments are unnecessarily rendered.
To view overdraw in your application:
Viewing the animation and layout performance
To view the animation and layout performance of your application:
Viewing nodes that are rendered into texture
Switching between framebuffer objects can cause significant performance reduction on some platforms. Conditions when Kanzi renders a node into a texture can be complex. For example, rotation, scale, or opacity can cause render to texture to occur.
To see whether a node is rendered into a texture, and causing a framebuffer object switch, in the Preview click and use the drop-down menu to select Framebuffer objects.
The Preview highlights the layers that are rendered into texture with transparent, orange stripes.
Viewing nodes using alpha blending
In Kanzi Studio you can see which 2D nodes in your application use alpha blending and as such show the content behind them.
To view in the Preview the 2D nodes that use alpha blending in the Preview click and use the drop-down menu to select Transparency.
The Preview highlights the translucent areas with transparent, blue stripes.
See also
Reducing shader switches
Preventing overdraw with the Sorting Filter
Setting nodes for efficient rendering
Rendering best practices
Animations best practices
Best practices
Open topic with navigation