2011-09-27 11:52:15 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2018-07-11 13:53:28 +02:00
|
|
|
** Copyright (C) 2018 The Qt Company Ltd.
|
2016-01-15 14:51:16 +01:00
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-09-27 11:52:15 +02:00
|
|
|
**
|
2016-01-15 14:51:16 +01:00
|
|
|
** This file is part of the Qt Creator documentation.
|
2011-09-27 11:52:15 +02:00
|
|
|
**
|
2016-01-15 14:51:16 +01:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2011-09-27 11:52:15 +02:00
|
|
|
**
|
2016-01-15 14:51:16 +01:00
|
|
|
** GNU Free Documentation License Usage
|
2011-09-27 11:52:15 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Free
|
|
|
|
|
** Documentation License version 1.3 as published by the Free Software
|
2016-01-15 14:51:16 +01:00
|
|
|
** Foundation and appearing in the file included in the packaging of
|
|
|
|
|
** this file. Please review the following information to ensure
|
|
|
|
|
** the GNU Free Documentation License version 1.3 requirements
|
|
|
|
|
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
|
2011-09-27 11:52:15 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
// **********************************************************************
|
|
|
|
|
// NOTE: the sections are not ordered by their logical order to avoid
|
|
|
|
|
// reshuffling the file each time the index order changes (i.e., often).
|
|
|
|
|
// Run the fixnavi.pl script to adjust the links to the index order.
|
|
|
|
|
// **********************************************************************
|
|
|
|
|
|
|
|
|
|
/*!
|
2018-07-11 13:53:28 +02:00
|
|
|
\contentspage index.html
|
2011-09-27 11:52:15 +02:00
|
|
|
\page creator-qml-performance-monitor.html
|
2018-08-10 16:15:05 +02:00
|
|
|
\if defined(qtdesignstudio)
|
2018-08-17 14:18:57 +02:00
|
|
|
\previouspage creator-qml-debugging-example.html
|
2018-08-24 13:46:38 +02:00
|
|
|
\nextpage studio-help.html
|
2018-08-10 16:15:05 +02:00
|
|
|
\else
|
|
|
|
|
\previouspage creator-analyze-mode.html
|
2011-12-13 11:52:47 +01:00
|
|
|
\nextpage creator-valgrind-overview.html
|
2018-08-10 16:15:05 +02:00
|
|
|
\endif
|
2011-09-27 11:52:15 +02:00
|
|
|
|
|
|
|
|
\title Profiling QML Applications
|
|
|
|
|
|
2015-04-14 16:20:58 +02:00
|
|
|
You can use the QML Profiler to find causes for typical performance problems
|
|
|
|
|
in your applications, such as slowness and unresponsive, stuttering user
|
|
|
|
|
interfaces. Typical causes include executing too much JavaScript in too few
|
|
|
|
|
frames. All JavaScript must return before the GUI thread can proceed, and
|
|
|
|
|
frames are delayed or dropped if the GUI thread is not ready.
|
|
|
|
|
|
|
|
|
|
Another typical cause for similar performance problems is creating,
|
|
|
|
|
painting, or updating invisible items, which takes time in the GUI thread.
|
|
|
|
|
|
2018-08-30 12:36:23 +02:00
|
|
|
\if defined(qtcreator)
|
2015-04-14 16:20:58 +02:00
|
|
|
Triggering long-running C++ functions, such as paint methods and signal
|
|
|
|
|
handlers, also takes time in the GUI thread, but is more difficult to see in
|
|
|
|
|
the QML Profiler, because it does not profile C++ code.
|
2018-08-30 12:36:23 +02:00
|
|
|
\endif
|
2015-04-14 16:20:58 +02:00
|
|
|
|
|
|
|
|
To find excessive use of JavaScript, check the frame rate in animations and
|
|
|
|
|
Scene Graph events, look for gaps, and check whether the application behaves
|
|
|
|
|
as expected. The JavaScript category displays the run time of functions,
|
|
|
|
|
which you should try to keep below 16 ms per frame.
|
|
|
|
|
|
|
|
|
|
To find problems caused by handling invisible items, look for dropped
|
|
|
|
|
frames and check that you are not using too many short bindings or signal
|
|
|
|
|
handlers that are updated per frame. You can also \l{Visualizing Overdraw}
|
|
|
|
|
{visualize Scene Graph overdraw} to check scene layout and find items that
|
|
|
|
|
are never visible to the users, because they are located outside the screen
|
|
|
|
|
or hidden beneath other, visible elements.
|
|
|
|
|
|
2018-08-30 12:36:23 +02:00
|
|
|
\if defined(qtcreator)
|
2015-04-14 16:20:58 +02:00
|
|
|
If frames get dropped even though JavaScript is not being run, and there are
|
|
|
|
|
large, unexplained gaps in the timeline, check your custom QQuickItem
|
|
|
|
|
implementations. You can use \l{Using Valgrind Code Analysis Tools}
|
|
|
|
|
{Valgrind} or other general purpose profilers to analyze C++ code.
|
2018-08-30 12:36:23 +02:00
|
|
|
\endif
|
2015-04-14 16:20:58 +02:00
|
|
|
|
|
|
|
|
\section1 Using QML Profiler
|
|
|
|
|
|
2011-09-27 11:52:15 +02:00
|
|
|
To monitor the performance of an application in the QML Profiler:
|
|
|
|
|
|
|
|
|
|
\list 1
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li To be able to profile an application, you must set up QML debugging
|
2011-09-27 11:52:15 +02:00
|
|
|
for the project. For more information, see
|
|
|
|
|
\l{Setting Up QML Debugging}.
|
|
|
|
|
|
2018-08-30 12:36:23 +02:00
|
|
|
\if defined(qtcreator)
|
2014-12-11 15:43:19 +01:00
|
|
|
\li In the \uicontrol Projects mode, select a \l{glossary-buildandrun-kit}
|
2013-06-20 15:14:12 +02:00
|
|
|
{kit} with Qt version 4.7.4 or later.
|
2018-08-30 12:36:23 +02:00
|
|
|
\endif
|
2011-09-27 11:52:15 +02:00
|
|
|
|
2017-08-17 17:02:56 +02:00
|
|
|
\note To profile applications on \l{glossary-device}{devices}, you
|
|
|
|
|
must install Qt 4.7.4 or later libraries on them.
|
2011-09-27 11:52:15 +02:00
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
\li Select \uicontrol {Analyze > QML Profiler} to profile the current
|
2011-09-27 11:52:15 +02:00
|
|
|
application.
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Select the
|
2012-04-20 16:59:05 +02:00
|
|
|
\inlineimage qtcreator-analyze-start-button.png
|
2014-12-11 15:43:19 +01:00
|
|
|
(\uicontrol Start) button to start the application from the
|
2012-01-23 16:54:50 +01:00
|
|
|
QML Profiler.
|
2011-09-27 11:52:15 +02:00
|
|
|
|
|
|
|
|
\note If data collection does not start automatically, select the
|
2016-05-03 13:49:23 +02:00
|
|
|
\inlineimage recordfill.png
|
2014-12-11 15:43:19 +01:00
|
|
|
(\uicontrol {Enable Profiling}) button.
|
2011-09-27 11:52:15 +02:00
|
|
|
|
|
|
|
|
\endlist
|
|
|
|
|
|
|
|
|
|
When you start analyzing an application, the application is launched, and
|
|
|
|
|
the QML Profiler immediately begins to collect data. This is indicated by
|
2014-12-11 15:43:19 +01:00
|
|
|
the time running in the \uicontrol Elapsed field.
|
2011-09-27 11:52:15 +02:00
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
Data is collected until you select the \uicontrol {Enable Profiling} button. Data
|
2014-04-07 12:44:45 +02:00
|
|
|
collection
|
2012-01-23 16:54:50 +01:00
|
|
|
takes time, and therefore, there might be a delay
|
2011-09-27 11:52:15 +02:00
|
|
|
before the data is displayed.
|
|
|
|
|
|
|
|
|
|
Do not use application commands to exit the application, because data is
|
2014-12-11 15:43:19 +01:00
|
|
|
sent to the QML Profiler when you select the \uicontrol {Enable Profiling} button.
|
2011-09-27 11:52:15 +02:00
|
|
|
The application continues to run for some seconds, after which it is stopped
|
|
|
|
|
automatically. If you exit the application, the data is not sent.
|
|
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
Select the \uicontrol {Disable Profiling} button to disable the automatic
|
2012-01-23 16:54:50 +01:00
|
|
|
start of the data collection when an
|
2011-09-27 11:52:15 +02:00
|
|
|
application is launched. Data collection starts when you select the button
|
|
|
|
|
again.
|
|
|
|
|
|
2012-01-23 16:54:50 +01:00
|
|
|
To save all the collected data, right-click any QML Profiler view to open
|
2014-12-11 15:43:19 +01:00
|
|
|
the context menu, and then select \uicontrol {Save QML Trace}. To view the saved
|
|
|
|
|
data, select \uicontrol {Load QML Trace}. You can also deliver the saved data to
|
2012-01-23 16:54:50 +01:00
|
|
|
other developers for examination or load data saved by them.
|
2015-11-12 13:44:28 +01:00
|
|
|
|
|
|
|
|
\section1 Specifying Flushing Settings
|
|
|
|
|
|
|
|
|
|
You can specify flushing settings for the QML Profiler either globally for
|
|
|
|
|
all projects or separately for each project. To specify global settings,
|
|
|
|
|
select \uicontrol Tools > \uicontrol Options > \uicontrol Analyzer.
|
|
|
|
|
|
|
|
|
|
To specify custom QML Profiler settings for a particular project, select
|
2016-04-29 16:07:40 +02:00
|
|
|
\uicontrol Projects > \uicontrol Run and then select \uicontrol Custom in
|
|
|
|
|
\uicontrol {QML Profiler Settings}. To restore the global settings for the
|
|
|
|
|
project, select \uicontrol {Restore Global}.
|
2015-11-12 13:44:28 +01:00
|
|
|
|
|
|
|
|
\image qml-profiler-settings.png "QML Profiler Settings"
|
|
|
|
|
|
|
|
|
|
Select the \uicontrol {Flush data while profiling} check box to flush the
|
|
|
|
|
data periodically instead of flushing all data when profiling stops. This
|
|
|
|
|
saves memory on the target device and shortens the wait between the
|
|
|
|
|
profiling being stopped and the data being displayed.
|
|
|
|
|
|
|
|
|
|
In the \uicontrol {Flush interval} field, set the flush interval in
|
|
|
|
|
milliseconds. The shorter the interval, the more often the data is flushed.
|
|
|
|
|
The longer the interval, the more data has to be buffered in the target
|
|
|
|
|
application, potentially wasting memory. However, the flushing itself takes
|
|
|
|
|
time, which can distort the profiling results.
|
2012-01-23 16:54:50 +01:00
|
|
|
|
2016-04-29 16:07:40 +02:00
|
|
|
If you have multiple QML engines and you want to aggregate the data produced
|
|
|
|
|
by all of them into one trace, select the \uicontrol {Process data only when
|
|
|
|
|
process ends} check box. Otherwise, the profiling stops when one of the
|
|
|
|
|
engines stops.
|
|
|
|
|
|
2011-11-15 16:08:47 +01:00
|
|
|
\section1 Attaching to Running Qt Quick Applications
|
|
|
|
|
|
|
|
|
|
To profile Qt Quick applications that are not launched by \QC, select
|
2015-02-18 15:56:03 +01:00
|
|
|
\uicontrol {Analyze > QML Profiler (External)}. You must enable QML debugging and profiling for
|
2011-11-15 16:08:47 +01:00
|
|
|
the application in the project build settings. For more information, see
|
|
|
|
|
\l{Setting Up QML Debugging}.
|
|
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
In the \uicontrol {QML Profiler} dialog, \uicontrol Port field, specify the port to
|
2011-11-15 16:08:47 +01:00
|
|
|
listen to.
|
|
|
|
|
|
2011-09-27 11:52:15 +02:00
|
|
|
\section1 Analyzing Collected Data
|
|
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
The \uicontrol Timeline view displays graphical representations of QML and
|
2014-07-02 16:45:36 +02:00
|
|
|
JavaScript execution and a condensed view of all recorded events.
|
2011-09-27 11:52:15 +02:00
|
|
|
|
|
|
|
|
\image qtcreator-qml-performance-monitor.png "QML Profiler"
|
|
|
|
|
|
2012-01-23 16:54:50 +01:00
|
|
|
Each row in the timeline (6) describes a type of QML events that were
|
|
|
|
|
recorded. Move the cursor on an event on a row to see how long it takes and
|
|
|
|
|
where in the source it is being called. To display the information only when
|
2014-12-11 15:43:19 +01:00
|
|
|
an event is selected, disable the \uicontrol {View Event Information on Mouseover}
|
2016-10-27 17:08:25 +02:00
|
|
|
button (4).
|
2012-01-23 16:54:50 +01:00
|
|
|
|
|
|
|
|
The outline (10) summarizes the period for which data was collected. Drag
|
|
|
|
|
the zoom range (8) or click the outline to move on the outline. You can
|
2016-10-27 17:08:25 +02:00
|
|
|
also move between events by selecting the \uicontrol {Jump to Previous Event}
|
|
|
|
|
and \uicontrol {Jump to Next Event} buttons (1).
|
2012-01-23 16:54:50 +01:00
|
|
|
|
2016-10-27 17:08:25 +02:00
|
|
|
Select the \uicontrol {Show Zoom Slider} button (2) to open a slider that you can
|
2012-01-23 16:54:50 +01:00
|
|
|
use to set the zoom level. You can also drag the zoom handles (9). To reset
|
|
|
|
|
the default zoom level, right-click the timeline to open the context menu,
|
2014-12-11 15:43:19 +01:00
|
|
|
and select \uicontrol {Reset Zoom}.
|
2012-01-23 16:54:50 +01:00
|
|
|
|
2016-10-27 17:08:25 +02:00
|
|
|
Click the time ruler to add vertical orientation lines (5) to the timeline.
|
|
|
|
|
|
2012-01-23 16:54:50 +01:00
|
|
|
\section2 Selecting Event Ranges
|
|
|
|
|
|
|
|
|
|
You can select an event range (7) to view the frame rate of events and to
|
|
|
|
|
compare it with the frame rate of similar events. Select the
|
2016-10-27 17:08:25 +02:00
|
|
|
\uicontrol {Select Range} button (3) to activate the selection tool. Then click in
|
2012-01-23 16:54:50 +01:00
|
|
|
the timeline to specify the beginning of the event range. Drag the selection
|
|
|
|
|
handle to define the end of the range. The length of the range indicates the
|
|
|
|
|
frame rate of the event.
|
|
|
|
|
|
|
|
|
|
You can use event ranges also to measure delays between two subsequent
|
|
|
|
|
events. Place a range between the end of the first event and the beginning
|
2014-12-11 15:43:19 +01:00
|
|
|
of the second event. The \uicontrol Duration field displays the delay between the
|
2012-01-23 16:54:50 +01:00
|
|
|
events in milliseconds.
|
2011-09-27 11:52:15 +02:00
|
|
|
|
2012-01-23 16:54:50 +01:00
|
|
|
To zoom into an event range, double-click it.
|
2011-09-27 11:52:15 +02:00
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
To remove an event range, close the \uicontrol Selection dialog.
|
2011-09-27 11:52:15 +02:00
|
|
|
|
2014-07-02 16:45:36 +02:00
|
|
|
\section2 Understanding the Data
|
|
|
|
|
|
|
|
|
|
Generally, events in the timeline view indicate how long QML or JavaScript
|
|
|
|
|
execution took. Move the mouse over them to see details. For most events,
|
|
|
|
|
they include location in source code, duration and some relevant parts of
|
|
|
|
|
the source code itself.
|
|
|
|
|
|
|
|
|
|
You can click on an event to move the cursor in the code editor to the part
|
|
|
|
|
of the code the event is associated with.
|
|
|
|
|
|
|
|
|
|
The following types of events are displayed in the timeline view on one or
|
|
|
|
|
several rows. The availability of event types depends on the version of Qt
|
2016-01-25 11:08:08 +01:00
|
|
|
the application was compiled with and the version of Qt Quick it is using.
|
2014-07-02 16:45:36 +02:00
|
|
|
|
|
|
|
|
\table
|
|
|
|
|
|
|
|
|
|
\header
|
2014-10-15 16:29:47 +02:00
|
|
|
\li Event Category
|
2014-07-02 16:45:36 +02:00
|
|
|
\li Description
|
|
|
|
|
\li Minimum Qt Version
|
|
|
|
|
\li Qt Quick Version
|
|
|
|
|
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Pixmap Cache}
|
2014-07-02 16:45:36 +02:00
|
|
|
\li Displays the general amount of pixmap data cached, in pixels. In
|
|
|
|
|
addition, displays a separate event for each picture being loaded,
|
|
|
|
|
with specifics about its file name and size.
|
|
|
|
|
\li Qt 5.1
|
|
|
|
|
\li Qt Quick 2
|
|
|
|
|
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Scene Graph}
|
2014-07-02 16:45:36 +02:00
|
|
|
\li Displays the time when scene graph frames are rendered and some
|
|
|
|
|
additional timing information for the various stages executed to do
|
|
|
|
|
so.
|
|
|
|
|
\li Qt 5.1
|
|
|
|
|
\li Qt Quick 2
|
2016-01-25 11:08:08 +01:00
|
|
|
|
2014-07-02 16:45:36 +02:00
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Memory Usage}
|
2014-07-02 16:45:36 +02:00
|
|
|
\li Displays block allocations of the JavaScript memory manager.
|
|
|
|
|
Generally, the memory manager will reserve larger blocks of memory
|
|
|
|
|
in one piece and later hand them out to the application in smaller
|
|
|
|
|
bits. If the application requests single blocks of memory
|
|
|
|
|
surpassing a certain size, the memory manager will allocate those
|
|
|
|
|
separately. Those two modes of operation are shown as events of
|
|
|
|
|
different colors.
|
|
|
|
|
The second row displays the actual usage of the allocated memory.
|
|
|
|
|
This is the amount of JavaScript heap the application has actually
|
|
|
|
|
requested.
|
|
|
|
|
\li Qt 5.4
|
|
|
|
|
\li Qt Quick 2
|
|
|
|
|
|
2014-10-15 17:07:44 +02:00
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Input Events}
|
2014-10-15 17:07:44 +02:00
|
|
|
\li Displays mouse and keyboard events.
|
|
|
|
|
\li Qt 4.7.4
|
|
|
|
|
\li Qt Quick 1 or Qt Quick 2
|
|
|
|
|
|
2014-07-02 16:45:36 +02:00
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol Painting
|
2014-07-02 16:45:36 +02:00
|
|
|
\li Displays the time spent painting the scene for each frame.
|
|
|
|
|
\li Qt 4.7.4
|
|
|
|
|
\li Qt Quick 1
|
|
|
|
|
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol Animations
|
2014-07-02 16:45:36 +02:00
|
|
|
\li Displays the amount of animations that are active and the frame
|
|
|
|
|
rate that they are running at.
|
|
|
|
|
Information about render thread animations is displayed for
|
|
|
|
|
applications that are built with Qt 5.3 or later. Render thread
|
|
|
|
|
animations are shown in a separate row then.
|
|
|
|
|
\li Qt 5.0 (Qt 5.3)
|
|
|
|
|
\li Qt Quick 2
|
|
|
|
|
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol Compiling
|
2014-07-02 16:45:36 +02:00
|
|
|
\li Displays the time spent compiling the QML files.
|
|
|
|
|
\li Qt 4.7.4
|
|
|
|
|
\li Qt Quick 1 or Qt Quick 2
|
|
|
|
|
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol Creating
|
2014-07-02 16:45:36 +02:00
|
|
|
\li Displays the time spent creating the elements in the scene. In Qt
|
|
|
|
|
Quick 2, creation of elements takes place in two stages. The first
|
|
|
|
|
stage is for the creation of the data structures, including child
|
|
|
|
|
elements. The second stage represents the completion callbacks. Not
|
|
|
|
|
all elements trigger completion callbacks, though. The stages are
|
|
|
|
|
shown as separate events in the timeline.
|
|
|
|
|
For Qt Quick 2 applications compiled with versions of Qt before
|
|
|
|
|
5.2.1 only the creation of top-level elements is shown, as single
|
|
|
|
|
events.
|
|
|
|
|
\li Qt 4.7.4 (Qt 5.2.1)
|
|
|
|
|
\li Qt Quick 1 or Qt Quick 2
|
|
|
|
|
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol Binding
|
2014-07-02 16:45:36 +02:00
|
|
|
\li Displays the time when a binding is evaluated and how long the
|
|
|
|
|
evaluation takes.
|
|
|
|
|
\li Qt 4.7.4
|
|
|
|
|
\li Qt Quick 1 or Qt Quick 2
|
|
|
|
|
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Handling Signal}
|
2014-07-02 16:45:36 +02:00
|
|
|
\li Displays the time when a signal is handled and how long the
|
|
|
|
|
handling takes.
|
|
|
|
|
\li Qt 4.7.4
|
|
|
|
|
\li Qt Quick 1 or Qt Quick 2
|
|
|
|
|
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol JavaScript
|
2014-07-02 16:45:36 +02:00
|
|
|
\li Displays the time spent executing the actual JavaScript behind
|
|
|
|
|
bindings and signal handlers. It lists all the JavaScript functions
|
|
|
|
|
you may be using to evaluate bindings or handle signals.
|
|
|
|
|
\li Qt 5.3
|
|
|
|
|
\li Qt Quick 2
|
|
|
|
|
|
|
|
|
|
\endtable
|
2014-04-07 12:44:45 +02:00
|
|
|
|
2014-10-15 16:29:47 +02:00
|
|
|
\section2 Analyzing Scene Graph Events
|
|
|
|
|
|
|
|
|
|
In order to understand the scene graph category, it's important to
|
|
|
|
|
understand how the Qt Quick scene graph works. See
|
|
|
|
|
\l {Qt Quick Scene Graph} and \l {Qt Quick Scene Graph Renderer} for a
|
|
|
|
|
detailed description. The following events are reported in the
|
2014-12-11 15:43:19 +01:00
|
|
|
\uicontrol {Scene Graph} category. Not all events are generated by all render
|
2014-10-15 16:29:47 +02:00
|
|
|
loops. In the Windows and Basic render loops everything runs in the same
|
|
|
|
|
thread and the distinction between GUI thread and render thread is
|
|
|
|
|
meaningless.
|
|
|
|
|
|
|
|
|
|
If you set the environment variable QSG_RENDER_TIMING, you get a textual
|
|
|
|
|
output of similar, but slightly different timings from the application
|
|
|
|
|
being profiled. For easier orientation, the differences are listed below.
|
|
|
|
|
|
|
|
|
|
\table
|
|
|
|
|
\header
|
|
|
|
|
\li Event Type
|
|
|
|
|
\li Thread
|
|
|
|
|
\li Render Loop Types
|
|
|
|
|
\li Label in output of QSG_RENDER_TIMING
|
|
|
|
|
\li Description
|
|
|
|
|
\li Caveats
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Polish}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li GUI
|
|
|
|
|
\li Threaded, Basic, Windows
|
|
|
|
|
\li polish
|
|
|
|
|
\li Final touch-up of items before they are rendered using
|
|
|
|
|
QQuickItem::updatePolish().
|
|
|
|
|
\li Versions of Qt prior to Qt 5.4 record no polish times for the basic
|
|
|
|
|
render loop and incorrect ones for the windows render loop.
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {GUI Thread Wait}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li GUI
|
|
|
|
|
\li Threaded
|
|
|
|
|
\li lock
|
|
|
|
|
\li Executing slots connected to the QQuickWindow::afterAnimating()
|
|
|
|
|
signal and then locking the render thread's mutex before waiting on
|
2014-12-11 15:43:19 +01:00
|
|
|
the same mutex at \uicontrol {GUI Thread Sync}. If this starts long
|
|
|
|
|
before \uicontrol {Render Thread Sync}, there is \e free time in the GUI
|
2014-10-15 16:29:47 +02:00
|
|
|
thread you could be using for running additional QML or JavaScript.
|
|
|
|
|
\li None
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {GUI Thread Sync}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li GUI
|
|
|
|
|
\li Threaded
|
|
|
|
|
\li blockedForSync
|
2016-06-16 17:26:18 +02:00
|
|
|
\li The time the GUI thread is blocked, waiting for the render thread.
|
2014-10-15 16:29:47 +02:00
|
|
|
\li None
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Animations}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li GUI
|
|
|
|
|
\li Threaded, Windows
|
|
|
|
|
\li animations
|
|
|
|
|
\li Advancing animations in the GUI thread. The basic render loop does
|
|
|
|
|
not drive animations in sync with the rendering. This is why no
|
|
|
|
|
animation events will be shown when using the basic render loop.
|
2014-12-11 15:43:19 +01:00
|
|
|
Watch the \uicontrol {Animations} category to see animation timing in
|
2014-10-15 16:29:47 +02:00
|
|
|
this case.
|
|
|
|
|
\li None
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Render Thread Sync}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li Render
|
|
|
|
|
\li Threaded, Basic, Windows
|
|
|
|
|
\li Frame rendered ... sync
|
|
|
|
|
\li Synchronizing the QML state into the scene graph using
|
|
|
|
|
QQuickItem::updatePaintNode().
|
|
|
|
|
\li None
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Render}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li Render
|
|
|
|
|
\li Threaded, Basic, Windows
|
|
|
|
|
\li Frame rendered ... render
|
|
|
|
|
\li Total time spent rendering the frame, including preparing and
|
|
|
|
|
uploading all the necessary data to the GPU. This is the \e gross
|
2014-12-11 15:43:19 +01:00
|
|
|
render time. Do not confuse it with the \e net \uicontrol{Render Render}
|
2014-10-15 16:29:47 +02:00
|
|
|
time below.
|
|
|
|
|
\li With versions of Qt prior to Qt 5.5, the gross render time and the
|
|
|
|
|
below breakup of render times may be misaligned by some
|
|
|
|
|
microseconds due to different, unsynchronized timers being used to
|
2014-12-11 15:43:19 +01:00
|
|
|
measure them. For example \uicontrol {Render Preprocess} might seem to
|
|
|
|
|
start before \uicontrol {Render Thread Sync} is finished.
|
2014-10-15 16:29:47 +02:00
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Swap}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li Render
|
|
|
|
|
\li Threaded, Basic, Windows
|
|
|
|
|
\li Frame rendered ... swap
|
|
|
|
|
\li Swapping frames after rendering.
|
|
|
|
|
\li The output of swap times triggered by setting QSG_RENDER_TIMING is
|
|
|
|
|
incorrect for the basic render loop and versions of Qt prior to
|
|
|
|
|
Qt 5.4. The QML profiler shows the correct swap times.
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Render Preprocess}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li Render
|
|
|
|
|
\li Threaded, Basic, Windows
|
|
|
|
|
\li time in renderer ... preprocess
|
|
|
|
|
\li Calling QSGNode::preprocess() on all nodes that need to be
|
2014-12-11 15:43:19 +01:00
|
|
|
preprocessed. This is part of the gross \uicontrol {Render} step.
|
|
|
|
|
\li May not be properly aligned with \uicontrol {Render} with versions of Qt
|
2014-10-15 16:29:47 +02:00
|
|
|
prior to Qt 5.5.
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Render Update}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li Render
|
|
|
|
|
\li Threaded, Basic, Windows
|
|
|
|
|
\li time in renderer ... updates
|
|
|
|
|
\li Iterating and processing all the nodes in the scene graph to update
|
|
|
|
|
their geometry, transformations, opacity, and other state. In the
|
2014-12-11 15:43:19 +01:00
|
|
|
\uicontrol {Render Thread Sync} stage, each node is updated separately
|
|
|
|
|
with state from the GUI thread. In \uicontrol {Render Update}, all the
|
2014-10-15 16:29:47 +02:00
|
|
|
nodes are combined to create the final scene. This is part of the
|
2014-12-11 15:43:19 +01:00
|
|
|
gross \uicontrol {Render} step.
|
|
|
|
|
\li May not be properly aligned with \uicontrol {Render} with versions of Qt
|
2014-10-15 16:29:47 +02:00
|
|
|
prior to Qt 5.5.
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Render Bind}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li Render
|
|
|
|
|
\li Threaded, Basic, Windows
|
|
|
|
|
\li time in renderer ... binding
|
|
|
|
|
\li Binding the correct framebuffer for OpenGL rendering. This is part
|
2014-12-11 15:43:19 +01:00
|
|
|
of the gross \uicontrol {Render} step.
|
|
|
|
|
\li May not be properly aligned with \uicontrol {Render} with versions of Qt
|
2014-10-15 16:29:47 +02:00
|
|
|
prior to Qt 5.5.
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Render Render}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li Render
|
|
|
|
|
\li Threaded, Basic, Windows
|
|
|
|
|
\li time in renderer ... rendering
|
|
|
|
|
\li The actual process of sending all the data to the GPU via OpenGL.
|
2014-12-11 15:43:19 +01:00
|
|
|
This is part of the gross \uicontrol {Render} step.
|
|
|
|
|
\li May not be properly aligned with \uicontrol {Render} with versions of Qt
|
2014-10-15 16:29:47 +02:00
|
|
|
prior to Qt 5.5.
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Material Compile}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li Render
|
|
|
|
|
\li Threaded, Basic, Windows
|
|
|
|
|
\li shader compiled
|
|
|
|
|
\li Compiling GLSL shader programs.
|
|
|
|
|
\li None
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Glyph Render}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li Render
|
|
|
|
|
\li Threaded, Basic, Windows
|
|
|
|
|
\li glyphs ... rendering
|
|
|
|
|
\li Rendering of font glyphs into textures.
|
|
|
|
|
\li Versions of Qt prior to Qt 5.4 report incorrect times for these
|
|
|
|
|
events.
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Glyph Upload}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li Render
|
|
|
|
|
\li Threaded, Basic, Windows
|
|
|
|
|
\li glyphs ... upload
|
|
|
|
|
\li Uploading of glyph textures to the GPU.
|
|
|
|
|
\li Versions of Qt prior to Qt 5.4 report incorrect times for these
|
|
|
|
|
events.
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Texture Bind}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li Render
|
|
|
|
|
\li Threaded, Basic, Windows
|
|
|
|
|
\li plain texture ... bind
|
|
|
|
|
\li Binding a texture in the OpenGL context using glBindTextures.
|
|
|
|
|
\li None
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Texture Convert}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li Render
|
|
|
|
|
\li Threaded, Basic, Windows
|
|
|
|
|
\li plain texture ... convert
|
|
|
|
|
\li Converting the format and downscaling an image to make it suitable
|
|
|
|
|
for usage as a texture.
|
|
|
|
|
\li None
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Texture Swizzle}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li Render
|
|
|
|
|
\li Threaded, Basic, Windows
|
|
|
|
|
\li plain texture ... swizzle
|
|
|
|
|
\li Swizzling the texture data on the CPU if necessary.
|
|
|
|
|
\li None
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Texture Upload}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li Render
|
|
|
|
|
\li Threaded, Basic, Windows
|
|
|
|
|
\li plain texture ... upload / atlastexture uploaded
|
|
|
|
|
\li Uploading the texture data to the GPU.
|
|
|
|
|
\li None
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Texture Mipmap}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li Render
|
|
|
|
|
\li Threaded, Basic, Windows
|
|
|
|
|
\li plain texture ... mipmap
|
|
|
|
|
\li Mipmapping a texture on the GPU.
|
|
|
|
|
\li None
|
|
|
|
|
\row
|
2014-12-11 15:43:19 +01:00
|
|
|
\li \uicontrol {Texture Delete}
|
2014-10-15 16:29:47 +02:00
|
|
|
\li Render
|
|
|
|
|
\li Threaded, Basic, Windows
|
|
|
|
|
\li plain texture deleted
|
|
|
|
|
\li Deleting a texture from the GPU that became unnecessary.
|
|
|
|
|
\li None
|
|
|
|
|
\endtable
|
|
|
|
|
|
2015-12-04 13:30:54 +01:00
|
|
|
\section1 Viewing Statistics
|
2011-09-27 11:52:15 +02:00
|
|
|
|
2015-12-04 13:30:54 +01:00
|
|
|
The \uicontrol Statistics view displays the number of times each binding, create,
|
2014-04-07 12:44:45 +02:00
|
|
|
compile, JavaScript, or signal event is triggered and the average time it
|
|
|
|
|
takes. This allows you to examine which events you need to optimize. A high
|
|
|
|
|
number of occurrences might indicate that an event is triggered
|
|
|
|
|
unnecessarily. To view the median, longest, and shortest time for the
|
2014-12-11 15:43:19 +01:00
|
|
|
occurrences, select \uicontrol {Extended Event Statistics} in the context menu.
|
2014-04-07 12:44:45 +02:00
|
|
|
|
|
|
|
|
Click on an event to move to it in the source code
|
2011-09-27 11:52:15 +02:00
|
|
|
in the code editor.
|
|
|
|
|
|
2016-03-07 13:43:28 +01:00
|
|
|
\image qml-profiler-statistics.png "Statistics view"
|
2011-09-27 11:52:15 +02:00
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
The \uicontrol Callers and \uicontrol Callees panes show dependencies between events.
|
2011-09-27 11:52:15 +02:00
|
|
|
They allow you to examine the internal functions of the application.
|
2014-12-11 15:43:19 +01:00
|
|
|
The \uicontrol Callers pane summarizes the QML events that trigger a binding.
|
2012-01-23 16:54:50 +01:00
|
|
|
This tells you what caused a change in a binding.
|
2014-12-11 15:43:19 +01:00
|
|
|
The \uicontrol Callees pane summarizes the QML events that a binding triggers.
|
2011-09-27 11:52:15 +02:00
|
|
|
This tells you which QML events are affected if you change a binding.
|
|
|
|
|
|
2014-04-07 12:44:45 +02:00
|
|
|
Click on an event to move to it in the source code in the code editor.
|
2011-09-27 11:52:15 +02:00
|
|
|
|
2014-12-11 15:43:19 +01:00
|
|
|
When you select an event in the \uicontrol Timeline view, information about it is
|
2015-12-04 13:30:54 +01:00
|
|
|
displayed in the \uicontrol Statistics view. To view an event range in the
|
2015-12-04 16:54:58 +01:00
|
|
|
\uicontrol Statistics view, select \uicontrol {Analyze Current Range}
|
2015-12-04 13:30:54 +01:00
|
|
|
in the context menu in the \uicontrol Timeline view.
|
2011-09-27 11:52:15 +02:00
|
|
|
|
2012-01-23 16:54:50 +01:00
|
|
|
To copy the contents of one view or row to the clipboard, select
|
2014-12-11 15:43:19 +01:00
|
|
|
\uicontrol {Copy Table} or \uicontrol {Copy Row} in the context menu.
|
2011-09-27 11:52:15 +02:00
|
|
|
|
2015-12-04 13:30:54 +01:00
|
|
|
JavaScript events are shown in the \uicontrol Statistics view only for applications
|
2015-06-29 14:36:21 +02:00
|
|
|
that use Qt Quick 2 and are compiled with Qt 5.3 or later.
|
2016-03-04 15:51:26 +01:00
|
|
|
|
|
|
|
|
\section2 Visualizing Statistics as Flame Graphs
|
|
|
|
|
|
2016-07-18 11:25:57 +02:00
|
|
|
The \uicontrol {Flame Graph} view shows a more concise statistical overview
|
2016-10-27 15:30:42 +02:00
|
|
|
of QML and JavaScript execution. In the \uicontrol {Visualize Total Time}
|
|
|
|
|
view, the horizontal bars show the amount of
|
2016-03-04 15:51:26 +01:00
|
|
|
time all invocations of a certain function took together, relative to the
|
|
|
|
|
total runtime of all JavaScript and QML events. The nesting shows which
|
2016-10-27 15:30:42 +02:00
|
|
|
functions were called by which other ones.
|
|
|
|
|
|
|
|
|
|
\image qml-profiler-flamegraph.png "Flame Graph View"
|
|
|
|
|
|
|
|
|
|
To view the total amount of memory allocated by the functions in the
|
|
|
|
|
\uicontrol {Visualize Memory} view, select \uicontrol Memory in the
|
|
|
|
|
drop-down menu (1).
|
|
|
|
|
|
|
|
|
|
To view the the number of memory allocations performed by the functions in
|
|
|
|
|
the \uicontrol {Visualize Allocations} view, select \uicontrol Allocations
|
|
|
|
|
in the drop-down menu.
|
|
|
|
|
|
2018-06-06 10:25:40 +02:00
|
|
|
Double-click an item in a view to zoom into it. Double-click an empty
|
|
|
|
|
area in the view to zoom out again.
|
|
|
|
|
|
2016-10-27 15:30:42 +02:00
|
|
|
Unlike the
|
2016-07-18 11:25:57 +02:00
|
|
|
\uicontrol Timeline view, the \uicontrol {Flame Graph} view does not show the
|
2016-03-04 15:51:26 +01:00
|
|
|
time spans when no QML or JavaScript is running at all. Thus, it is not
|
|
|
|
|
suitable for analyzing per frame execution times. However, it is very easy
|
|
|
|
|
to see the total impact of the various QML and JavaScript events there.
|
|
|
|
|
|
2011-09-27 11:52:15 +02:00
|
|
|
*/
|