mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 08:45:36 +08:00
Runtime check to better detect runtime issues during initialization (hanging)
This commit is contained in:
@@ -19,8 +19,6 @@
|
|||||||
#include "blackmisc/avaircraft.h"
|
#include "blackmisc/avaircraft.h"
|
||||||
#include "blackmisc/blackmiscfreefunctions.h"
|
#include "blackmisc/blackmiscfreefunctions.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
@@ -240,6 +238,9 @@ namespace BlackCore
|
|||||||
// upfront reading of settings, as DBus server already relies on settings
|
// upfront reading of settings, as DBus server already relies on settings
|
||||||
CContextSettings *settings = nullptr;
|
CContextSettings *settings = nullptr;
|
||||||
QString dbusAddress;
|
QString dbusAddress;
|
||||||
|
QMap<QString, int> times;
|
||||||
|
QTime time;
|
||||||
|
time.start();
|
||||||
|
|
||||||
if (config.hasDBusAddress()) dbusAddress = config.getDBusAddress(); // bootstrap / explicit
|
if (config.hasDBusAddress()) dbusAddress = config.getDBusAddress(); // bootstrap / explicit
|
||||||
if (config.hasLocalSettings())
|
if (config.hasLocalSettings())
|
||||||
@@ -256,6 +257,7 @@ namespace BlackCore
|
|||||||
this->initDBusConnection(dbusAddress);
|
this->initDBusConnection(dbusAddress);
|
||||||
Q_ASSERT(this->m_dbusConnection.isConnected());
|
Q_ASSERT(this->m_dbusConnection.isConnected());
|
||||||
}
|
}
|
||||||
|
times.insert("DBus", time.restart());
|
||||||
|
|
||||||
// contexts
|
// contexts
|
||||||
switch (config.getModeSettings())
|
switch (config.getModeSettings())
|
||||||
@@ -271,6 +273,7 @@ namespace BlackCore
|
|||||||
default:
|
default:
|
||||||
qFatal("Always initialize a settings context");
|
qFatal("Always initialize a settings context");
|
||||||
}
|
}
|
||||||
|
times.insert("Settings", time.restart());
|
||||||
|
|
||||||
switch (config.getModeApplication())
|
switch (config.getModeApplication())
|
||||||
{
|
{
|
||||||
@@ -284,6 +287,7 @@ namespace BlackCore
|
|||||||
default:
|
default:
|
||||||
qFatal("Always initialize an application context");
|
qFatal("Always initialize an application context");
|
||||||
}
|
}
|
||||||
|
times.insert("Application", time.restart());
|
||||||
|
|
||||||
switch (config.getModeAudio())
|
switch (config.getModeAudio())
|
||||||
{
|
{
|
||||||
@@ -297,6 +301,7 @@ namespace BlackCore
|
|||||||
default:
|
default:
|
||||||
break; // audio not mandatory
|
break; // audio not mandatory
|
||||||
}
|
}
|
||||||
|
times.insert("Audio", time.restart());
|
||||||
|
|
||||||
switch (config.getModeNetwork())
|
switch (config.getModeNetwork())
|
||||||
{
|
{
|
||||||
@@ -310,6 +315,7 @@ namespace BlackCore
|
|||||||
default:
|
default:
|
||||||
break; // network not mandatory
|
break; // network not mandatory
|
||||||
}
|
}
|
||||||
|
times.insert("Network", time.restart());
|
||||||
|
|
||||||
switch (config.getModeSimulator())
|
switch (config.getModeSimulator())
|
||||||
{
|
{
|
||||||
@@ -323,9 +329,11 @@ namespace BlackCore
|
|||||||
default:
|
default:
|
||||||
break; // network not mandatory
|
break; // network not mandatory
|
||||||
}
|
}
|
||||||
|
times.insert("Simulator", time.restart());
|
||||||
|
|
||||||
// post inits, wiring things among context (e.g. signal slots)
|
// post inits, wiring things among context (e.g. signal slots)
|
||||||
this->initPostSetup();
|
this->initPostSetup();
|
||||||
|
qDebug() << "Init times:" << times;
|
||||||
|
|
||||||
// flag
|
// flag
|
||||||
m_init = true;
|
m_init = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user