4 * Doesn't transfer any data, merely burns CPU cycles according to
10 static int fio_cpuio_queue(struct thread_data *td, struct io_u fio_unused *io_u)
12 __usec_sleep(td->o.cpucycle);
13 return FIO_Q_COMPLETED;
16 static int fio_cpuio_setup(struct thread_data fio_unused *td)
21 for_each_file(td, f, i) {
23 f->real_file_size = td->o.size / td->o.nr_files;
25 f->real_file_size = -1ULL;
31 static int fio_cpuio_init(struct thread_data *td)
33 struct thread_options *o = &td->o;
36 td_vmsg(td, EINVAL, "cpu thread needs rate (cpuload=)","cpuio");
44 * set thinktime_sleep and thinktime_spin appropriately
46 o->thinktime_blocks = 1;
47 o->thinktime_spin = 0;
48 o->thinktime = (o->cpucycle * (100 - o->cpuload)) / o->cpuload;
50 o->nr_files = o->open_files = 1;
54 static int fio_cpuio_open(struct thread_data fio_unused *td,
55 struct fio_file fio_unused *f)
60 static struct ioengine_ops ioengine = {
62 .version = FIO_IOOPS_VERSION,
63 .queue = fio_cpuio_queue,
64 .init = fio_cpuio_init,
65 .setup = fio_cpuio_setup,
66 .open_file = fio_cpuio_open,
67 .flags = FIO_SYNCIO | FIO_DISKLESSIO,
70 static void fio_init fio_cpuio_register(void)
72 register_ioengine(&ioengine);
75 static void fio_exit fio_cpuio_unregister(void)
77 unregister_ioengine(&ioengine);