[PATCH 1/4] cpuio engine cpuload bug fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Yufei Ren <renyufei83@xxxxxxxxx>

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.
---
 engines/cpu.c  |    5 +++++
 examples/cpuio |    8 ++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
 create mode 100644 examples/cpuio

diff --git a/engines/cpu.c b/engines/cpu.c
index 8bc9fd5..322dfde 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 0000000..577e072
--- /dev/null
+++ b/examples/cpuio
@@ -0,0 +1,8 @@
+[global]
+ioengine=cpuio
+time_based
+runtime=10
+
+[burn50percent]
+cpuload=50
+
-- 
1.7.2.3

--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux