X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=fio.c;h=fcf3ae80c1fd5316c0ce121434eef2426b4471fe;hp=9e93159f42c161160134e209a3a643e49dc3cd61;hb=492158cf6a2e81886c43a6e696b17d7160ec5540;hpb=281f9b6363ff7ca9fdcc93c600faa8c907ba3010 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));