From 76f61468e69020bb42f8b726e78635ec4d4b8a57 Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Mon, 28 May 2018 16:25:39 +0200 Subject: mobile: add timer to measure startup. Subsurface-mobile has a long startup time; in order to isolate the problem(s) a timer is added to see where time is "lost". The collected startup times are added to the clipboard together with the other logs, allowing test users to report back. All this is only enabled when compiling with -DENABLE_STARTUP_TIMING Closes #1340 [Dirk Hohndel: collapsed multiple commits and minor white space cleanups, added missing QMutex variable] Signed-off-by: Jan Iversen Signed-off-by: Dirk Hohndel --- subsurface-mobile-helper.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'subsurface-mobile-helper.cpp') diff --git a/subsurface-mobile-helper.cpp b/subsurface-mobile-helper.cpp index 38b6be9f4..5fe83acd9 100644 --- a/subsurface-mobile-helper.cpp +++ b/subsurface-mobile-helper.cpp @@ -29,6 +29,8 @@ #include "mobile-widgets/qml/kirigami/src/kirigamiplugin.h" +#include "core/ssrf.h" + QObject *qqWindowObject = NULL; void set_non_bt_addresses() { @@ -51,6 +53,7 @@ void init_ui() void run_ui() { + LOG_STP("run_ui starting"); qmlRegisterType("org.subsurfacedivelog.mobile", 1, 0, "QMLManager"); qmlRegisterType("org.subsurfacedivelog.mobile", 1, 0, "QMLProfile"); @@ -63,6 +66,7 @@ void run_ui() qmlRegisterType("org.subsurfacedivelog.mobile", 1, 0, "MapLocation"); QQmlApplicationEngine engine; + LOG_STP("run_ui qml engine started"); KirigamiPlugin::getInstance().registerTypes(); #if defined(__APPLE__) && !defined(Q_OS_IOS) // when running the QML UI on a Mac the deployment of the QML Components seems @@ -79,11 +83,13 @@ void run_ui() #endif engine.addImportPath("qrc://imports"); DiveListModel diveListModel; + LOG_STP("run_ui diveListModel started"); DiveListSortModel *sortModel = new DiveListSortModel(0); sortModel->setSourceModel(&diveListModel); sortModel->setDynamicSortFilter(true); sortModel->setSortRole(DiveListModel::DiveDateRole); sortModel->sort(0, Qt::DescendingOrder); + LOG_STP("run_ui diveListModel sorted"); GpsListModel gpsListModel; QSortFilterProxyModel *gpsSortModel = new QSortFilterProxyModel(0); gpsSortModel->setSourceModel(&gpsListModel); @@ -95,11 +101,13 @@ void run_ui() ctxt->setContextProperty("gpsModel", gpsSortModel); ctxt->setContextProperty("vendorList", vendorList); set_non_bt_addresses(); + LOG_STP("run_ui set_non_bt_adresses"); ctxt->setContextProperty("connectionListModel", &connectionListModel); ctxt->setContextProperty("logModel", MessageHandlerModel::self()); engine.load(QUrl(QStringLiteral("qrc:///qml/main.qml"))); + LOG_STP("run_ui qml loaded"); qqWindowObject = engine.rootObjects().value(0); if (!qqWindowObject) { fprintf(stderr, "can't create window object\n"); @@ -112,8 +120,10 @@ void run_ui() QScreen *screen = qml_window->screen(); QObject::connect(qml_window, &QQuickWindow::screenChanged, QMLManager::instance(), &QMLManager::screenChanged); QMLManager *manager = QMLManager::instance(); + LOG_STP("run_ui qmlmanager instance started"); // now that the log file is initialized... show_computer_list(); + LOG_STP("run_ui show_computer_list"); manager->setDevicePixelRatio(qml_window->devicePixelRatio(), qml_window->screen()); manager->dlSortModel = sortModel; @@ -124,6 +134,7 @@ void run_ui() qml_window->setWidth(800); #endif qml_window->show(); + LOG_STP("run_ui running exec"); qApp->exec(); } -- cgit v1.2.3-70-g09d2