X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=engines%2Fcpu.c;h=3d855e363c3212ba3d0c656ac5e2e92de1da1c05;hp=c798f1884e8dff8df9b079d87d61c8c4259ae10c;hb=2403767a46a027bc7fdbb6ff27fc0da109ee1179;hpb=3d7174e3c4b8aa4daa36261a8e638b702fac5aba diff --git a/engines/cpu.c b/engines/cpu.c index c798f188..3d855e36 100644 --- a/engines/cpu.c +++ b/engines/cpu.c @@ -6,11 +6,13 @@ * */ #include "../fio.h" +#include "../optgroup.h" struct cpu_options { - struct thread_data *td; + void *pad; unsigned int cpuload; unsigned int cpucycle; + unsigned int exit_io_done; }; static struct fio_option options[] = { @@ -35,6 +37,16 @@ static struct fio_option options[] = { .category = FIO_OPT_C_GENERAL, .group = FIO_OPT_G_INVALID, }, + { + .name = "exit_on_io_done", + .lname = "Exit when IO threads are done", + .type = FIO_OPT_BOOL, + .off1 = offsetof(struct cpu_options, exit_io_done), + .help = "Exit when IO threads finish", + .def = "0", + .category = FIO_OPT_C_GENERAL, + .group = FIO_OPT_G_INVALID, + }, { .name = NULL, }, @@ -45,6 +57,11 @@ static int fio_cpuio_queue(struct thread_data *td, struct io_u fio_unused *io_u) { struct cpu_options *co = td->eo; + if (co->exit_io_done && !fio_running_or_pending_io_threads()) { + td->done = 1; + return FIO_Q_BUSY; + } + usec_spin(co->cpucycle); return FIO_Q_COMPLETED; } @@ -71,8 +88,8 @@ static int fio_cpuio_init(struct thread_data *td) o->nr_files = o->open_files = 1; - log_info("%s: ioengine=cpu, cpuload=%u, cpucycle=%u\n", td->o.name, - co->cpuload, co->cpucycle); + log_info("%s: ioengine=%s, cpuload=%u, cpucycle=%u\n", + td->o.name, td->io_ops->name, co->cpuload, co->cpucycle); return 0; }