projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix io piece logging to not have O(n) runtime
[fio.git]
/
engines
/
cpu.c
diff --git
a/engines/cpu.c
b/engines/cpu.c
index b6f9075d365be76fe944a33101cf6eff3b195b88..c908cab8af55aff7f86a58c35483af973450800d 100644
(file)
--- a/
engines/cpu.c
+++ b/
engines/cpu.c
@@
-1,9
+1,16
@@
+/*
+ * CPU engine
+ *
+ * Doesn't transfer any data, merely burns CPU cycles according to
+ * the settings.
+ *
+ */
#include "../fio.h"
#include "../os.h"
static int fio_cpuio_queue(struct thread_data *td, struct io_u fio_unused *io_u)
{
#include "../fio.h"
#include "../os.h"
static int fio_cpuio_queue(struct thread_data *td, struct io_u fio_unused *io_u)
{
- __usec_sleep(td->cpucycle);
+ __usec_sleep(td->
o.
cpucycle);
return FIO_Q_COMPLETED;
}
return FIO_Q_COMPLETED;
}
@@
-12,8
+19,8
@@
static int fio_cpuio_setup(struct thread_data fio_unused *td)
struct fio_file *f;
unsigned int i;
struct fio_file *f;
unsigned int i;
- td->
total_file_
size = -1;
- td->io_size = td->
total_file_
size;
+ td->
o.
size = -1;
+ td->io_size = td->
o.
size;
td->total_io_size = td->io_size;
for_each_file(td, f, i) {
td->total_io_size = td->io_size;
for_each_file(td, f, i) {
@@
-26,22
+33,24
@@
static int fio_cpuio_setup(struct thread_data fio_unused *td)
static int fio_cpuio_init(struct thread_data *td)
{
static int fio_cpuio_init(struct thread_data *td)
{
- if (!td->cpuload) {
+ struct thread_options *o = &td->o;
+
+ if (!o->cpuload) {
td_vmsg(td, EINVAL, "cpu thread needs rate (cpuload=)","cpuio");
return 1;
}
td_vmsg(td, EINVAL, "cpu thread needs rate (cpuload=)","cpuio");
return 1;
}
- if (
td
->cpuload > 100)
-
td
->cpuload = 100;
+ if (
o
->cpuload > 100)
+
o
->cpuload = 100;
/*
* set thinktime_sleep and thinktime_spin appropriately
*/
/*
* set thinktime_sleep and thinktime_spin appropriately
*/
-
td
->thinktime_blocks = 1;
-
td
->thinktime_spin = 0;
-
td->thinktime = (td->cpucycle * (100 - td->cpuload)) / td
->cpuload;
+
o
->thinktime_blocks = 1;
+
o
->thinktime_spin = 0;
+
o->thinktime = (o->cpucycle * (100 - o->cpuload)) / o
->cpuload;
-
td->nr_files = td
->open_files = 1;
+
o->nr_files = o
->open_files = 1;
return 0;
}
return 0;
}