X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=engines%2Fcpu.c;h=14ad9717aa5fbd024a7e9f286a36fd79542c6365;hp=d10669df0db0f4101138f68cc1b5589e31487273;hb=c97d8369f04e562383f50a77a2b0e2abb102df75;hpb=da751ca9665bcdeca56d2eec5b629a0953c07662 diff --git a/engines/cpu.c b/engines/cpu.c index d10669df..14ad9717 100644 --- a/engines/cpu.c +++ b/engines/cpu.c @@ -6,55 +6,39 @@ * */ #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; } -static int fio_cpuio_setup(struct thread_data fio_unused *td) -{ - struct fio_file *f; - unsigned int i; - - td->total_file_size = -1; - td->io_size = td->total_file_size; - td->total_io_size = td->io_size; - - for_each_file(td, f, i) { - f->real_file_size = -1; - f->file_size = -1; - } - - return 0; -} - 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; } - if (td->cpuload > 100) - td->cpuload = 100; + if (o->cpuload > 100) + o->cpuload = 100; /* * 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; } -static int fio_cpuio_open(struct thread_data fio_unused *td, struct fio_file *f) +static int fio_cpuio_open(struct thread_data fio_unused *td, + struct fio_file fio_unused *f) { - f->fd = 0; return 0; } @@ -63,7 +47,6 @@ static struct ioengine_ops ioengine = { .version = FIO_IOOPS_VERSION, .queue = fio_cpuio_queue, .init = fio_cpuio_init, - .setup = fio_cpuio_setup, .open_file = fio_cpuio_open, .flags = FIO_SYNCIO | FIO_DISKLESSIO, };