4 * Doesn't transfer any data, merely burns CPU cycles according to
11 static int fio_cpuio_queue(struct thread_data *td, struct io_u fio_unused *io_u)
13 __usec_sleep(td->o.cpucycle);
14 return FIO_Q_COMPLETED;
17 static int fio_cpuio_setup(struct thread_data fio_unused *td)
23 td->io_size = td->o.size;
24 td->total_io_size = td->io_size;
26 for_each_file(td, f, i) {
27 f->real_file_size = -1;
34 static int fio_cpuio_init(struct thread_data *td)
36 struct thread_options *o = &td->o;
39 td_vmsg(td, EINVAL, "cpu thread needs rate (cpuload=)","cpuio");
47 * set thinktime_sleep and thinktime_spin appropriately
49 o->thinktime_blocks = 1;
50 o->thinktime_spin = 0;
51 o->thinktime = (o->cpucycle * (100 - o->cpuload)) / o->cpuload;
53 o->nr_files = o->open_files = 1;
57 static int fio_cpuio_open(struct thread_data fio_unused *td, struct fio_file *f)
63 static struct ioengine_ops ioengine = {
65 .version = FIO_IOOPS_VERSION,
66 .queue = fio_cpuio_queue,
67 .init = fio_cpuio_init,
68 .setup = fio_cpuio_setup,
69 .open_file = fio_cpuio_open,
70 .flags = FIO_SYNCIO | FIO_DISKLESSIO,
73 static void fio_init fio_cpuio_register(void)
75 register_ioengine(&ioengine);
78 static void fio_exit fio_cpuio_unregister(void)
80 unregister_ioengine(&ioengine);