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->cpucycle);
14 return FIO_Q_COMPLETED;
17 static int fio_cpuio_setup(struct thread_data fio_unused *td)
22 td->total_file_size = -1;
23 td->io_size = td->total_file_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)
37 td_vmsg(td, EINVAL, "cpu thread needs rate (cpuload=)","cpuio");
41 if (td->cpuload > 100)
45 * set thinktime_sleep and thinktime_spin appropriately
47 td->thinktime_blocks = 1;
48 td->thinktime_spin = 0;
49 td->thinktime = (td->cpucycle * (100 - td->cpuload)) / td->cpuload;
51 td->nr_files = td->open_files = 1;
55 static int fio_cpuio_open(struct thread_data fio_unused *td, struct fio_file *f)
61 static struct ioengine_ops ioengine = {
63 .version = FIO_IOOPS_VERSION,
64 .queue = fio_cpuio_queue,
65 .init = fio_cpuio_init,
66 .setup = fio_cpuio_setup,
67 .open_file = fio_cpuio_open,
68 .flags = FIO_SYNCIO | FIO_DISKLESSIO,
71 static void fio_init fio_cpuio_register(void)
73 register_ioengine(&ioengine);
76 static void fio_exit fio_cpuio_unregister(void)
78 unregister_ioengine(&ioengine);