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 <jani@apache.org>
This commit is contained in:
jan Iversen 2018-09-16 12:41:35 +02:00 committed by Dirk Hohndel
parent a96be9af68
commit bf7954ebe7
4 changed files with 0 additions and 65 deletions

View file

@ -12,21 +12,6 @@ extern "C" {
#endif #endif
#ifdef __cplusplus #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 #else

View file

@ -156,7 +156,6 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false),
m_pluggedInDeviceName(""), m_pluggedInDeviceName(""),
m_showNonDiveComputers(false) m_showNonDiveComputers(false)
{ {
LOG_STP("qmlmgr starting");
m_instance = this; m_instance = this;
m_lastDevicePixelRatio = qApp->devicePixelRatio(); m_lastDevicePixelRatio = qApp->devicePixelRatio();
timer.start(); timer.start();
@ -217,7 +216,6 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false),
appendTextToLog("No writeable location found, in-memory log only and no libdivecomputer log"); appendTextToLog("No writeable location found, in-memory log only and no libdivecomputer log");
} }
#endif #endif
LOG_STP("qmlmgr log started");
set_error_cb(&showErrorFromC); set_error_cb(&showErrorFromC);
appendTextToLog("Starting " + getUserAgent()); appendTextToLog("Starting " + getUserAgent());
appendTextToLog(QStringLiteral("built with libdivecomputer v%1").arg(dc_version(NULL))); appendTextToLog(QStringLiteral("built with libdivecomputer v%1").arg(dc_version(NULL)));
@ -231,13 +229,11 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false),
appendTextToLog(getAndroidHWInfo()); appendTextToLog(getAndroidHWInfo());
#endif #endif
setStartPageText(tr("Starting...")); setStartPageText(tr("Starting..."));
LOG_STP("qmlmgr start page");
// ensure that we start the BTDiscovery - this should be triggered by the export of the class // 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 // to QML, but that doesn't seem to always work
BTDiscovery *btDiscovery = BTDiscovery::instance(); BTDiscovery *btDiscovery = BTDiscovery::instance();
m_btEnabled = btDiscovery->btAvailable(); m_btEnabled = btDiscovery->btAvailable();
LOG_STP("qmlmgr bt available");
connect(&btDiscovery->localBtDevice, &QBluetoothLocalDevice::hostModeStateChanged, connect(&btDiscovery->localBtDevice, &QBluetoothLocalDevice::hostModeStateChanged,
this, &QMLManager::btHostModeChange); this, &QMLManager::btHostModeChange);
QMLPrefs::instance()->setShowPin(false); QMLPrefs::instance()->setShowPin(false);
@ -246,16 +242,13 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false),
progress_callback = &progressCallback; progress_callback = &progressCallback;
connect(locationProvider, SIGNAL(haveSourceChanged()), this, SLOT(hasLocationSourceChanged())); connect(locationProvider, SIGNAL(haveSourceChanged()), this, SLOT(hasLocationSourceChanged()));
setLocationServiceAvailable(locationProvider->hasLocationsSource()); setLocationServiceAvailable(locationProvider->hasLocationsSource());
LOG_STP("qmlmgr gps started");
set_git_update_cb(&gitProgressCB); set_git_update_cb(&gitProgressCB);
LOG_STP("qmlmgr git update");
// present dive site lists sorted by name // present dive site lists sorted by name
locationModel.sort(LocationInformationModel::NAME); locationModel.sort(LocationInformationModel::NAME);
// make sure we know if the current cloud repo has been successfully synced // make sure we know if the current cloud repo has been successfully synced
syncLoadFromCloud(); syncLoadFromCloud();
LOG_STP("qmlmgr sync load cloud");
memset(&m_copyPasteDive, 0, sizeof(m_copyPasteDive)); memset(&m_copyPasteDive, 0, sizeof(m_copyPasteDive));
memset(&what, 0, sizeof(what)); memset(&what, 0, sizeof(what));
@ -428,7 +421,6 @@ QString QMLManager::getCombinedLogs()
QTextStream in(&f); QTextStream in(&f);
copyString += in.readAll(); copyString += in.readAll();
} }
LOG_STP_CLIPBOARD(&copyString);
copyString += "---------- finish ----------\n"; copyString += "---------- finish ----------\n";

View file

