StartupTimer QML Type

A tool for startup performance analysis. More...

Import Statement: import QtApplicationManager 2.0

Properties

Methods

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.

This is an example output, starting the Neptune UI on a console with ANSI color support:


== STARTUP TIMING REPORT: System UI ==
0'110.001 entered main                                   
0'110.015 after basic initialization                     
0'110.311 after sudo server fork                         
0'148.911 after application constructor                   
0'150.086 after command line parse                        
0'150.154 after logging setup                             
0'150.167 after startup-plugin load                       
0'151.714 after installer setup checks                    
0'151.847 after runtime registration                      
0'156.278 after application database loading              
0'158.450 after ApplicationManager instantiation           
0'158.477 after NotificationManager instantiation          
0'158.534 after SystemMonitor instantiation                
0'158.572 after quick-launcher setup                       
0'159.130 after ApplicationInstaller instantiation         
0'159.192 after QML registrations                          
0'164.888 after QML engine instantiation                   
0'189.619 after D-Bus registrations                        
2'167.233 after loading main QML file                                                                         
2'167.489 after WindowManager/QuickView instantiation                                                         
2'170.423 after window show                                                                                   
2'359.482 after first frame drawn                                                                                  

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.


© 2021 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.