[xplane] Add monitoring of the number of track miles lost due to low FPS

This commit is contained in:
Mat Sutcliffe
2020-01-23 18:42:41 +00:00
parent 3a73933cf1
commit 377b2f6a3e
10 changed files with 52 additions and 16 deletions

View File

@@ -369,7 +369,7 @@ namespace BlackSimPlugin
if ((m_slowTimerCalls % 5u) == 0u)
{
// reading FPS resets average, so we only monitor over some time
m_serviceProxy->getFrameStats(&m_averageFps, &m_simTimeRatio);
m_serviceProxy->getFrameStats(&m_averageFps, &m_simTimeRatio, &m_trackMilesShort);
}
}
}

View File

@@ -319,30 +319,32 @@ namespace BlackSimPlugin
m_dbusInterface->callDBusAsync(QLatin1String("isUsingRealTime"), setterCallback(o_isRealTime));
}
void CXSwiftBusServiceProxy::getFrameStats(double *o_averageFps, double *o_simTimeRatio) const
void CXSwiftBusServiceProxy::getFrameStats(double *o_averageFps, double *o_simTimeRatio, double *o_trackMilesLost) const
{
std::function<void(QDBusPendingCallWatcher *)> callback = [ = ](QDBusPendingCallWatcher * watcher)
{
QDBusPendingReply<double, double> reply = *watcher;
QDBusPendingReply<double, double, double> reply = *watcher;
if (!reply.isError())
{
*o_averageFps = reply.argumentAt<0>();
*o_simTimeRatio = reply.argumentAt<1>();
*o_trackMilesLost = reply.argumentAt<2>();
}
watcher->deleteLater();
};
m_dbusInterface->callDBusAsync(QLatin1String("getFrameStats"), callback)->waitForFinished();
}
void CXSwiftBusServiceProxy::getFrameStatsAsync(double *o_averageFps, double *o_simTimeRatio)
void CXSwiftBusServiceProxy::getFrameStatsAsync(double *o_averageFps, double *o_simTimeRatio, double *o_trackMilesLost)
{
std::function<void(QDBusPendingCallWatcher *)> callback = [ = ](QDBusPendingCallWatcher * watcher)
{
QDBusPendingReply<double, double> reply = *watcher;
QDBusPendingReply<double, double, double> reply = *watcher;
if (!reply.isError())
{
*o_averageFps = reply.argumentAt<0>();
*o_simTimeRatio = reply.argumentAt<1>();
*o_trackMilesLost = reply.argumentAt<2>();
}
watcher->deleteLater();
};

View File

@@ -210,8 +210,8 @@ namespace BlackSimPlugin
//! \copydoc XSwiftBus::CService::getFrameStats
//! @{
void getFrameStats(double *o_averageFps, double *o_simTimeRatio) const;
void getFrameStatsAsync(double *o_averageFps, double *o_simTimeRatio);
void getFrameStats(double *o_averageFps, double *o_simTimeRatio, double *o_trackMilesLost) const;
void getFrameStatsAsync(double *o_averageFps, double *o_simTimeRatio, double *o_trackMilesLost);
//! @}
//! \copydoc XSwiftBus::CService::getLatitudeDeg