@ -79,7 +79,6 @@ void run_ui()
int availableScreenWidth = appScreen->availableSize().width(); int availableScreenWidth = appScreen->availableSize().width();
QQmlApplicationEngine engine; QQmlApplicationEngine engine;
register_qml_types(&engine); register_qml_types(&engine);
LOG_STP("run_ui qml engine started");
KirigamiPlugin::getInstance().registerTypes(); KirigamiPlugin::getInstance().registerTypes();
#if defined(__APPLE__) && !defined(Q_OS_IOS) #if defined(__APPLE__) && !defined(Q_OS_IOS)
// when running the QML UI on a Mac the deployment of the QML Components seems // 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("gpsModel", gpsSortModel);
ctxt->setContextProperty("vendorList", vendorList); ctxt->setContextProperty("vendorList", vendorList);
set_non_bt_addresses(); set_non_bt_addresses();
LOG_STP("run_ui set_non_bt_adresses");
ctxt->setContextProperty("connectionListModel", &connectionListModel); ctxt->setContextProperty("connectionListModel", &connectionListModel);
ctxt->setContextProperty("logModel", MessageHandlerModel::self()); ctxt->setContextProperty("logModel", MessageHandlerModel::self());
@ -125,7 +123,6 @@ void run_ui()
engine.load(QUrl(QStringLiteral("qrc:///qml/main.qml"))); engine.load(QUrl(QStringLiteral("qrc:///qml/main.qml")));
#endif #endif
qDebug() << "loaded main.qml"; qDebug() << "loaded main.qml";
LOG_STP("run_ui qml loaded");
qqWindowObject = engine.rootObjects().value(0); qqWindowObject = engine.rootObjects().value(0);
if (!qqWindowObject) { if (!qqWindowObject) {
fprintf(stderr, "can't create window object\n"); 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; 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); QObject::connect(qml_window, &QQuickWindow::screenChanged, QMLManager::instance(), &QMLManager::screenChanged);
QMLManager *manager = QMLManager::instance(); QMLManager *manager = QMLManager::instance();
LOG_STP("run_ui qmlmanager instance started");
manager->setDevicePixelRatio(qml_window->devicePixelRatio(), qml_window->screen()); manager->setDevicePixelRatio(qml_window->devicePixelRatio(), qml_window->screen());
manager->qmlWindow = qqWindowObject; manager->qmlWindow = qqWindowObject;
@ -160,7 +156,6 @@ void run_ui()
qml_window->setWidth(width); qml_window->setWidth(width);
#endif // not Q_OS_ANDROID and not Q_OS_IOS #endif // not Q_OS_ANDROID and not Q_OS_IOS
qml_window->show(); qml_window->show();
LOG_STP("run_ui running exec");
#else #else
MainWindow::instance()->show(); MainWindow::instance()->show();
#endif // SUBSURFACE_MOBILE #endif // SUBSURFACE_MOBILE

View file

@ -23,47 +23,15 @@
// Implementation of STP logging // Implementation of STP logging
#include "core/ssrf.h" #include "core/ssrf.h"
#ifdef ENABLE_STARTUP_TIMING
#include <QElapsedTimer>
#include <QMutex>
#include <QMutexLocker>
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) int main(int argc, char **argv)
{ {
LOG_STP("main starting");
int i; int i;
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true")); QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
// Start application // Start application
std::unique_ptr<QApplication> app(new QApplication(argc, argv)); std::unique_ptr<QApplication> app(new QApplication(argc, argv));
LOG_STP("main Qt started");
// and get comand line arguments // and get comand line arguments
QStringList arguments = QCoreApplication::arguments(); QStringList arguments = QCoreApplication::arguments();
@ -78,7 +46,6 @@ int main(int argc, char **argv)
} }
} }
git_libgit2_init(); git_libgit2_init();
LOG_STP("main git loaded");
setup_system_prefs(); setup_system_prefs();
if (QLocale().measurementSystem() == QLocale::MetricSystem) if (QLocale().measurementSystem() == QLocale::MetricSystem)
default_prefs.units = SI_units; default_prefs.units = SI_units;
@ -88,11 +55,8 @@ int main(int argc, char **argv)
fill_computer_list(); fill_computer_list();
parse_xml_init(); parse_xml_init();
LOG_STP("main xml parsed");
taglist_init_global(); taglist_init_global();
LOG_STP("main taglist done");
init_ui(); init_ui();
LOG_STP("main init_ui done");
if (prefs.default_file_behavior == LOCAL_DEFAULT_FILE) if (prefs.default_file_behavior == LOCAL_DEFAULT_FILE)
set_filename(prefs.default_filename); set_filename(prefs.default_filename);
else else
@ -106,7 +70,6 @@ int main(int argc, char **argv)
init_proxy(); init_proxy();
LOG_STP("main call run_ui (continue in qmlmanager)");
if (!quit) if (!quit)
run_ui(); run_ui();
exit_ui(); exit_ui();