From bf7954ebe7fa7c1f9c7ca77655f35500ffb057fb Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Sun, 16 Sep 2018 12:41:35 +0200 Subject: core: remove LOG_STP from mobile LOG_STP is on longer providing the data needed, since a lot of the startup is indirectly in QML, furthermore using the xcode project and running profiler gives much more detailed information Signed-off-by: Jan Iversen --- core/ssrf.h | 15 --------------- mobile-widgets/qmlmanager.cpp | 8 -------- subsurface-helper.cpp | 5 ----- subsurface-mobile-main.cpp | 37 ------------------------------------- 4 files changed, 65 deletions(-) diff --git a/core/ssrf.h b/core/ssrf.h index 20dc569a4..7f65f2dc5 100644 --- a/core/ssrf.h +++ b/core/ssrf.h @@ -12,21 +12,6 @@ extern "C" { #endif #ifdef __cplusplus - -#ifdef SUBSURFACE_MOBILE -#ifdef ENABLE_STARTUP_TIMING -// Declare generic function, will be seen only in CPP code -// Use void parameters to avoid extra includes -extern void log_stp(const char *ident, QString *buf); - -#define LOG_STP(x) log_stp(x, NULL) -#define LOG_STP_CLIPBOARD(x) log_stp(NULL, x) -#else -#define LOG_STP(x) -#define LOG_STP_CLIPBOARD(x) -#endif // ENABLE_STARTUP_TIMING -#endif // SUBSURFACE_MOBILE - } #else diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index d9133a4ce..f44b6b12b 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -156,7 +156,6 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false), m_pluggedInDeviceName(""), m_showNonDiveComputers(false) { - LOG_STP("qmlmgr starting"); m_instance = this; m_lastDevicePixelRatio = qApp->devicePixelRatio(); timer.start(); @@ -217,7 +216,6 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false), appendTextToLog("No writeable location found, in-memory log only and no libdivecomputer log"); } #endif - LOG_STP("qmlmgr log started"); set_error_cb(&showErrorFromC); appendTextToLog("Starting " + getUserAgent()); appendTextToLog(QStringLiteral("built with libdivecomputer v%1").arg(dc_version(NULL))); @@ -231,13 +229,11 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false), appendTextToLog(getAndroidHWInfo()); #endif 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); QMLPrefs::instance()->setShowPin(false); @@ -246,16 +242,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"); // present dive site lists sorted by name locationModel.sort(LocationInformationModel::NAME); // make sure we know if the current cloud repo has been successfully synced syncLoadFromCloud(); - LOG_STP("qmlmgr sync load cloud"); memset(&m_copyPasteDive, 0, sizeof(m_copyPasteDive)); memset(&what, 0, sizeof(what)); @@ -428,7 +421,6 @@ QString QMLManager::getCombinedLogs() QTextStream in(&f); copyString += in.readAll(); } - LOG_STP_CLIPBOARD(©String); copyString += "---------- finish ----------\n"; diff --git a/subsurface-helper.cpp b/subsurface-helper.cpp index 2faedc30a..d1c24c4cd 100644 --- a/subsurface-helper.cpp +++ b/subsurface-helper.cpp @@ -79,7 +79,6 @@ void run_ui() int availableScreenWidth = appScreen->availableSize().width(); QQmlApplicationEngine engine; register_qml_types(&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 @@ -106,7 +105,6 @@ 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()); @@ -125,7 +123,6 @@ void run_ui() engine.load(QUrl(QStringLiteral("qrc:///qml/main.qml"))); #endif qDebug() << "loaded main.qml"; - LOG_STP("run_ui qml loaded"); qqWindowObject = engine.rootObjects().value(0); if (!qqWindowObject) { fprintf(stderr, "can't create window object\n"); @@ -140,7 +137,6 @@ void run_ui() qDebug() << "qml_window reports width as" << qmlWW << "associated screen width" << qmlSW << "Qt screen reports width as" << availableScreenWidth; QObject::connect(qml_window, &QQuickWindow::screenChanged, QMLManager::instance(), &QMLManager::screenChanged); QMLManager *manager = QMLManager::instance(); - LOG_STP("run_ui qmlmanager instance started"); manager->setDevicePixelRatio(qml_window->devicePixelRatio(), qml_window->screen()); manager->qmlWindow = qqWindowObject; @@ -160,7 +156,6 @@ void run_ui() qml_window->setWidth(width); #endif // not Q_OS_ANDROID and not Q_OS_IOS qml_window->show(); - LOG_STP("run_ui running exec"); #else MainWindow::instance()->show(); #endif // SUBSURFACE_MOBILE diff --git a/subsurface-mobile-main.cpp b/subsurface-mobile-main.cpp index b75c63406..ef6913d8f 100644 --- a/subsurface-mobile-main.cpp +++ b/subsurface-mobile-main.cpp @@ -23,47 +23,15 @@ // Implementation of STP logging #include "core/ssrf.h" -#ifdef ENABLE_STARTUP_TIMING -#include -#include -#include -void log_stp(const char *ident, QString *buf) -{ - static bool firstCall = true; - static QElapsedTimer stpDuration; - static QString stpText; - static QMutex logMutex; - - QMutexLocker l(&logMutex); - - if (firstCall) { - firstCall = false; - stpDuration.start(); - } - if (ident) - stpText += QString("STP ") - .append(QString::number(stpDuration.elapsed())) - .append(" ms, ") - .append(ident) - .append("\n"); - if (buf) { - *buf += "---------- startup timer ----------\n"; - *buf += stpText; - } -} -#endif // ENABLE_STARTUP_TIMING int main(int argc, char **argv) { - LOG_STP("main starting"); - int i; QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true")); // Start application std::unique_ptr app(new QApplication(argc, argv)); - LOG_STP("main Qt started"); // and get comand line arguments QStringList arguments = QCoreApplication::arguments(); @@ -78,7 +46,6 @@ int main(int argc, char **argv) } } git_libgit2_init(); - LOG_STP("main git loaded"); setup_system_prefs(); if (QLocale().measurementSystem() == QLocale::MetricSystem) default_prefs.units = SI_units; @@ -88,11 +55,8 @@ int main(int argc, char **argv) fill_computer_list(); parse_xml_init(); - LOG_STP("main xml parsed"); taglist_init_global(); - LOG_STP("main taglist done"); init_ui(); - LOG_STP("main init_ui done"); if (prefs.default_file_behavior == LOCAL_DEFAULT_FILE) set_filename(prefs.default_filename); else @@ -106,7 +70,6 @@ int main(int argc, char **argv) init_proxy(); - LOG_STP("main call run_ui (continue in qmlmanager)"); if (!quit) run_ui(); exit_ui(); -- cgit v1.2.3-70-g09d2