mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 01:17:14 +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;
|
lastIdleStart = now;
|
||||||
|
|
||||||
|
static SimpleAverage<float> interIdleDurations;
|
||||||
if (lastIdleEnd != 0) {
|
if (lastIdleEnd != 0) {
|
||||||
_interIdleDurations.update(now - lastIdleEnd);
|
interIdleDurations.update(now - lastIdleEnd);
|
||||||
static uint64_t lastReportTime = now;
|
static uint64_t lastReportTime = now;
|
||||||
if ((now - lastReportTime) >= (USECS_PER_SECOND)) {
|
if ((now - lastReportTime) >= (USECS_PER_SECOND)) {
|
||||||
static QString LOGLINE("Average inter-idle time: %1 us for %2 samples");
|
static QString LOGLINE("Average inter-idle time: %1 us for %2 samples");
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::LogExtraTimings)) {
|
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;
|
lastReportTime = now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2109,6 +2110,16 @@ void Application::idle() {
|
||||||
lastIdleEnd = usecTimestampNow();
|
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) {
|
void Application::setLowVelocityFilter(bool lowVelocityFilter) {
|
||||||
InputDevice::setLowVelocityFilter(lowVelocityFilter);
|
InputDevice::setLowVelocityFilter(lowVelocityFilter);
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,8 +352,7 @@ public:
|
||||||
|
|
||||||
const QRect& getMirrorViewRect() const { return _mirrorViewRect; }
|
const QRect& getMirrorViewRect() const { return _mirrorViewRect; }
|
||||||
|
|
||||||
float getAverageInterIdleDuration() { return _interIdleDurations.getAverage(); }
|
float getAverageSimsPerSecond();
|
||||||
float getAverageSimsPerSecond() { return _simsPerSecond.getAverage(); }
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
@ -687,8 +686,9 @@ private:
|
||||||
EntityItemID _keyboardFocusedItem;
|
EntityItemID _keyboardFocusedItem;
|
||||||
quint64 _lastAcceptedKeyPress = 0;
|
quint64 _lastAcceptedKeyPress = 0;
|
||||||
|
|
||||||
SimpleAverage<float> _interIdleDurations;
|
SimpleMovingAverage _simsPerSecond{10};
|
||||||
SimpleMovingAverage _simsPerSecond;
|
int _simsPerSecondReport = 0;
|
||||||
|
quint64 _lastSimsPerSecondUpdate = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_Application_h
|
#endif // hifi_Application_h
|
||||||
|
|
Loading…
Reference in a new issue