summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlex Bennée2019-05-29 18:16:32 +0200
committerAlex Bennée2019-06-12 18:53:22 +0200
commit50290c002c045280f8defad911901e16bfb52884 (patch)
treec432853313b60bfe43c5fe6db27756d847ccd1bf /tests
parenteditorconfig: add setting for shell scripts (diff)
downloadqemu-50290c002c045280f8defad911901e16bfb52884.tar.gz
qemu-50290c002c045280f8defad911901e16bfb52884.tar.xz
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 'tests')
0 files changed, 0 insertions, 0 deletions