Add time_based option

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>
diff --git a/eta.c b/eta.c
index 31028dd..39241c5 100644
--- a/eta.c
+++ b/eta.c
@@ -118,13 +118,19 @@
 		bytes_total /= (td->o.zone_skip / td->o.zone_size);
 
 	if (td->runstate == TD_RUNNING || td->runstate == TD_VERIFYING) {
-		double perc;
+		double perc, perc_t;
 
 		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))