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 --- mobile-widgets/qmlmanager.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'mobile-widgets') diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 4a15f26e0..33376656b 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -32,6 +32,8 @@ #include "qt-models/tankinfomodel.h" #include "core/downloadfromdcthread.h" +#include "core/ssrf.h" + QMLManager *QMLManager::m_instance = NULL; #define RED_FONT QLatin1Literal("") @@ -138,6 +140,7 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false), alreadySaving(false), m_device_data(new DCDeviceData(this)) { + LOG_STP("qmlmgr starting"); m_instance = this; m_lastDevicePixelRatio = qApp->devicePixelRatio(); timer.start(); @@ -164,6 +167,7 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false), + " at " + QDateTime::currentDateTime().toString()); } #endif + LOG_STP("qmlmgr log started"); set_error_cb(&showErrorFromC); appendTextToLog("Starting " + getUserAgent()); appendTextToLog(QStringLiteral("built with libdivecomputer v%1").arg(dc_version(NULL))); @@ -172,11 +176,13 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false), git_libgit2_version(&git_maj, &git_min, &git_rev); appendTextToLog(QStringLiteral("built with libgit2 %1.%2.%3").arg(git_maj).arg(git_min).arg(git_rev)); setStartPageText(tr("Starting...")); + LOG_STP("qmlmgr start page"); // ensure that we start the BTDiscovery - this should be triggered by the export of the class // to QML, but that doesn't seem to always work BTDiscovery *btDiscovery = BTDiscovery::instance(); m_btEnabled = btDiscovery->btAvailable(); + LOG_STP("qmlmgr bt available"); connect(&btDiscovery->localBtDevice, &QBluetoothLocalDevice::hostModeStateChanged, this, &QMLManager::btHostModeChange); setShowPin(false); @@ -185,10 +191,13 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false), progress_callback = &progressCallback; connect(locationProvider, SIGNAL(haveSourceChanged()), this, SLOT(hasLocationSourceChanged())); setLocationServiceAvailable(locationProvider->hasLocationsSource()); + LOG_STP("qmlmgr gps started"); set_git_update_cb(&gitProgressCB); + LOG_STP("qmlmgr git update"); // make sure we know if the current cloud repo has been successfully synced syncLoadFromCloud(); + LOG_STP("qmlmgr sync load cloud"); } void QMLManager::applicationStateChanged(Qt::ApplicationState state) @@ -352,6 +361,7 @@ void QMLManager::copyAppLogToClipboard() QTextStream in(&f); copyString += in.readAll(); } + LOG_STP_CLIPBOARD(©String); copyString += "---------- finish ----------\n"; // and copy to clipboard -- cgit v1.2.3-70-g09d2