mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
only update simRate once per second
This commit is contained in:
parent
551f0aaba3
commit
8435550fe9
2 changed files with 18 additions and 7 deletions
|
@ -2014,15 +2014,16 @@ void Application::idle() {
|
|||
|
||||
lastIdleStart = now;
|
||||
|
||||
static SimpleAverage<float> interIdleDurations;
|
||||
if (lastIdleEnd != 0) {
|
||||
_interIdleDurations.update(now - lastIdleEnd);
|
||||
interIdleDurations.update(now - lastIdleEnd);
|
||||
static uint64_t lastReportTime = now;
|
||||
if ((now - lastReportTime) >= (USECS_PER_SECOND)) {
|
||||
static QString LOGLINE("Average inter-idle time: %1 us for %2 samples");
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::LogExtraTimings)) {
|
||||
qCDebug(interfaceapp_timing) << LOGLINE.arg((int)_interIdleDurations.getAverage()).arg(_interIdleDurations.getCount());
|
||||
qCDebug(interfaceapp_timing) << LOGLINE.arg((int)interIdleDurations.getAverage()).arg(interIdleDurations.getCount());
|
||||
}
|
||||
_interIdleDurations.reset();
|
||||
interIdleDurations.reset();
|
||||
lastReportTime = now;
|
||||
}
|
||||
}
|
||||
|
@ -2109,6 +2110,16 @@ void Application::idle() {
|
|||
lastIdleEnd = usecTimestampNow();
|
||||
}
|
||||
|
||||
float Application::getAverageSimsPerSecond() {
|
||||
uint64_t now = usecTimestampNow();
|
||||
|
||||
if (now - _lastSimsPerSecondUpdate > USECS_PER_SECOND) {
|
||||
_simsPerSecondReport = _simsPerSecond.getAverage();
|
||||
_lastSimsPerSecondUpdate = now;
|
||||
}
|
||||
return _simsPerSecondReport;
|
||||
}
|
||||
|
||||
void Application::setLowVelocityFilter(bool lowVelocityFilter) {
|
||||
InputDevice::setLowVelocityFilter(lowVelocityFilter);
|
||||
}
|
||||
|
|
|
@ -352,8 +352,7 @@ public:
|
|||
|
||||
const QRect& getMirrorViewRect() const { return _mirrorViewRect; }
|
||||
|
||||
float getAverageInterIdleDuration() { return _interIdleDurations.getAverage(); }
|
||||
float getAverageSimsPerSecond() { return _simsPerSecond.getAverage(); }
|
||||
float getAverageSimsPerSecond();
|
||||
|
||||
signals:
|
||||
|
||||
|
@ -687,8 +686,9 @@ private:
|
|||
EntityItemID _keyboardFocusedItem;
|
||||
quint64 _lastAcceptedKeyPress = 0;
|
||||
|
||||
SimpleAverage<float> _interIdleDurations;
|
||||
SimpleMovingAverage _simsPerSecond;
|
||||
SimpleMovingAverage _simsPerSecond{10};
|
||||
int _simsPerSecondReport = 0;
|
||||
quint64 _lastSimsPerSecondUpdate = 0;
|
||||
};
|
||||
|
||||
#endif // hifi_Application_h
|
||||
|
|
Loading…
Reference in a new issue