summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-02-01 14:53:38 +0100
committerMaria Matejka <mq@ucw.cz>2022-02-03 10:30:33 +0100
commitc019008383a439b5e5cf46dc71f902f335a0a9df (patch)
tree49c55163ab4f45dd731e7066231004e880e901ef
parentaca4c3fc8e4a6043cafcb8778055d9a505283376 (diff)
IO loop duration fixup
-rw-r--r--lib/timer.h1
-rw-r--r--sysdep/unix/io-loop.c4
-rw-r--r--sysdep/unix/io.c3
3 files changed, 4 insertions, 4 deletions
diff --git a/lib/timer.h b/lib/timer.h
index 04544ace..161e39d3 100644
--- a/lib/timer.h
+++ b/lib/timer.h
@@ -55,6 +55,7 @@ static inline timer *timers_first(struct timeloop *loop)
#define current_time() atomic_load_explicit(&last_time, memory_order_acquire)
#define current_real_time() atomic_load_explicit(&real_time, memory_order_acquire)
+#define current_time_update() ({ times_update(); current_time(); })
//#define now (current_time() TO_S)
//#define now_real (current_real_time() TO_S)
diff --git a/sysdep/unix/io-loop.c b/sysdep/unix/io-loop.c
index 5ab93b31..9b107a1a 100644
--- a/sysdep/unix/io-loop.c
+++ b/sysdep/unix/io-loop.c
@@ -558,7 +558,7 @@ birdloop_main(void *arg)
if (loop->poll_changed)
sockets_prepare(loop);
- btime duration = current_time() - loop_begin;
+ btime duration = current_time_update() - loop_begin;
if (duration > config->watchdog_warning)
log(L_WARN "I/O loop cycle took %d ms", (int) (duration TO_MS));
@@ -578,7 +578,7 @@ birdloop_main(void *arg)
if (loop->stopped && !loop->links)
break;
- loop_begin = current_time();
+ loop_begin = current_time_update();
if (rv)
sockets_fire(loop);
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index fa836f28..e3e388af 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -2100,8 +2100,7 @@ static btime loop_time;
static void
io_update_time(void)
{
- times_update();
- last_io_time = current_time();
+ last_io_time = current_time_update();
if (event_open)
{