*
*/
#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[] = {
.type = FIO_OPT_INT,
.off1 = offsetof(struct cpu_options, cpuload),
.help = "Use this percentage of CPU",
- .category = FIO_OPT_C_GENERAL,
+ .category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_INVALID,
},
{
.def = "50000",
.parent = "cpuload",
.hide = 1,
- .category = FIO_OPT_C_GENERAL,
+ .category = FIO_OPT_C_ENGINE,
+ .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_ENGINE,
.group = FIO_OPT_G_INVALID,
},
{
{
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;
}
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;
}