From 293753bb57fe4498b3603832ad3527ea50367d04 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 4 Nov 2005 09:52:04 +0100 Subject: [PATCH] [PATCH] fio: correct stats for loops=x, where x > 1 --- fio.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/fio.c b/fio.c index 2c54dac..b357dfa 100644 --- a/fio.c +++ b/fio.c @@ -804,9 +804,6 @@ static void do_sync_io(struct thread_data *td) struct io_u *io_u = NULL; struct timeval e; - td->cur_off = 0; - td->last_kb = 0; - for (td->this_io_kb = 0; td->this_io_kb < td->kb;) { int ret; @@ -1071,9 +1068,6 @@ static void do_async_io(struct thread_data *td) struct timeval s, e; unsigned long usec; - td->cur_off = 0; - td->last_kb = 0; - for (td->this_io_kb = 0; td->this_io_kb < td->kb;) { struct timespec ts = { .tv_sec = 0, .tv_nsec = 0}; struct timespec *timeout; @@ -1455,12 +1449,16 @@ static void *thread_main(int shm_id, int offset, char *argv[]) gettimeofday(&td->start, NULL); - if (td->ratemin) - memcpy(&td->lastrate, &td->start, sizeof(td->start)); + while (td->loops--) { + gettimeofday(&td->stat_sample_time, NULL); + + if (td->ratemin) + memcpy(&td->lastrate, &td->stat_sample_time, sizeof(td->lastrate)); - memcpy(&td->stat_sample_time, &td->start, sizeof(td->start)); + td->cur_off = 0; + td->last_kb = 0; + td->stat_io_kb = 0; - while (td->loops--) { if (!td->use_aio) { do_sync_io(td); -- 2.25.1