From 48f8bc13685230b45dbcded7659bd8dbc6018791 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 22 Nov 2018 18:57:37 +0100 Subject: [PATCH] MINOR: poller: move the call of tv_update_date() back to the pollers The reason behind this will be to be able to compute a timeout when busy polling. --- include/common/time.h | 1 - src/ev_epoll.c | 1 + src/ev_kqueue.c | 1 + src/ev_poll.c | 1 + src/ev_select.c | 1 + 5 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/common/time.h b/include/common/time.h index b9efd714b..c3f8f5c9e 100644 --- a/include/common/time.h +++ b/include/common/time.h @@ -586,7 +586,6 @@ static inline void tv_entering_poll() */ static inline void tv_leaving_poll(int timeout, int interrupted) { - tv_update_date(timeout, interrupted); measure_idle(); prev_cpu_time = now_cpu_time(); prev_mono_time = now_mono_time(); diff --git a/src/ev_epoll.c b/src/ev_epoll.c index a9f96ab80..272ded2b4 100644 --- a/src/ev_epoll.c +++ b/src/ev_epoll.c @@ -150,6 +150,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp) tv_entering_poll(); activity_count_runtime(); status = epoll_wait(epoll_fd[tid], epoll_events, global.tune.maxpollevents, wait_time); + tv_update_date(wait_time, status); tv_leaving_poll(wait_time, status); thread_harmless_end(); diff --git a/src/ev_kqueue.c b/src/ev_kqueue.c index dc1310cff..a894f6687 100644 --- a/src/ev_kqueue.c +++ b/src/ev_kqueue.c @@ -143,6 +143,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp) kev, // struct kevent *eventlist fd, // int nevents &timeout); // const struct timespec *timeout + tv_update_date(delta_ms, status); tv_leaving_poll(delta_ms, status); thread_harmless_end(); diff --git a/src/ev_poll.c b/src/ev_poll.c index ce5e38f96..40bde873b 100644 --- a/src/ev_poll.c +++ b/src/ev_poll.c @@ -198,6 +198,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp) tv_entering_poll(); activity_count_runtime(); status = poll(poll_events, nbfd, wait_time); + tv_update_date(wait_time, status); tv_leaving_poll(wait_time, status); thread_harmless_end(); diff --git a/src/ev_select.c b/src/ev_select.c index f435813aa..f9b121589 100644 --- a/src/ev_select.c +++ b/src/ev_select.c @@ -172,6 +172,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp) writenotnull ? tmp_evts[DIR_WR] : NULL, NULL, &delta); + tv_update_date(delta_ms, status); tv_leaving_poll(delta_ms, status); thread_harmless_end(); -- 2.47.3