mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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 <jani@apache.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
3963e44404
commit
76f61468e6
4 changed files with 77 additions and 0 deletions
|
@ -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("<font color=\"red\">")
|
||||
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue