Ref T270, further tracing stats (max, current ....)

This commit is contained in:
Klaus Basan
2018-06-05 18:53:59 +02:00
parent 46a3f925a9
commit a01d18dfa8
4 changed files with 144 additions and 96 deletions

View File

@@ -585,9 +585,11 @@ namespace BlackCore
m_statsUpdateAircraftRuns = 0;
m_statsUpdateAircraftTimeAvgMs = 0;
m_statsUpdateAircraftTimeTotalMs = 0;
m_statsMaxUpdateTimeMs = 0;
m_statsCurrentUpdateTimeMs = 0;
m_statsPhysicallyAddedAircraft = 0;
m_statsPhysicallyRemovedAircraft = 0;
m_statsLastUpdateAircraftRequested = 0;
m_statsLastUpdateAircraftRequestedMs = 0;
m_statsUpdateAircraftRequestedDeltaMs = 0;
}
@@ -642,12 +644,14 @@ namespace BlackCore
{
const qint64 now = QDateTime::currentMSecsSinceEpoch();
const qint64 dt = now - startTime;
m_statsCurrentUpdateTimeMs = dt;
m_statsUpdateAircraftTimeTotalMs += dt;
m_statsUpdateAircraftRuns++;
m_statsUpdateAircraftTimeAvgMs = static_cast<double>(m_statsUpdateAircraftTimeTotalMs) / static_cast<double>(m_statsUpdateAircraftRuns);
m_updateRemoteAircraftInProgress = false;
if (m_statsLastUpdateAircraftRequested > 0) { m_statsUpdateAircraftRequestedDeltaMs = startTime - m_statsLastUpdateAircraftRequested; }
m_statsLastUpdateAircraftRequested = startTime;
if (m_statsMaxUpdateTimeMs < dt) { m_statsMaxUpdateTimeMs = dt; }
if (m_statsLastUpdateAircraftRequestedMs > 0) { m_statsUpdateAircraftRequestedDeltaMs = startTime - m_statsLastUpdateAircraftRequestedMs; }
m_statsLastUpdateAircraftRequestedMs = startTime;
}
bool CSimulatorCommon::isEqualLastSent(const CAircraftSituation &compare) const

View File

@@ -125,12 +125,21 @@ namespace BlackCore
//! Counter removed aircraft
int getStatisticsPhysicallyRemovedAircraft() const { return m_statsPhysicallyRemovedAircraft; }
//! Current update time in ms
double getStatisticsCurrentUpdateTimeMs() const { return m_statsCurrentUpdateTimeMs; }
//! Average update time in ms
double getStatisticsAverageUpdateTimeMs() const { return m_statsUpdateAircraftTimeAvgMs; }
//! Total update time in ms
qint64 getStatisticsTotalUpdateTimeMs() const { return m_statsUpdateAircraftTimeTotalMs; }
//! Max.update time in ms
qint64 getStatisticsMaxUpdateTimeMs() const { return m_statsMaxUpdateTimeMs; }
//! Number of update runs
int getStatisticsUpdateRuns() const { return m_statsUpdateAircraftRuns; }
//! Time between two update requests
qint64 getStatisticsAircraftUpdatedRequestedDeltaMs() const { return m_statsUpdateAircraftRequestedDeltaMs; }
@@ -252,15 +261,17 @@ namespace BlackCore
//! Lookup against DB data
static BlackMisc::Simulation::CAircraftModel reverseLookupModel(const BlackMisc::Simulation::CAircraftModel &model);
bool m_pausedSimFreezesInterpolation = false; //!< paused simulator will also pause interpolation (so AI aircraft will hold)
bool m_autoCalcAirportDistance = true; //!< automatically calculate airport distance and bearing
bool m_updateRemoteAircraftInProgress = false; //!< currently updating remote aircraft
int m_timerId = -1; //!< dispatch timer id
int m_statsUpdateAircraftRuns = 0; //!< statistics update count
double m_statsUpdateAircraftTimeAvgMs = 0; //!< statistics average update time
qint64 m_statsUpdateAircraftTimeTotalMs = 0; //!< statistics total update time
qint64 m_statsLastUpdateAircraftRequested = 0; //!< when was the last aircraft update requested
qint64 m_statsUpdateAircraftRequestedDeltaMs = 0; //!< delta time between 2 aircrat updates
bool m_pausedSimFreezesInterpolation = false; //!< paused simulator will also pause interpolation (so AI aircraft will hold)
bool m_autoCalcAirportDistance = true; //!< automatically calculate airport distance and bearing
bool m_updateRemoteAircraftInProgress = false; //!< currently updating remote aircraft
int m_timerId = -1; //!< dispatch timer id
int m_statsUpdateAircraftRuns = 0; //!< statistics update count
double m_statsUpdateAircraftTimeAvgMs = 0; //!< statistics average update time
qint64 m_statsUpdateAircraftTimeTotalMs = 0; //!< statistics total update time
qint64 m_statsCurrentUpdateTimeMs = 0; //!< statistics current update time
qint64 m_statsMaxUpdateTimeMs = 0; //!< statistics max.update time
qint64 m_statsLastUpdateAircraftRequestedMs = 0; //!< when was the last aircraft update requested
qint64 m_statsUpdateAircraftRequestedDeltaMs = 0; //!< delta time between 2 aircrat updates
BlackMisc::Simulation::CSimulatorInternals m_simulatorInternals; //!< setup object
BlackMisc::Simulation::CInterpolationLogger m_interpolationLogger; //!< log.interpolation

