logging: record timestamp for each thread
authorVincent Fu <vincent.fu@samsung.com>
Wed, 24 Jan 2024 17:38:18 +0000 (17:38 +0000)
committerVincent Fu <vincent.fu@samsung.com>
Tue, 13 Feb 2024 16:44:43 +0000 (11:44 -0500)
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 <vincent.fu@samsung.com>
stat.c

diff --git a/stat.c b/stat.c
index 11b586268b188f25eec77317e2983568699cb91f..ab901ecd718ac2bb5c904a905afc43b0587fd7bb 100644 (file)
--- 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;