This allows fio to keep running, even if the workload has completed.
It will simply restart the workload over and over, for as long as the
runtime setting allows.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
a specified job will run, so this parameter is handy to
cap the total runtime to a given time.
a specified job will run, so this parameter is handy to
cap the total runtime to a given time.
+time_based If set, fio will run for the duration of the runtime
+ specified even if the file(s) are completey read or
+ written. It will simply loop over the same workload
+ as many times as the runtime allows.
+
invalidate=bool Invalidate the buffer/page cache parts for this file prior
to starting io. Defaults to true.
invalidate=bool Invalidate the buffer/page cache parts for this file prior
to starting io. Defaults to true.
bytes_total /= (td->o.zone_skip / td->o.zone_size);
if (td->runstate == TD_RUNNING || td->runstate == TD_VERIFYING) {
bytes_total /= (td->o.zone_skip / td->o.zone_size);
if (td->runstate == TD_RUNNING || td->runstate == TD_VERIFYING) {
bytes_done = td->io_bytes[DDIR_READ] + td->io_bytes[DDIR_WRITE];
perc = (double) bytes_done / (double) bytes_total;
if (perc > 1.0)
perc = 1.0;
bytes_done = td->io_bytes[DDIR_READ] + td->io_bytes[DDIR_WRITE];
perc = (double) bytes_done / (double) bytes_total;
if (perc > 1.0)
perc = 1.0;
+ if (td->o.time_based) {
+ perc_t = (double) elapsed / (double) td->o.timeout;
+ if (perc_t < perc)
+ perc = perc_t;
+ }
+
eta_sec = (unsigned long) (elapsed * (1.0 / perc)) - elapsed;
if (td->o.timeout && eta_sec > (td->o.timeout - elapsed))
eta_sec = (unsigned long) (elapsed * (1.0 / perc)) - elapsed;
if (td->o.timeout && eta_sec > (td->o.timeout - elapsed))
unsigned long long runtime[2];
struct thread_data *td = data;
unsigned long elapsed;
unsigned long long runtime[2];
struct thread_data *td = data;
unsigned long elapsed;
int clear_state;
if (!td->o.use_thread)
int clear_state;
if (!td->o.use_thread)
runtime[0] = runtime[1] = 0;
clear_state = 0;
runtime[0] = runtime[1] = 0;
clear_state = 0;
- while (td->o.loops--) {
+ while (td->o.time_based || td->o.loops--) {
fio_gettime(&td->start, NULL);
memcpy(&td->ts.stat_sample_time, &td->start, sizeof(td->start));
fio_gettime(&td->start, NULL);
memcpy(&td->ts.stat_sample_time, &td->start, sizeof(td->start));
if (td->error || td->terminate)
break;
if (td->error || td->terminate)
break;
+ fio_gettime(&t, NULL);
+ if (runtime_exceeded(td, &t))
+ break;
+
if (td->o.verify == VERIFY_NONE)
continue;
if (td->o.verify == VERIFY_NONE)
continue;
unsigned int group_reporting;
unsigned int fadvise_hint;
unsigned int zero_buffers;
unsigned int group_reporting;
unsigned int fadvise_hint;
unsigned int zero_buffers;
+ unsigned int time_based;
char *read_iolog_file;
char *write_iolog_file;
char *read_iolog_file;
char *write_iolog_file;
+ if (!o->timeout && o->time_based) {
+ log_err("fio: time_based requires a runtime/timeout setting\n");
+ o->time_based = 0;
+ }
+
.help = "Stop workload when this amount of time has passed",
.def = "0",
},
.help = "Stop workload when this amount of time has passed",
.def = "0",
},
+ {
+ .name = "time_based",
+ .type = FIO_OPT_STR_SET,
+ .off1 = td_var_offset(time_based),
+ .help = "Keep running until runtime/timeout is met",
+ },
{
.name = "mem",
.alias = "iomem",
{
.name = "mem",
.alias = "iomem",