View File

@@ -112,9 +112,16 @@ namespace BlackGui
ui->le_Parts->setText(boolToYesNo(m_airspaceMonitor->isRemoteAircraftSupportingParts(m_callsign)));
static const QString msTimeStr("%1ms");
static const QString updateTimes("%1ms avg: %2ms max: %3ms");
const QString avgUpdateTimeRounded = QString::number(m_simulatorCommon->getStatisticsAverageUpdateTimeMs(), 'f', 2);
ui->le_AvgUpdateTimeMs->setText(msTimeStr.arg(avgUpdateTimeRounded));
ui->le_UpdateAircraftReqTimeMs->setText(msTimeStr.arg(m_simulatorCommon->getStatisticsAircraftUpdatedRequestedDeltaMs()));
ui->le_UpdateTimes->setText(updateTimes.
arg(m_simulatorCommon->getStatisticsCurrentUpdateTimeMs()).
arg(avgUpdateTimeRounded).
arg(m_simulatorCommon->getStatisticsMaxUpdateTimeMs()));
ui->le_UpdateTimes->home(false);
ui->le_UpdateCount->setText(QString::number(m_simulatorCommon->getStatisticsUpdateRuns()));
ui->le_UpdateReqTime->setText(msTimeStr.arg(m_simulatorCommon->getStatisticsAircraftUpdatedRequestedDeltaMs()));
const CClient client = m_airspaceMonitor->getClientOrDefaultForCallsign(m_callsign);
ui->le_GndFlag->setText(boolToYesNo(client.hasGndFlagCapability()));
@@ -293,8 +300,8 @@ namespace BlackGui
ui->le_ElevationRec->clear();
ui->le_ElevationReq->clear();
ui->le_Parts->clear();
ui->le_AvgUpdateTimeMs->clear();
ui->le_UpdateAircraftReqTimeMs->clear();
ui->le_UpdateTimes->clear();
ui->le_UpdateTimes->clear();
m_elvReceived = m_elvRequested = 0;
}

View File

