// Copyright (C) 2021 The Qt Company Ltd. // Copyright (C) 2019 Luxoft Sweden AB // Copyright (C) 2018 Pelagicore AG // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \example applicationmanager/frame-timer \title Display Frame Rate for the System UI and Applications Example \image frame-timer-example.png The "FrameTimer" example with two applications running. \brief How to use the FrameTimer to display information about the frame rate. \ingroup applicationmanager-examples \note Please \l{wayland-dev-packages}{read this} if you want to build the example on a Linux machine. \section1 Introduction This example shows you how to use the \l FrameTimer component to display frame rate information for both the System UI and the application windows. The System UI comprises of a column of application icons on the left and a graph on the top right, displaying the average frame rate for the System UI itself. To be more precise, this is the System UI's top-level Window. If there are no applications running, the System UI's frame rate typically stays at 1 Frame per Second (FPS). This is because a Qt QML application window is only redrawn when something changed. In this idle state the System UI's frame rate would normally be 0 FPS. The only reason the System UI stays at around 1 FPS in idle in this example is because of the FPS graph itself updating once per second. This is commonly referred to as the \l{https://en.wikipedia.org/wiki/Observer_effect_(information_technology)}{Observer effect}. Starting with 6.9 this example will in addition use the FrameContentTracker component which can help you to find out if the system is redrawing too often, although nothing is changing on screen. This information is displayed in the top right corner as a \e{Duplicate frames} counter. A nice way to see this in action is to run either of the applications and then move their window off-screen to the left, until only the static, non-animated part of their window is visible anymore. Please read the part about performance implications in the FrameContentTracker documentation! The Fish application animates, and therefore redraws, at a rate of 25 FPS. So running it will instantly raise the frame-rate of System UI to 25 FPS as well. \quotefromfile applicationmanager/frame-timer/apps/frame-timer.fish/fish.qml \skipto Timer \printuntil /^\}/ The Rabbit application animates at native speed, which is as fast as the system can or is configured to do, which is usually 60 FPS. Consequently, running this application raises the System UI's FPS further, to 60 FPS. \quotefromfile applicationmanager/frame-timer/apps/frame-timer.rabbit/rabbit.qml \skipto RotationAnimation \printuntil /^\}/ */