4 static int fio_cpuio_queue(struct thread_data *td, struct io_u fio_unused *io_u)
6 __usec_sleep(td->cpucycle);
7 return FIO_Q_COMPLETED;
10 static int fio_cpuio_setup(struct thread_data fio_unused *td)
15 td->total_file_size = -1;
16 td->io_size = td->total_file_size;
17 td->total_io_size = td->io_size;
19 for_each_file(td, f, i) {
20 f->real_file_size = -1;
27 static int fio_cpuio_init(struct thread_data *td)
30 td_vmsg(td, EINVAL, "cpu thread needs rate (cpuload=)","cpuio");
34 if (td->cpuload > 100)
38 * set thinktime_sleep and thinktime_spin appropriately
40 td->thinktime_blocks = 1;
41 td->thinktime_spin = 0;
42 td->thinktime = (td->cpucycle * (100 - td->cpuload)) / td->cpuload;
44 td->nr_files = td->open_files = 1;
48 static int fio_cpuio_open(struct thread_data fio_unused *td, struct fio_file *f)
54 static struct ioengine_ops ioengine = {
56 .version = FIO_IOOPS_VERSION,
57 .queue = fio_cpuio_queue,
58 .init = fio_cpuio_init,
59 .setup = fio_cpuio_setup,
60 .open_file = fio_cpuio_open,
61 .flags = FIO_SYNCIO | FIO_DISKLESSIO,
64 static void fio_init fio_cpuio_register(void)
66 register_ioengine(&ioengine);
69 static void fio_exit fio_cpuio_unregister(void)
71 unregister_ioengine(&ioengine);