X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=backend.c;h=3df0133f3e56d1c2648580fccaf1b870847992f4;hb=refs%2Ftags%2Ffio-2.2.4;hp=7c6fc9b0478818d3443bf3c84554dfc090f24087;hpb=69fea81e69ef2bd6db8eedf15b3c63510a7dc192;p=fio.git diff --git a/backend.c b/backend.c index 7c6fc9b0..3df0133f 100644 --- a/backend.c +++ b/backend.c @@ -432,7 +432,7 @@ static int wait_for_completions(struct thread_data *td, struct timeval *time, if (full && !min_evts) min_evts = 1; - if (time && (should_check_rate(td, DDIR_READ) || + if (time && (__should_check_rate(td, DDIR_READ) || __should_check_rate(td, DDIR_WRITE) || __should_check_rate(td, DDIR_TRIM))) fio_gettime(time, NULL); @@ -2104,12 +2104,20 @@ static void *helper_thread_main(void *data) uint64_t sec = DISK_UTIL_MSEC / 1000; uint64_t nsec = (DISK_UTIL_MSEC % 1000) * 1000000; struct timespec ts; + +#if defined(CONFIG_CLOCK_MONOTONIC) + clock_gettime(CLOCK_MONOTONIC, &ts); + ts.tv_sec += sec; + ts.tv_nsec += nsec; +#else struct timeval tv; gettimeofday(&tv, NULL); ts.tv_sec = tv.tv_sec + sec; ts.tv_nsec = (tv.tv_usec * 1000) + nsec; - if (ts.tv_nsec > 1000000000ULL) { +#endif + + if (ts.tv_nsec >= 1000000000ULL) { ts.tv_nsec -= 1000000000ULL; ts.tv_sec++; }