[PATCH] rusage stat
authorJens Axboe <jens.axboe@oracle.com>
Fri, 24 Nov 2006 12:29:20 +0000 (13:29 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 24 Nov 2006 12:29:20 +0000 (13:29 +0100)
Sum up total over all loops, not for each one.

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

diff --git a/fio.c b/fio.c
index 28864bdf72ebf8c6f5d610e5e068c0d0cab5d506..a4efe385bbb11364638d0b3567842189186e1af3 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -663,10 +663,10 @@ static void *thread_main(void *data)
                system(td->exec_prerun);
 
        fio_gettime(&td->epoch, NULL);
                system(td->exec_prerun);
 
        fio_gettime(&td->epoch, NULL);
+       getrusage(RUSAGE_SELF, &td->ru_start);
 
        runtime[0] = runtime[1] = 0;
        while (td->loops--) {
 
        runtime[0] = runtime[1] = 0;
        while (td->loops--) {
-               getrusage(RUSAGE_SELF, &td->ru_start);
                fio_gettime(&td->start, NULL);
                memcpy(&td->stat_sample_time, &td->start, sizeof(td->start));
 
                fio_gettime(&td->start, NULL);
                memcpy(&td->stat_sample_time, &td->start, sizeof(td->start));
 
@@ -685,8 +685,6 @@ static void *thread_main(void *data)
                if (td_rw(td) && td->io_bytes[td->ddir ^ 1])
                        runtime[td->ddir ^ 1] = runtime[td->ddir];
 
                if (td_rw(td) && td->io_bytes[td->ddir ^ 1])
                        runtime[td->ddir ^ 1] = runtime[td->ddir];
 
-               update_rusage_stat(td);
-
                if (td->error || td->terminate)
                        break;
 
                if (td->error || td->terminate)
                        break;
 
@@ -704,6 +702,7 @@ static void *thread_main(void *data)
                        break;
        }
 
                        break;
        }
 
+       update_rusage_stat(td);
        fio_gettime(&td->end_time, NULL);
        td->runtime[0] = runtime[0] / 1000;
        td->runtime[1] = runtime[1] / 1000;
        fio_gettime(&td->end_time, NULL);
        td->runtime[0] = runtime[0] / 1000;
        td->runtime[1] = runtime[1] / 1000;