From: Jens Axboe Date: Thu, 3 Nov 2005 14:54:43 +0000 (+0100) Subject: [PATCH] fio: Add 'loops' parameter to specify number of times to run the job X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=b6794fbffaa7e11327797eea00226112e37e7af3;p=disktools.git [PATCH] fio: Add 'loops' parameter to specify number of times to run the job --- diff --git a/README.fio b/README.fio index 3f7da79..a284b0b 100644 --- a/README.fio +++ b/README.fio @@ -51,6 +51,9 @@ The format is as follows: use shm for buffers. exitall When one thread quits, terminate the others bwavgtime=x Average bandwidth stats over x msec + create_serialize=x If 'x', serialize file creation. + create_fsync=x If 'x', run fsync() after file creation. + loops=x Run the job 'x' number of times. Examples using cmd line jobs diff --git a/fio.c b/fio.c index 020a693..b7bdd18 100644 --- a/fio.c +++ b/fio.c @@ -130,6 +130,7 @@ enum { #define DEF_BWAVGTIME (500) #define DEF_CREATE_SER (1) #define DEF_CREATE_FSYNC (1) +#define DEF_LOOPS (1) #define ALIGN(buf) (char *) (((unsigned long) (buf) + MASK) & ~(MASK)) @@ -233,6 +234,7 @@ struct thread_data { unsigned int bw_avg_time; unsigned int create_serialize; unsigned int create_fsync; + unsigned int loops; unsigned long long file_size; unsigned long long file_offset; unsigned int sync_io; @@ -1133,10 +1135,12 @@ static void *thread_main(int shm_id, int offset, char *argv[]) memcpy(&td->stat_sample_time, &td->start, sizeof(td->start)); - if (!td->use_aio) - do_sync_io(td); - else - do_async_io(td); + while (td->loops--) { + if (!td->use_aio) + do_sync_io(td); + else + do_async_io(td); + } td->runtime = mtime_since_now(&td->start); ret = 0; @@ -1278,6 +1282,7 @@ static struct thread_data *get_new_job(int global) td->bw_avg_time = def_thread.bw_avg_time; td->create_serialize = def_thread.create_serialize; td->create_fsync = def_thread.create_fsync; + td->loops = def_thread.loops; memcpy(&td->cpumask, &def_thread.cpumask, sizeof(td->cpumask)); return td; @@ -1799,6 +1804,10 @@ static int parse_jobs_ini(char *file) fgetpos(f, &off); continue; } + if (!check_int(p, "loops", &td->loops)) { + fgetpos(f, &off); + continue; + } if (!check_range(p, "bsrange", &ul1, &ul2)) { td->min_bs = ul1; td->max_bs = ul2; @@ -2145,6 +2154,7 @@ int main(int argc, char *argv[]) def_thread.bw_avg_time = DEF_BWAVGTIME; def_thread.create_serialize = DEF_CREATE_SER; def_thread.create_fsync = DEF_CREATE_FSYNC; + def_thread.loops = DEF_LOOPS; i = parse_options(argc, argv);