From 2557f7e66176884783053fc44bda91a6781a3725 Mon Sep 17 00:00:00 2001 From: Yufei Ren Date: Fri, 19 Oct 2012 23:11:49 -0400 Subject: [PATCH] cpuio engine cpuload bug fix Current cpu ioengine always bruns out 100 percent cpu cycles no matter what the cpuload value is. Since no data is transferred with cpuio, bytes_done would be ZERO. Consequently, think_time is omitted and loops keeps running. A cpuio example is added as well. Signed-off-by: Jens Axboe --- engines/cpu.c | 5 +++++ examples/cpuio | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 examples/cpuio diff --git a/engines/cpu.c b/engines/cpu.c index 8bc9fd5c..322dfde7 100644 --- a/engines/cpu.c +++ b/engines/cpu.c @@ -10,6 +10,11 @@ static int fio_cpuio_queue(struct thread_data *td, struct io_u fio_unused *io_u) { usec_spin(td->o.cpucycle); + + if (io_u->buflen == 0) + io_u->buflen = 1; + io_u->resid = 0; + return FIO_Q_COMPLETED; } diff --git a/examples/cpuio b/examples/cpuio new file mode 100644 index 00000000..577e0729 --- /dev/null +++ b/examples/cpuio @@ -0,0 +1,8 @@ +[global] +ioengine=cpuio +time_based +runtime=10 + +[burn50percent] +cpuload=50 + -- 2.25.1