Recent changes (master)
The following changes since commit 48cf0c63e5b867c8953f25deaa02466bf94a2eed:
engines/xnvme: fix fdp support for userspace drivers (2023-11-02 06:08:13 -0600)
are available in the Git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to 2c0b784a12172da1533dfd40b66a0e4e5609065f:
Merge branch 'thinkcycles-parameter' of https://github.com/cloehle/fio (2023-11-03 11:21:22 -0400)
----------------------------------------------------------------
Christian Loehle (1):
fio: Introduce new constant thinkcycles option
Vincent Fu (1):
Merge branch 'thinkcycles-parameter' of https://github.com/cloehle/fio
HOWTO.rst | 8 ++++++++ backend.c | 4 ++++ cconv.c | 2 ++ fio.1 | 7 +++++++ fio_time.h | 1 + options.c | 12 ++++++++++++ thread_options.h | 8 ++++++-- time.c | 11 +++++++++++ 8 files changed, 51 insertions(+), 2 deletions(-)
---
Diff of recent changes:
HOWTO.rst +8 -0
@@ -3209,6 +3209,14 @@ I/O depth I/O rate ~~~~~~~~ +.. option:: thinkcycles=int + + Stall the job for the specified number of cycles after an I/O has completed before + issuing the next. May be used to simulate processing being done by an application. + This is not taken into account for the time to be waited on for :option:`thinktime`. + Might not have any effect on some platforms, this can be checked by trying a setting + a high enough amount of thinkcycles. + .. option:: thinktime=time Stall the job for the specified period of time after an I/O has completed before issuing the
backend.c +4 -0
@@ -49,6 +49,7 @@#include "helper_thread.h" #include "pshared.h" #include "zone-dist.h" +#include "fio_time.h" static struct fio_sem *startup_sem;static struct flist_head *cgroup_list;
@@ -1133,6 +1134,9 @@ reap:if (ret <0 )break ; +if (ddir_rw (ddir) && td->o.thinkcycles) +cycles_spin (td->o.thinkcycles); +if (ddir_rw (ddir) && td->o.thinktime)handle_thinktime (td, ddir, &comp_time);
cconv.c +2 -0
@@ -233,6 +233,7 @@ int convert_thread_options_to_cpu(struct thread_options *o, o->random_generator =le32_to_cpu (top->random_generator); o->hugepage_size =le32_to_cpu (top->hugepage_size); o->rw_min_bs =le64_to_cpu (top->rw_min_bs); + o->thinkcycles =le32_to_cpu (top->thinkcycles); o->thinktime =le32_to_cpu (top->thinktime); o->thinktime_spin =le32_to_cpu (top->thinktime_spin); o->thinktime_blocks =le32_to_cpu (top->thinktime_blocks);
@@ -472,6 +473,7 @@ void convert_thread_options_to_net(struct thread_options_pack *top, top->random_generator =cpu_to_le32 (o->random_generator); top->hugepage_size =cpu_to_le32 (o->hugepage_size); top->rw_min_bs =__cpu_to_le64 (o->rw_min_bs); + top->thinkcycles =cpu_to_le32 (o->thinkcycles); top->thinktime =cpu_to_le32 (o->thinktime); top->thinktime_spin =cpu_to_le32 (o->thinktime_spin); top->thinktime_blocks =cpu_to_le32 (o->thinktime_blocks);
fio.1 +7 -0
@@ -2962,6 +2962,13 @@ reporting if I/O gets backed up on the device side (the coordinated omission problem). Note that this option cannot reliably be used with async IO engines. .SS "I/O rate" .TP +.BI thinkcycles \fR=\fPint +Stall the job for the specified number of cycles after an I/O has completed before +issuing the next. May be used to simulate processing being done by an application. +This is not taken into account for the time to be waited on for \fBthinktime\fR. +Might not have any effect on some platforms, this can be checked by trying a setting +a high enough amount of thinkcycles. +.TP .BI thinktime \fR=\fPtime Stall the job for the specified period of time after an I/O has completed before issuing the next. May be used to simulate processing being done by an application.
fio_time.h +1 -0
@@ -22,6 +22,7 @@ extern uint64_t time_since_now(const struct timespec *);extern uint64_t time_since_genesis (void );extern uint64_t mtime_since_genesis (void );extern uint64_t utime_since_genesis (void ); +extern void cycles_spin (unsigned int );extern uint64_t usec_spin (unsigned int );extern uint64_t usec_sleep (struct thread_data *,unsigned long );extern void fill_start_time (struct timespec *);
options.c +12 -0
@@ -3875,6 +3875,18 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { .category = FIO_OPT_C_IO, .group = FIO_OPT_G_THINKTIME, }, + { + .name = "thinkcycles", + .lname = "Think cycles", + .type = FIO_OPT_INT, + .off1 = offsetof(struct thread_options, thinkcycles), + .help = "Spin for a constant amount of cycles between requests", + .def = "0", + .parent = "thinktime", + .hide = 1, + .category = FIO_OPT_C_IO, + .group = FIO_OPT_G_THINKTIME, + }, { .name = "thinktime_blocks", .lname = "Thinktime blocks",
thread_options.h +6 -2
@@ -309,6 +309,8 @@ struct thread_options {char *exec_prerun;char *exec_postrun; +unsigned int thinkcycles; +unsigned int thinktime;unsigned int thinktime_spin;unsigned int thinktime_blocks;
@@ -355,8 +357,8 @@ struct thread_options {unsigned long long latency_target;unsigned long long latency_window; -fio_fp64_t latency_percentile;uint32_t latency_run; +fio_fp64_t latency_percentile;/* * flow support
@@ -626,6 +628,8 @@ struct thread_options_pack {uint8_t exec_prerun[FIO_TOP_STR_MAX ];uint8_t exec_postrun[FIO_TOP_STR_MAX ]; +uint32_t thinkcycles; +uint32_t thinktime;uint32_t thinktime_spin;uint32_t thinktime_blocks;
@@ -671,8 +675,8 @@ struct thread_options_pack {uint64_t latency_target;uint64_t latency_window;uint64_t max_latency[DDIR_RWDIR_CNT ]; -fio_fp64_t latency_percentile;uint32_t latency_run; +fio_fp64_t latency_percentile;/* * flow support
time.c +11 -0
@@ -38,6 +38,17 @@ uint64_t usec_spin(unsigned int usec)return t; } +/* +* busy loop for a fixed amount of cycles +*/ +void cycles_spin (unsigned int n) +{ +unsigned long i; + +for (i=0 ; i < n; i++) + nop; +} +uint64_t usec_sleep (struct thread_data *td,unsigned long usec) {struct timespec req;