Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all
Unified · Split
| @@ -270,10 +270,10 @@ public: · 269 unmodified lines | |||
| 270 | void run() override { | 270 | void run() override { |
| 271 | while (!_quit) { | 271 | while (!_quit) { |
| 272 | QThread::sleep(HEARTBEAT_UPDATE_INTERVAL_SECS); | 272 | QThread::sleep(HEARTBEAT_UPDATE_INTERVAL_SECS); |
| 273 | auto now = usecTimestampNow(); | ||
| 274 | 273 | ||
| 275 | // in the unlikely event that now is less than _heartbeat, don't rollover and confuse ourselves | 274 | uint64_t lastHeartbeat = _heartbeat; // sample atomic _heartbeat, because we could context switch away and have it updated on us |
| 276 | auto lastHeartbeatAge = (now > _heartbeat) ? now - _heartbeat : 0; | 275 | uint64_t now = usecTimestampNow(); |
| 276 | auto lastHeartbeatAge = (now > lastHeartbeat) ? now - lastHeartbeat : 0; | ||
| 277 | auto sinceLastReport = (now > _lastReport) ? now - _lastReport : 0; | 277 | auto sinceLastReport = (now > _lastReport) ? now - _lastReport : 0; |
| 278 | auto elapsedMovingAverage = _movingAverage.getAverage(); | 278 | auto elapsedMovingAverage = _movingAverage.getAverage(); |
| 279 | 279 | ||
| @@ -310,7 +310,7 @@ public: · 30 unmodified lines | |||
| 310 | if (lastHeartbeatAge > MAX_HEARTBEAT_AGE_USECS) { | 310 | if (lastHeartbeatAge > MAX_HEARTBEAT_AGE_USECS) { |
| 311 | qDebug() << "DEADLOCK DETECTED -- " | 311 | qDebug() << "DEADLOCK DETECTED -- " |
| 312 | << "lastHeartbeatAge:" << lastHeartbeatAge | 312 | << "lastHeartbeatAge:" << lastHeartbeatAge |
| 313 | << "[ _heartbeat:" << _heartbeat | 313 | << "[ lastHeartbeat :" << lastHeartbeat |
| 314 | << "now:" << now << " ]" | 314 | << "now:" << now << " ]" |
| 315 | << "elapsedMovingAverage:" << elapsedMovingAverage | 315 | << "elapsedMovingAverage:" << elapsedMovingAverage |
| 316 | << "maxElapsed:" << _maxElapsed | 316 | << "maxElapsed:" << _maxElapsed |