From 89d28c8222d35c5f509bfdbe8c051dea0f5f45e1 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Mon, 26 Oct 2020 22:56:34 +0100 Subject: [PATCH] timeout: no volatile stackvars, better warnings --- repos/base/src/lib/timeout/timer_connection.cc | 2 +- repos/base/src/lib/timeout/timer_connection_time.cc | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/repos/base/src/lib/timeout/timer_connection.cc b/repos/base/src/lib/timeout/timer_connection.cc index ea56ccafb5..ef9196b3a5 100644 --- a/repos/base/src/lib/timeout/timer_connection.cc +++ b/repos/base/src/lib/timeout/timer_connection.cc @@ -53,7 +53,7 @@ uint64_t Timer::Connection::_ts_to_us_ratio(Timestamp ts, */ static unsigned nr_of_warnings { 0 }; if (nr_of_warnings++ % 1000 == 0) { - warning("timestamp value too big"); + warning("timestamp value too big, ts=", ts, " max_ts=", max_ts); } while (ts > max_ts) { ts >>= 1; diff --git a/repos/base/src/lib/timeout/timer_connection_time.cc b/repos/base/src/lib/timeout/timer_connection_time.cc index 36de5f9440..0997c19ed2 100644 --- a/repos/base/src/lib/timeout/timer_connection_time.cc +++ b/repos/base/src/lib/timeout/timer_connection_time.cc @@ -41,8 +41,8 @@ void Timer::Connection::_update_real_time() remote_time_trials < MAX_REMOTE_TIME_TRIALS; ) { /* read out the two time values close in succession */ - Timestamp volatile new_ts = _timestamp(); - uint64_t volatile new_us = elapsed_us(); + Timestamp const new_ts = _timestamp(); + uint64_t const new_us = elapsed_us(); /* do not proceed until the time difference is at least 1 us */ if (new_us == _us || new_ts == _ts) { continue; } @@ -99,7 +99,10 @@ void Timer::Connection::_update_real_time() /* if possible, lower the shift to meet the limitation */ if (!factor_shift) { - error("timestamp difference too big"); + + error("timestamp difference too big, ts_diff=", ts_diff, + " max_ts_diff=", max_ts_diff); + throw Factor_update_failed(); } factor_shift--;