Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all
Unified · Split
| @@ -2014,15 +2014,16 @@ void Application::idle() { · 2013 unmodified lines | ||
| 2014 | 2014 | |
| 2015 | 2015 | lastIdleStart = now; |
| 2016 | 2016 | |
| 2017 | + static SimpleAverage<float> interIdleDurations; | |
| 2017 | 2018 | if (lastIdleEnd != 0) { |
| 2018 | − _interIdleDurations.update(now - lastIdleEnd); | |
| 2019 | + interIdleDurations.update(now - lastIdleEnd); | |
| 2019 | 2020 | static uint64_t lastReportTime = now; |
| 2020 | 2021 | if ((now - lastReportTime) >= (USECS_PER_SECOND)) { |
| 2021 | 2022 | static QString LOGLINE("Average inter-idle time: %1 us for %2 samples"); |
| 2022 | 2023 | if (Menu::getInstance()->isOptionChecked(MenuOption::LogExtraTimings)) { |
| 2023 | − qCDebug(interfaceapp_timing) << LOGLINE.arg((int)_interIdleDurations.getAverage()).arg(_interIdleDurations.getCount()); | |
| 2024 | + qCDebug(interfaceapp_timing) << LOGLINE.arg((int)interIdleDurations.getAverage()).arg(interIdleDurations.getCount()); | |
| 2024 | 2025 | } |
| 2025 | − _interIdleDurations.reset(); | |
| 2026 | + interIdleDurations.reset(); | |
| 2026 | 2027 | lastReportTime = now; |
| 2027 | 2028 | } |
| 2028 | 2029 | } |
| @@ -2109,6 +2110,16 @@ void Application::idle() { · 80 unmodified lines | ||
| 2109 | 2110 | lastIdleEnd = usecTimestampNow(); |
| 2110 | 2111 | } |
| 2111 | 2112 | |
| 2113 | +float Application::getAverageSimsPerSecond() { | |
| 2114 | + uint64_t now = usecTimestampNow(); | |
| 2115 | + | |
| 2116 | + if (now - _lastSimsPerSecondUpdate > USECS_PER_SECOND) { | |
| 2117 | + _simsPerSecondReport = _simsPerSecond.getAverage(); | |
| 2118 | + _lastSimsPerSecondUpdate = now; | |
| 2119 | + } | |
| 2120 | + return _simsPerSecondReport; | |
| 2121 | +} | |
| 2122 | + | |
| 2112 | 2123 | void Application::setLowVelocityFilter(bool lowVelocityFilter) { |
| 2113 | 2124 | InputDevice::setLowVelocityFilter(lowVelocityFilter); |
| 2114 | 2125 | } |