Fix problem with bw log not working for writes
authorJens Axboe <jens.axboe@oracle.com>
Fri, 31 Jul 2009 09:20:52 +0000 (11:20 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 31 Jul 2009 09:20:52 +0000 (11:20 +0200)
We inadvertently only updated the read stat sample time cache,
so writes never logged any activity since negativ time spent is
rounded to zero.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fio.c

diff --git a/fio.c b/fio.c
index ba9e384b6609950a8c500dab96de39d0c8bce904..7ad1b57219cb646926cbc65a49cf22143b721e4b 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -1105,7 +1105,10 @@ static void *thread_main(void *data)
        clear_state = 0;
        while (keep_running(td)) {
                fio_gettime(&td->start, NULL);
        clear_state = 0;
        while (keep_running(td)) {
                fio_gettime(&td->start, NULL);
-               memcpy(&td->ts.stat_sample_time, &td->start, sizeof(td->start));
+               memcpy(&td->ts.stat_sample_time[0], &td->start,
+                               sizeof(td->start));
+               memcpy(&td->ts.stat_sample_time[1], &td->start,
+                               sizeof(td->start));
                memcpy(&td->tv_cache, &td->start, sizeof(td->start));
 
                if (td->o.ratemin[0] || td->o.ratemin[1])
                memcpy(&td->tv_cache, &td->start, sizeof(td->start));
 
                if (td->o.ratemin[0] || td->o.ratemin[1])