From d09dcd34db7bdff65bb31d4055f5823898d9e629 Mon Sep 17 00:00:00 2001 From: Vincent Fu Date: Wed, 24 Jan 2024 17:38:18 +0000 Subject: [PATCH] logging: record timestamp for each thread Instead of recording a timestamp once before iterating through all the threads to check if we should add a new bw or iops log measurement, record a new timestamp before checking each thread. We were already querying the time anyway for the mtime_since_now() call. We might as well have it available locally for more accurate logging. Signed-off-by: Vincent Fu --- stat.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/stat.c b/stat.c index 11b58626..ab901ecd 100644 --- a/stat.c +++ b/stat.c @@ -3585,10 +3585,9 @@ int calc_log_samples(void) struct timespec now; long elapsed_time = 0; - fio_gettime(&now, NULL); - for_each_td(td) { - elapsed_time = mtime_since_now(&td->epoch); + fio_gettime(&now, NULL); + elapsed_time = mtime_since(&td->epoch, &now); if (!td->o.stats) continue; -- 2.25.1