StartupTimer QML Type
A tool for startup performance analysis. More...
Import Statement: | import QtApplicationManager |
Properties
- automaticReporting : bool
- systemUpTime : int
- timeToFirstFrame : int
Methods
- checkpoint(string name)
- createReport(string title)
Detailed Description
The StartupTimer is a class for measuring the startup performance of the System UI, as well as applications started by the application manager.
Using the checkpoint function, you can log the time that elapsed since the executable was started. In case of the System UI, this is the time since the process was forked. This is also true for applications that are not quick-launched. Quick-launched applications attach to a process that has been pre-forked before the application has been started. In this case the timer will be reset to the actual application start. The time is reported using a monotonic clock with nano-second resolution - see QElapsedTimer for more information.
Note: On Linux, the actual time between the forking of the process and the first checkpoint can only be obtained with 10ms resolution.
In order to activate startup timing measurement, the $AM_STARTUP_TIMER
environment variable needs to be set: if set to 1
, a startup performance analysis will be printed on the console. Anything other than 1
will be interpreted as the name of a file that is used instead of the console.
When activated, this report will always be printed for the System UI. If the application manager is running in multi-process mode, additional reports will also be printed for every QML application that is started. Note that the bar widths can only be compared within a report.
The application manager and its QML launcher will already create a lot of checkpoints on their own and will also call createReport themselves after all the C++ side setup has finished. You can however add arbitrary checkpoints yourself using the QML API: access to the StartupTimer object is possible through a the StartupTimer
root-context property in the QML engine.
All checkpoints will also be logged to the am.startup
logging category as debug
messages, which helps to correlate the timings with log output from other components.
This is an example output, starting the Minidesk
example on a console with ANSI color support:
Property Documentation
automaticReporting : bool |
You can set this property to false
, if you want to prevent the automatic report generation that is done by the application manager. This can be useful, if you are using some form of staged loading in the System UI and want to create the report at a later time.
Note: Please note that you need to set this property to false
before the load operation of the main qml file is finished: ideally in the root elements Component.onCompleted
handler.
The default value is true
.
See also createReport.
systemUpTime : int |
Provides the system's up time as provided by the underlying OS, measured up until the initialization of the StartupTimer singleton in milliseconds.
This is helpful in calculating the time from boot to first frame drawn by adding up the values of systemUpTime and timeToFirstFrame.
timeToFirstFrame : int |
Provides the time from process start until rendering of the first frame in the HMI in milliseconds.
Note: Rendering of the first frame takes more time than just creating the QML root component. Accessing this property from within the Component.onCompleted
signal might be too early.
Method Documentation
checkpoint(string name) |
Adds a new checkpoint with the elapsed time and the given name. Each checkpoint corresponds to a single item in the output created by the next call to createReport.
createReport(string title) |
Outputs a report consisting of all checkpoints reported via the checkpoint function. The title will be appended to the header of the report.
After outputting the report, all reported checkpoints will be cleared. This means that you can call this function multiple times and only newly reported checkpoints will be printed.
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.