summary refs log tree commit diff stats
path: root/scripts/archive-source.sh
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2019-05-29 17:16:32 +0100
committerAlex Bennée <alex.bennee@linaro.org>2019-06-12 17:53:22 +0100
commit50290c002c045280f8defad911901e16bfb52884 (patch)
treec432853313b60bfe43c5fe6db27756d847ccd1bf /scripts/archive-source.sh
parent9b109f566adff4d394806b046b395363e523bd80 (diff)
downloadfocaccia-qemu-50290c002c045280f8defad911901e16bfb52884.tar.gz
focaccia-qemu-50290c002c045280f8defad911901e16bfb52884.zip
qemu-io-cmds: use clock_gettime for benchmarking
The previous use of gettimeofday() ran into undefined behaviour when
we ended up doing a div 0 for a very short operation. This is because
gettimeofday only works at the microsecond level as well as being
prone to discontinuous jumps in system time. Using clock_gettime with
CLOCK_MONOTONIC gives greater precision and alleviates some of the
potential problems with time jumping around.

We could use CLOCK_MONOTONIC_RAW to avoid being tripped up by NTP and
adjtime but that is Linux specific so I decided it would do for now.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Diffstat (limited to 'scripts/archive-source.sh')
0 files changed, 0 insertions, 0 deletions