Right now 'thinktime' waits after every IO. This may not be what you
need, sometimes you want to wait only after 'x' number of ios. This
options allows you to set the number of ios to complete, before waiting.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
thinktime=int Stall the job x microseconds after an io has completed before
issuing the next. May be used to simulate processing being
thinktime=int Stall the job x microseconds after an io has completed before
issuing the next. May be used to simulate processing being
- done by an application.
+ done by an application. See thinktime_blocks.
+
+thinktime_blocks
+ Only valid if thinktime is set - control how many blocks
+ to issue, before waiting 'thinktime' usecs. If not set,
+ defaults to 1 which will make fio wait 'thinktime' usecs
+ after every block.
rate=int Cap the bandwidth used by this job to this number of KiB/sec.
rate=int Cap the bandwidth used by this job to this number of KiB/sec.
if (runtime_exceeded(td, &icd.time))
break;
if (runtime_exceeded(td, &icd.time))
break;
- if (td->thinktime)
- usec_sleep(td, td->thinktime);
+ if (td->thinktime) {
+ unsigned long long b;
+
+ b = td->io_blocks[0] + td->io_blocks[1];
+ if (!(td->thinktime_blocks % b))
+ usec_sleep(td, td->thinktime);
+ }
unsigned int hugepage_size;
unsigned int rw_min_bs;
unsigned int thinktime;
unsigned int hugepage_size;
unsigned int rw_min_bs;
unsigned int thinktime;
+ unsigned int thinktime_blocks;
unsigned int fsync_blocks;
unsigned int start_delay;
unsigned long timeout;
unsigned int fsync_blocks;
unsigned int start_delay;
unsigned long timeout;
#define DEF_WRITE_LAT_LOG (0)
#define DEF_NO_RAND_MAP (0)
#define DEF_HUGEPAGE_SIZE FIO_HUGE_PAGE
#define DEF_WRITE_LAT_LOG (0)
#define DEF_NO_RAND_MAP (0)
#define DEF_HUGEPAGE_SIZE FIO_HUGE_PAGE
+#define DEF_THINKTIME_BLOCKS (1)
#define td_var_offset(var) ((size_t) &((struct thread_data *)0)->var)
#define td_var_offset(var) ((size_t) &((struct thread_data *)0)->var)
.type = FIO_OPT_INT,
.off1 = td_var_offset(thinktime)
},
.type = FIO_OPT_INT,
.off1 = td_var_offset(thinktime)
},
+ {
+ .name = "thinktime_blocks",
+ .type = FIO_OPT_INT,
+ .off1 = td_var_offset(thinktime_blocks)
+ },
{
.name = "rate",
.type = FIO_OPT_INT,
{
.name = "rate",
.type = FIO_OPT_INT,
def_thread.write_lat_log = write_lat_log;
def_thread.norandommap = DEF_NO_RAND_MAP;
def_thread.hugepage_size = DEF_HUGEPAGE_SIZE;
def_thread.write_lat_log = write_lat_log;
def_thread.norandommap = DEF_NO_RAND_MAP;
def_thread.hugepage_size = DEF_HUGEPAGE_SIZE;
+ def_thread.thinktime_blocks = DEF_THINKTIME_BLOCKS;
#ifdef FIO_HAVE_DISK_UTIL
def_thread.do_disk_util = 1;
#endif
#ifdef FIO_HAVE_DISK_UTIL
def_thread.do_disk_util = 1;
#endif