summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-05-24 10:32:47 +0200
committerJens Axboe <jens.axboe@oracle.com>2007-05-24 10:32:47 +0200
commit492158cf6a2e81886c43a6e696b17d7160ec5540 (patch)
treea1d798203fbd68b9cd195d8ef5b736666fe4fe1e
parent281f9b6363ff7ca9fdcc93c600faa8c907ba3010 (diff)
downloadfio-492158cf6a2e81886c43a6e696b17d7160ec5540.tar.gz
fio-492158cf6a2e81886c43a6e696b17d7160ec5540.tar.bz2
Tweak meaning of size option
Consider it the full amount of IO to be done, even if the files used are smaller. Then we'll just restart the workload until we reach the desired number of bytes. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--fio.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/fio.c b/fio.c
index 9e93159f..fcf3ae80 100644
--- a/fio.c
+++ b/fio.c
@@ -721,6 +721,24 @@ static int switch_ioscheduler(struct thread_data *td)
return 0;
}
+static int keep_running(struct thread_data *td)
+{
+ unsigned long long io_done;
+
+ if (td->o.time_based)
+ return 1;
+ if (td->o.loops) {
+ td->o.loops--;
+ return 1;
+ }
+
+ io_done = td->io_bytes[DDIR_READ] + td->io_bytes[DDIR_WRITE];
+ if (io_done < td->o.size)
+ return 1;
+
+ return 0;
+}
+
static int clear_io_state(struct thread_data *td)
{
struct fio_file *f;
@@ -838,7 +856,7 @@ static void *thread_main(void *data)
runtime[0] = runtime[1] = 0;
clear_state = 0;
- while (td->o.time_based || td->o.loops--) {
+ while (keep_running(td)) {
fio_gettime(&td->start, NULL);
memcpy(&td->ts.stat_sample_time, &td->start, sizeof(td->start));