[xswiftbus] display FPS in simulator data window

* added driver getAverageFPS function
* display in simulator component
This commit is contained in:
Klaus Basan
2020-01-03 00:08:42 +01:00
committed by Mat Sutcliffe
parent 548a12a502
commit 72c3abb1e7
5 changed files with 36 additions and 7 deletions

View File

@@ -259,6 +259,7 @@ namespace BlackCore
void ISimulator::reset()
{
this->clearAllRemoteAircraftData(); // reset
m_averageFps = -1.0;
}
bool ISimulator::isUpdateAllRemoteAircraft(qint64 currentTimestamp) const
@@ -316,7 +317,7 @@ namespace BlackCore
void ISimulator::injectWeatherGrid(const CWeatherGrid &weatherGrid)
{
Q_UNUSED(weatherGrid);
Q_UNUSED(weatherGrid)
}
void ISimulator::blinkHighlightedAircraft()
@@ -350,8 +351,8 @@ namespace BlackCore
bool ISimulator::requestElevation(const ICoordinateGeodetic &reference, const CCallsign &callsign)
{
Q_UNUSED(reference);
Q_UNUSED(callsign);
Q_UNUSED(reference)
Q_UNUSED(callsign)
return false;
}
@@ -361,7 +362,7 @@ namespace BlackCore
ISimulationEnvironmentProvider::rememberGroundElevation(callsign, plane); // in simulator
const int updated = CRemoteAircraftAware::updateAircraftGroundElevation(callsign, plane, CAircraftSituation::FromProvider);
Q_UNUSED(updated);
Q_UNUSED(updated)
emit this->receivedRequestedElevation(plane, callsign);
}
@@ -1032,7 +1033,7 @@ namespace BlackCore
bool ISimulator::disconnectFrom()
{
// supposed to be overridden
m_averageFps = -1.0;
return true;
}

View File

@@ -103,7 +103,7 @@ namespace BlackCore
virtual bool connectTo() = 0;
//! Disconnect from simulator
virtual bool disconnectFrom() = 0;
virtual bool disconnectFrom();
//! Logically add a new aircraft.
//! Depending on max. aircraft, enabled status etc. it will physically added to the simulator.
@@ -215,6 +215,9 @@ namespace BlackCore
//! Test mode?
bool isTestMode() const { return m_test; }
//! Average FPS (frames per second)
double getAverageFPS() const { return m_averageFps; }
//! Send situation/parts for testing
virtual bool testSendSituationAndParts(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftSituation &situation, const BlackMisc::Aviation::CAircraftParts &parts) = 0;
@@ -575,6 +578,7 @@ namespace BlackCore
int m_statsUpdateAircraftRuns = 0; //!< statistics update count
int m_statsUpdateAircraftLimited = 0; //!< skipped because of max.update limitations
double m_statsUpdateAircraftTimeAvgMs = 0; //!< statistics average update time
double m_averageFps = -1.0; //!< FPS
qint64 m_updateAllRemoteAircraftUntil = 0; //!< force an update of all remote aircraft, used when own aircraft is moved, paused to make sure all remote aircraft are updated
qint64 m_statsUpdateAircraftTimeTotalMs = 0; //!< statistics total update time
qint64 m_statsCurrentUpdateTimeMs = 0; //!< statistics current update time