All of lore.kernel.org
 help / color / mirror / Atom feed
* FIO  log averaging issue with --write_bw_log and --write_iops_log using > 1000 log_avg_msec values
@ 2017-02-23 20:55 Chris Taylor
  2017-02-24  1:24 ` Sitsofe Wheeler
  0 siblings, 1 reply; 9+ messages in thread
From: Chris Taylor @ 2017-02-23 20:55 UTC (permalink / raw)
  To: fio

There is an issue in FIO when using the detailed bandwidth and iops logging with averaging over a period of time > 1 second.
It seems that usecs overflows which later causes negative time diff values resulting in skewed toward 0 results.
I have attached a potential fix that should prevent usecs from going beyond 1000000.

diff --git a/time.c b/time.c
index f5dc049..c748bee 100644
--- a/time.c
+++ b/time.c
@@ -8,11 +8,18 @@ static unsigned long ns_granularity;

void timeval_add_msec(struct timeval *tv, unsigned int msec)
{
-       tv->tv_usec += 1000 * msec;
-       if (tv->tv_usec >= 1000000) {
-               tv->tv_usec -= 1000000;
-               tv->tv_sec++;
-       }
+       int adj_usec = 1000 * msec;
+       int adj_sec = 0;
+       tv->tv_usec +=  adj_usec;
+       if (adj_usec >= 1000000) {
+               adj_sec = adj_usec / 1000000;
+               tv->tv_usec -=  adj_sec * 1000000;
+               tv->tv_sec += adj_sec;
+    }
+    if (tv->tv_usec >= 1000000){
+            tv->tv_usec -= 1000000;
+            tv->tv_sec++;
+    }
}

/*


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-04-02 21:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-23 20:55 FIO log averaging issue with --write_bw_log and --write_iops_log using > 1000 log_avg_msec values Chris Taylor
2017-02-24  1:24 ` Sitsofe Wheeler
2017-02-28  0:47   ` Chris Taylor
2017-02-28 18:49     ` Sitsofe Wheeler
2017-03-02 21:52       ` Chris Taylor
2017-03-31  6:34         ` Sitsofe Wheeler
2017-04-01  1:32           ` Chris Taylor
2017-04-02  8:07             ` Sitsofe Wheeler
2017-04-02 21:56               ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.