cpuio engine cpuload bug fix
authorYufei Ren <renyufei83@gmail.com>
Sat, 20 Oct 2012 03:11:49 +0000 (23:11 -0400)
committerJens Axboe <axboe@kernel.dk>
Mon, 22 Oct 2012 08:02:26 +0000 (10:02 +0200)
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 <axboe@kernel.dk>
engines/cpu.c
examples/cpuio [new file with mode: 0644]

index 8bc9fd5c3c8c8919d4618bf6f149fb5b142093a6..322dfde7412d9df075132bb8e3bd17c4ad713792 100644 (file)
 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 (file)
index 0000000..577e072
--- /dev/null
@@ -0,0 +1,8 @@
+[global]
+ioengine=cpuio
+time_based
+runtime=10
+
+[burn50percent]
+cpuload=50
+