helper_thread: Increase timer accuracy
authorBart Van Assche <bvanassche@acm.org>
Sat, 12 Sep 2020 14:58:00 +0000 (07:58 -0700)
committerBart Van Assche <bvanassche@acm.org>
Sat, 26 Sep 2020 02:43:43 +0000 (19:43 -0700)
commit696378af1212312425975d739acb54277616f8c9
tree8faaee4941af77cda58903758c75ec18bf69ab72
parentdf9bd7d452dfdcebfc1bdf317c74c3af09cc9719
helper_thread: Increase timer accuracy

The helper_thread uses select() to wait for the next event. select() rounds
up its timeout argument to 1 / HZ. Increase timer accuracy by using a
high-res timer if possible. This patch has been tested by running the
following fio command and by verifying that the next_log and
msec_to_next_event were always above 100 ms:

./fio --debug=helperthread --bandwidth-log --write_bw_log=log --log_avg_msec=1000 --ioengine=null --name=null --size=1G --rw=randwrite --loops=999999 --runtime=60

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
configure
helper_thread.c