summaryrefslogtreecommitdiff
path: root/bench/bench_window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'bench/bench_window.cpp')
-rw-r--r--bench/bench_window.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/bench/bench_window.cpp b/bench/bench_window.cpp
index 60d44f3..f1035e0 100644
--- a/bench/bench_window.cpp
+++ b/bench/bench_window.cpp
@@ -141,6 +141,8 @@ const lib94::warrior *bench_window::do_step() {
return result;
}
+static constexpr std::chrono::nanoseconds min_hyperspeed_ui_update_distance(1000000);
+
void bench_window::runner_main() {
std::chrono::system_clock::time_point last_step = std::chrono::system_clock::now();
@@ -154,10 +156,21 @@ void bench_window::runner_main() {
break;
core_mutex.unlock();
- runner_update_ui_dispatcher.emit();
- if (!runner_hyperspeed)
+
+ if (runner_hyperspeed) {
+ std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
+ if (now - last_hyperspeed_ui_update >= min_hyperspeed_ui_update_distance) {
+ last_hyperspeed_ui_update = now;
+ runner_update_ui_dispatcher.emit();
+ }
+ }
+
+ else {
+ runner_update_ui_dispatcher.emit();
std::this_thread::sleep_until(last_step + time_between_steps);
- last_step = std::chrono::system_clock::now();
+ last_step = std::chrono::system_clock::now();
+ }
+
core_mutex.lock();
}