@@ -212,7 +212,7 @@
<property name="title">
<string>Misc.</string>
</property>
<layout class="QGridLayout" name="gl_Misc">
<layout class="QGridLayout" name="gl_Misc" columnstretch="0,1,0,1,0,1,0,1,0,3,0">
<property name="leftMargin">
<number>3</number>
</property>
@@ -226,22 +226,32 @@
<number>3</number>
</property>
<item row="0" column="7">
<widget class="QLineEdit" name="le_UpdateAircraftReqTimeMs">
<widget class="QLineEdit" name="le_UpdateReqTime">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>time</string>
<string>req.time ms</string>
</property>
</widget>
</item>
<item row="0" column="6">
<item row="0" column="9">
<widget class="QLineEdit" name="le_UpdateTimes">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>time min, max, ..</string>
</property>
</widget>
</item>
<item row="0" column="8">
<widget class="QLabel" name="lbl_UpdateAircraftReqTime">
<property name="toolTip">
<string>update aircraft req.time</string>
</property>
<property name="text">
<string>Update req.</string>
<string>Updates:</string>
</property>
</widget>
</item>
@@ -258,6 +268,30 @@
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QLineEdit" name="le_GndFlag">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>gnd.flag?</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="lbl_GndFlag">
<property name="text">
<string>Gnd.flag:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lbl_CG">
<property name="text">
<string>CG:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="lbl_Parts">
<property name="text">
@@ -275,27 +309,20 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lbl_CG">
<item row="0" column="10">
<widget class="QLabel" name="lbl_AverageUpdateTime">
<property name="text">
<string>CG:</string>
<string/>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QLineEdit" name="le_GndFlag">
<item row="0" column="1">
<widget class="QLineEdit" name="le_CG">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>gnd.flag?</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="lbl_GndFlag">
<property name="text">
<string>Gnd.flag:</string>
<string>CG</string>
</property>
</widget>
</item>
@@ -319,57 +346,6 @@
</property>
</widget>
</item>
<item row="0" column="9">
<widget class="QLineEdit" name="le_AvgUpdateTimeMs">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>time</string>
</property>
</widget>
</item>
<item row="0" column="8">
<widget class="QLabel" name="lbl_AverageUpdateTime">
<property name="text">
<string>Avg.upd.time:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="le_CG">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>CG</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="lbl_ElevationReceived">
<property name="text">
<string>Rec.:</string>
</property>
</widget>
</item>
<item row="1" column="7" colspan="3">
<widget class="QLineEdit" name="le_Elevation">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>elevation</string>
</property>
</widget>
</item>
<item row="1" column="6">
<widget class="QLabel" name="lbl_Elevation">
<property name="text">
<string>Elevation:</string>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QLineEdit" name="le_SceneryOffset">
<property name="readOnly">
@@ -381,12 +357,60 @@
</widget>
</item>
<item row="1" column="4">
<widget class="QLabel" name="label">
<widget class="QLabel" name="lbl_Offset">
<property name="text">
<string>Offset:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="lbl_ElevationReceived">
<property name="text">
<string>Rec.:</string>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QLabel" name="lbl_ReqTime">
<property name="text">
<string>Req.time:</string>
</property>
</widget>
</item>
<item row="1" column="9">
<widget class="QLineEdit" name="le_Elevation">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>elevation</string>
</property>
</widget>
</item>
<item row="1" column="8">
<widget class="QLabel" name="lbl_Elevation">
<property name="text">
<string>Elevation:</string>
</property>
</widget>
</item>
<item row="1" column="6">
<widget class="QLabel" name="lbl_UpdateNumber">
<property name="text">
<string>Upd.#:</string>
</property>
</widget>
</item>
<item row="1" column="7">
<widget class="QLineEdit" name="le_UpdateCount">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>count</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -555,28 +579,30 @@
</customwidget>
</customwidgets>
<tabstops>
<tabstop>comp_CallsignCompleter</tabstop>
<tabstop>le_UpdateTime</tabstop>
<tabstop>hs_UpdateTime</tabstop>
<tabstop>pb_ResetStats</tabstop>
<tabstop>pb_ShowInSimulator</tabstop>
<tabstop>pb_StartStop</tabstop>
<tabstop>tw_LogTabs</tabstop>
<tabstop>le_CG</tabstop>
<tabstop>le_Parts</tabstop>
<tabstop>le_GndFlag</tabstop>
<tabstop>le_UpdateAircraftReqTimeMs</tabstop>
<tabstop>le_AvgUpdateTimeMs</tabstop>
<tabstop>le_UpdateReqTime</tabstop>
<tabstop>le_UpdateTimes</tabstop>
<tabstop>le_ElevationReq</tabstop>
<tabstop>le_ElevationRec</tabstop>
<tabstop>le_SceneryOffset</tabstop>
<tabstop>le_UpdateCount</tabstop>
<tabstop>le_Elevation</tabstop>
<tabstop>tvp_AircraftSituations</tabstop>
<tabstop>tvp_AircraftParts</tabstop>
<tabstop>te_LastInterpolatedSituation</tabstop>
<tabstop>te_SituationChange</tabstop>
<tabstop>te_LastInterpolatedParts</tabstop>
<tabstop>te_TextLog</tabstop>
<tabstop>hs_UpdateTime</tabstop>
<tabstop>comp_CallsignCompleter</tabstop>
<tabstop>te_LastInterpolatedParts</tabstop>
<tabstop>te_SituationChange</tabstop>
<tabstop>pb_GetLastInterpolation</tabstop>
<tabstop>le_UpdateTime</tabstop>
<tabstop>pb_ResetStats</tabstop>
<tabstop>pb_StartStop</tabstop>
<tabstop>tvp_AircraftParts</tabstop>
</tabstops>
<resources/>
<connections/>