Recent changes (master)
The following changes since commit 5d789274bd8979d881ad793faba9f885f3b80113:
Merge branch 'no-librpma' of https://github.com/grom72/fio (2024-09-03 14:44:57 -0400)
are available in the Git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to 20d0ba84d3b7e7abd8a3318175b46f5e5363547d:
t/jobs/t0034: add test for the log_issue_time option (2024-09-04 13:59:45 -0400)
----------------------------------------------------------------
Shin'ichiro Kawasaki (9):
stat: reduce arguments of add_*lat_sample() functions
stat: reduce arguments of add_log_sample()
iolog: refactor flush_samples()
iolog: drop struct io_sample_offset introduce the log_issue_time option
doc: fix the descriptions of the log_prio option
doc: describe the log_issue_time option t/jobs/t0033: add test for the log file format t/jobs/t0034: add test for the log_issue_time option
HOWTO.rst | 40 ++++++++++-- cconv.c | 2 + client.c | 36 ++++++----- engines/fileoperations.c | 6 +- fio.1 | 26 +++++--- init.c | 12 ++++ io_u.c | 14 +---- iolog.c | 156 ++++++++++++++++++++++++++--------------------- iolog.h | 47 ++++++++++---- options.c | 10 +++ server.c | 10 +-- server.h | 3 +- stat.c | 155 ++++++++++++++++++++++++++++------------------ stat.h | 13 ++-- t/jobs/t0033.fio | 28 +++++++++ t/jobs/t0034.fio | 27 ++++++++ t/run-fio-tests.py | 66 ++++++++++++++++++++ thread_options.h | 2 + 18 files changed, 459 insertions(+), 194 deletions(-) create mode 100644 t/jobs/t0033.fio create mode 100644 t/jobs/t0034.fio
---
Diff of recent changes:
HOWTO.rst +34 -6
@@ -4223,6 +4223,21 @@ Measurements and reporting entry as well as the other data values. Defaults to 0 meaning that offsets are not present in logs. Also see `Log File Formats`_. +.. option:: log_prio=bool + + If this is set, the *Command priority* field in `Log File Formats`_ + shows the priority value and the IO priority class of the command. + Otherwise, the field shows if the command has the highest RT + priority class or not. Also see `Log File Formats`_. + +.. option:: log_issue_time=bool + + If this is set, the iolog options will include the command issue time + for the I/O entry as well as the other data values. Defaults to 0 + meaning that command issue times are not present in logs. Also see + `Log File Formats`_. This option shall be set together with + :option:`write_lat_log` and :option:`log_offset`. + .. option:: log_compression=int If this is set, fio will compress the I/O logs as it goes, to keep the
@@ -5188,7 +5203,7 @@ Fio supports a variety of log file formats, for logging latencies, bandwidth, and IOPS. The logs share a common format, which looks like this: *time* (`msec`), *value*, *data direction*, *block size* (`bytes`), - *offset* (`bytes`), *command priority* + *offset* (`bytes`), *command priority*, *issue time* (`nsec`) *Time* for the log entry is always in milliseconds. The *value* logged depends on the type of log, it will be one of the following:
@@ -5213,8 +5228,21 @@ The entry's *block size* is always in bytes. The *offset* is the position in byt from the start of the file for that particular I/O. The logging of the offset can be toggled with :option:`log_offset`. -*Command priority* is 0 for normal priority and 1 for high priority. This is controlled -by the ioengine specific :option:`cmdprio_percentage`. +If :option:`log_prio` is not set, the entry's *Command priority* is 1 for an IO +executed with the highest RT priority class (:option:`prioclass` =1 or +:option:`cmdprio_class` =1) and 0 otherwise. This is controlled by the +:option:`prioclass` option and the ioengine specific +:option:`cmdprio_percentage` :option:`cmdprio_class` options. If +:option:`log_prio` is set, the entry's *Command priority* is the priority set +for the IO, as a 16-bits hexadecimal number with the lowest 13 bits indicating +the priority value (:option:`prio` and :option:`cmdprio` options) and the +highest 3 bits indicating the IO priority class (:option:`prioclass` and +:option:`cmdprio_class` options). + +The entry's *issue time* is the command issue time in nanoseconds. The logging +of the issue time can be toggled with :option:`log_issue_time`. This field has +valid values in completion latency log file (clat), or submit latency log file +(slat). The field has value 0 in other logs files. Fio defaults to logging every individual I/O but when windowed logging is set through :option:`log_avg_msec`, either the average (by default), the maximum
@@ -5224,12 +5252,12 @@ is set to both) is recorded. The log file format when both the values are report takes this form: *time* (`msec`), *value*, *value1*, *data direction*, *block size* (`bytes`), - *offset* (`bytes`), *command priority* + *offset* (`bytes`), *command priority*, *issue time* (`nsec`) Each *data direction* seen within the window period will aggregate its values in a -separate row. Further, when using windowed logging the *block size* and *offset* -entries will always contain 0. +separate row. Further, when using windowed logging the *block size*, *offset* +and *issue time* entries will always contain 0. Client/Server
cconv.c +2 -0
@@ -216,6 +216,7 @@ int convert_thread_options_to_cpu(struct thread_options *o, o->log_max =le32_to_cpu (top->log_max); o->log_offset =le32_to_cpu (top->log_offset); o->log_prio =le32_to_cpu (top->log_prio); + o->log_issue_time =le32_to_cpu (top->log_issue_time); o->log_gz =le32_to_cpu (top->log_gz); o->log_gz_store =le32_to_cpu (top->log_gz_store); o->log_alternate_epoch =le32_to_cpu (top->log_alternate_epoch);
@@ -458,6 +459,7 @@ void convert_thread_options_to_net(struct thread_options_pack *top, top->log_max =cpu_to_le32 (o->log_max); top->log_offset =cpu_to_le32 (o->log_offset); top->log_prio =cpu_to_le32 (o->log_prio); + top->log_issue_time =cpu_to_le32 (o->log_issue_time); top->log_gz =cpu_to_le32 (o->log_gz); top->log_gz_store =cpu_to_le32 (o->log_gz_store); top->log_alternate_epoch =cpu_to_le32 (o->log_alternate_epoch);
client.c +22 -14
@@ -1388,8 +1388,8 @@ static void handle_eta(struct fio_client *client, struct fio_net_cmd *cmd)static void client_flush_hist_samples (FILE *f,int hist_coarseness,void *samples,uint64_t sample_size) { -struct io_sample *s; -int log_offset; +struct io_sample *s, *s_tmp; +bool log_offset, log_issue_time;uint64_t i, j, nr_samples;struct io_u_plat_entry *entry;uint64_t *io_u_plat;
@@ -1399,15 +1399,17 @@ static void client_flush_hist_samples(FILE *f, int hist_coarseness, void *sampleif (!sample_size)return ; - s =__get_sample (samples,0 ,0 ); + s =__get_sample (samples,0 ,0 ,0 ); log_offset = (s->__ddir &LOG_OFFSET_SAMPLE_BIT ) !=0 ; + log_issue_time = (s->__ddir &LOG_ISSUE_TIME_SAMPLE_BIT ) !=0 ; - nr_samples = sample_size /__log_entry_sz (log_offset); + nr_samples = sample_size /__log_entry_sz (log_offset, log_issue_time);for (i =0 ; i < nr_samples; i++) { - s = (struct io_sample *)((char *)__get_sample (samples, log_offset, i) + - i *sizeof (struct io_u_plat_entry )); + s_tmp =__get_sample (samples, log_offset, log_issue_time, i); + s = (struct io_sample *)((char *)s_tmp + + i *sizeof (struct io_u_plat_entry )); entry = s->data.plat_entry; io_u_plat = entry->io_u_plat;
@@ -1595,6 +1597,7 @@ static struct cmd_iolog_pdu *convert_iolog_gz(struct fio_net_cmd *cmd,uint64_t nr_samples;size_t total;char *p; +size_t log_entry_size; stream.zalloc =Z_NULL ; stream.zfree =Z_NULL ;
@@ -1610,11 +1613,13 @@ static struct cmd_iolog_pdu *convert_iolog_gz(struct fio_net_cmd *cmd,*/ nr_samples =le64_to_cpu (pdu->nr_samples); + log_entry_size =__log_entry_sz (le32_to_cpu (pdu->log_offset), +le32_to_cpu (pdu->log_issue_time));if (pdu->log_type ==IO_LOG_TYPE_HIST ) - total = nr_samples * (__log_entry_sz (le32_to_cpu (pdu->log_offset)) + -sizeof (struct io_u_plat_entry )); + total = nr_samples * (log_entry_size + +sizeof (struct io_u_plat_entry ));else - total = nr_samples *__log_entry_sz (le32_to_cpu (pdu->log_offset)); + total = nr_samples * log_entry_size; ret =malloc (total +sizeof (*pdu)); ret->nr_samples = nr_samples;
@@ -1703,6 +1708,7 @@ static struct cmd_iolog_pdu *convert_iolog(struct fio_net_cmd *cmd, ret->compressed =le32_to_cpu (ret->compressed); ret->log_offset =le32_to_cpu (ret->log_offset); ret->log_prio =le32_to_cpu (ret->log_prio); + ret->log_issue_time =le32_to_cpu (ret->log_issue_time); ret->log_hist_coarseness =le32_to_cpu (ret->log_hist_coarseness); ret->per_job_logs =le32_to_cpu (ret->per_job_logs);
@@ -1713,7 +1719,7 @@ static struct cmd_iolog_pdu *convert_iolog(struct fio_net_cmd *cmd,for (i =0 ; i < ret->nr_samples; i++) {struct io_sample *s; - s =__get_sample (samples, ret->log_offset, i); + s =__get_sample (samples, ret->log_offset, ret->log_issue_time, i);if (ret->log_type ==IO_LOG_TYPE_HIST ) s = (struct io_sample *)((char *)s +sizeof (struct io_u_plat_entry ) * i);
@@ -1726,11 +1732,13 @@ static struct cmd_iolog_pdu *convert_iolog(struct fio_net_cmd *cmd, s->bs =le64_to_cpu (s->bs); s->priority =le16_to_cpu (s->priority); -if (ret->log_offset) { -struct io_sample_offset *so = (void *) s; +if (ret->log_offset) + s->aux[IOS_AUX_OFFSET_INDEX ] = +le64_to_cpu (s->aux[IOS_AUX_OFFSET_INDEX ]); - so->offset =le64_to_cpu (so->offset); - } +if (ret->log_issue_time) + s->aux[IOS_AUX_ISSUE_TIME_INDEX ] = +le64_to_cpu (s->aux[IOS_AUX_ISSUE_TIME_INDEX ]);if (ret->log_type ==IO_LOG_TYPE_HIST ) { s->data.plat_entry = (struct io_u_plat_entry *)(((char *)s) +sizeof (*s));
engines/fileoperations.c +3 -3
@@ -129,7 +129,7 @@ static int open_file(struct thread_data *td, struct fio_file *f)uint64_t nsec; nsec =ntime_since_now (&start); -add_clat_sample (td, data->stat_ddir, nsec,0 ,0 ,0 ,0 ); +add_clat_sample (td, data->stat_ddir, nsec,0 ,NULL ); }return 0 ;
@@ -200,7 +200,7 @@ static int stat_file(struct thread_data *td, struct fio_file *f)uint64_t nsec; nsec =ntime_since_now (&start); -add_clat_sample (td, data->stat_ddir, nsec,0 ,0 ,0 ,0 ); +add_clat_sample (td, data->stat_ddir, nsec,0 ,NULL ); }return 0 ;
@@ -250,7 +250,7 @@ static int delete_file(struct thread_data *td, struct fio_file *f)uint64_t nsec; nsec =ntime_since_now (&start); -add_clat_sample (td, data->stat_ddir, nsec,0 ,0 ,0 ,0 ); +add_clat_sample (td, data->stat_ddir, nsec,0 ,NULL ); }return 0 ;
fio.1 +19 -7
@@ -3933,9 +3933,16 @@ entry as well as the other data values. Defaults to 0 meaning that offsets are not present in logs. Also see \fBLOG FILE FORMATS\fR section. .TP .BI log_prio \fR=\fPbool -If this is set, the iolog options will include the I/O priority for the I/O -entry as well as the other data values. Defaults to 0 meaning that -I/O priorities are not present in logs. Also see \fBLOG FILE FORMATS\fR section. +If this is set, the `Command priority` field in \fBLOG FILE FORMATS\fR +shows the priority value and the IO priority class of the command. +Otherwise, the field shows if the command has the highest RT priority +class or not. Also see \fBLOG FILE FORMATS\fR section. +.TP +.BI log_issue_time \fR=\fPbool +If this is set, the iolog options will include the command issue time for the +I/O entry as well as the other data values. Defaults to 0 meaning that command +issue times are not present in logs. Also see \fBLOG FILE FORMATS\fR section. +This option shall be set together with \fBwrite_lat_log\fR and \fBlog_offset\fR. .TP .BI log_compression \fR=\fPint If this is set, fio will compress the I/O logs as it goes, to keep the
@@ -4932,7 +4939,7 @@ and IOPS. The logs share a common format, which looks like this: .RS .P time (msec), value, data direction, block size (bytes), offset (bytes), -command priority +command priority, issue time (nsec) .RE .P `Time' for the log entry is always in milliseconds. The `value' logged depends
@@ -4975,6 +4982,11 @@ number with the lowest 13 bits indicating the priority value (\fBprio\fR and \fBcmdprio\fR options) and the highest 3 bits indicating the IO priority class (\fBprioclass\fR and \fBcmdprio_class\fR options). .P +The entry's `issue time` is the command issue time in nanoseconds. The logging +of the issue time can be toggled with \fBlog_issue_time\fR. This field has valid +values in completion latency log file (clat), or submit latency log file (slat). +The field has value 0 in other log files. +.P Fio defaults to logging every individual I/O but when windowed logging is set through \fBlog_avg_msec\fR, either the average (by default), the maximum (\fBlog_window_value\fR is set to max) `value' seen over the specified period of
@@ -4984,12 +4996,12 @@ takes this form: .RS .P time (msec), value, value1, data direction, block size (bytes), offset (bytes), -command priority +command priority, issue time (nsec) .RE .P Each `data direction' seen within the window period will aggregate its values -in a separate row. Further, when using windowed logging the `block size' and -`offset' entries will always contain 0. +in a separate row. Further, when using windowed logging the `block size', +`offset' and `issue time` entries will always contain 0. .SH CLIENT / SERVER Normally fio is invoked as a stand-alone application on the machine where the I/O workload should be generated. However, the backend and frontend of fio can
init.c +12 -0
@@ -1621,12 +1621,18 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, .log_type = IO_LOG_TYPE_LAT, .log_offset = o->log_offset, .log_prio = o->log_prio, + .log_issue_time = o->log_issue_time, .log_gz = o->log_gz, .log_gz_store = o->log_gz_store, };const char *pre =make_log_name (o->lat_log_file, o->name);const char *suf; +if (o->log_issue_time && !o->log_offset) { +log_err ("fio: log_issue_time option requires write_lat_log and log_offset options\n" ); + goto err; + } +if (p.log_gz_store) suf ="log.fz" ;else
@@ -1650,6 +1656,9 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num,setup_log (&td->clat_log, &p, logname); } + }else if (o->log_issue_time) { +log_err ("fio: log_issue_time option requires write_lat_log and log_offset options\n" ); + goto err; }if (o->write_hist_log) {
@@ -1661,6 +1670,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, .log_type = IO_LOG_TYPE_HIST, .log_offset = o->log_offset, .log_prio = o->log_prio, + .log_issue_time = o->log_issue_time, .log_gz = o->log_gz, .log_gz_store = o->log_gz_store, };
@@ -1693,6 +1703,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, .log_type = IO_LOG_TYPE_BW, .log_offset = o->log_offset, .log_prio = o->log_prio, + .log_issue_time = o->log_issue_time, .log_gz = o->log_gz, .log_gz_store = o->log_gz_store, };
@@ -1725,6 +1736,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, .log_type = IO_LOG_TYPE_IOPS, .log_offset = o->log_offset, .log_prio = o->log_prio, + .log_issue_time = o->log_issue_time, .log_gz = o->log_gz, .log_gz_store = o->log_gz_store, };
io_u.c +3 -11
@@ -2016,8 +2016,7 @@ static void account_io_completion(struct thread_data *td, struct io_u *io_u,unsigned long long tnsec; tnsec =ntime_since (&io_u->start_time, &icd->time); -add_lat_sample (td, idx, tnsec, bytes, io_u->offset, - io_u->ioprio, io_u->clat_prio_index); +add_lat_sample (td, idx, tnsec, bytes, io_u);if (td->flags &TD_F_PROFILE_OPS ) {struct prof_io_ops *ops = &td->prof_io_ops;
@@ -2038,8 +2037,7 @@ static void account_io_completion(struct thread_data *td, struct io_u *io_u,if (ddir_rw (idx)) {if (!td->o.disable_clat) { -add_clat_sample (td, idx, llnsec, bytes, io_u->offset, - io_u->ioprio, io_u->clat_prio_index); +add_clat_sample (td, idx, llnsec, bytes, io_u);io_u_mark_latency (td, llnsec); }
@@ -2301,15 +2299,9 @@ int io_u_queued_complete(struct thread_data *td, int min_evts)void io_u_queued (struct thread_data *td,struct io_u *io_u) {if (!td->o.disable_slat &&ramp_time_over (td) && td->o.stats) { -unsigned long slat_time; - - slat_time =ntime_since (&io_u->start_time, &io_u->issue_time); -if (td->parent) td = td->parent; - -add_slat_sample (td, io_u->ddir, slat_time, io_u->xfer_buflen, - io_u->offset, io_u->ioprio); +add_slat_sample (td, io_u); } }
iolog.c +85 -71
208 lines not on this page · raw message
iolog.h +35 -12
101 lines not on this page · raw message
options.c +10 -0
@@ -4717,6 +4717,16 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { .category = FIO_OPT_C_LOG, .group = FIO_OPT_G_INVALID, }, + { + .name = "log_issue_time", + .lname = "Log IO issue time", + .type = FIO_OPT_BOOL, + .off1 = offsetof(struct thread_options, log_issue_time), + .help = "Include IO issue time for each log entry", + .def = "0", + .category = FIO_OPT_C_LOG, + .group = FIO_OPT_G_INVALID, + }, #ifdef CONFIG_ZLIB { .name = "log_compression",
server.c +6 -4
@@ -2295,11 +2295,13 @@ int fio_send_iolog(struct thread_data *td, struct io_log *log, const char *name) s->__ddir =__cpu_to_le32 (s->__ddir); s->bs =cpu_to_le64 (s->bs); -if (log->log_offset) { -struct io_sample_offset *so = (void *) s; +if (log->log_offset) + s->aux[IOS_AUX_OFFSET_INDEX ] = +cpu_to_le64 (s->aux[IOS_AUX_OFFSET_INDEX ]); - so->offset =cpu_to_le64 (so->offset); - } +if (log->log_issue_time) + s->aux[IOS_AUX_ISSUE_TIME_INDEX ] = +cpu_to_le64 (s->aux[IOS_AUX_ISSUE_TIME_INDEX ]); } }
server.h +2 -1
@@ -51,7 +51,7 @@ struct fio_net_cmd_reply { };enum { -FIO_SERVER_VER =106 , +FIO_SERVER_VER =107 ,FIO_SERVER_MAX_FRAGMENT_PDU =1024 ,FIO_SERVER_MAX_CMD_MB =2048 ,
@@ -197,6 +197,7 @@ struct cmd_iolog_pdu {uint32_t compressed;uint32_t log_offset;uint32_t log_prio; +uint32_t log_issue_time;uint32_t log_hist_coarseness;uint32_t per_job_logs;uint8_t name[FIO_NET_NAME_MAX ];
stat.c +96 -59
316 lines not on this page · raw message
stat.h +7 -6
@@ -366,12 +366,13 @@ extern void reset_io_stats(struct thread_data *);extern void update_rusage_stat (struct thread_data *);extern void clear_rusage_stat (struct thread_data *); -extern void add_lat_sample (struct thread_data *,enum fio_ddir ,unsigned long long , -unsigned long long ,uint64_t ,unsigned int ,unsigned short ); -extern void add_clat_sample (struct thread_data *,enum fio_ddir ,unsigned long long , -unsigned long long ,uint64_t ,unsigned int ,unsigned short ); -extern void add_slat_sample (struct thread_data *,enum fio_ddir ,unsigned long long , -unsigned long long ,uint64_t ,unsigned int ); +extern void add_lat_sample (struct thread_data *,enum fio_ddir , +unsigned long long ,unsigned long long , +struct io_u *); +extern void add_clat_sample (struct thread_data *,enum fio_ddir , +unsigned long long ,unsigned long long , +struct io_u *); +extern void add_slat_sample (struct thread_data *,struct io_u *);extern void add_agg_sample (union io_sample_data ,enum fio_ddir ,unsigned long long );extern void add_iops_sample (struct thread_data *,struct io_u *,unsigned int );
t/jobs/t0033.fio new file +28 -0
@@ -0,0 +1,28 @@ +[global] +rw=read +filename=t0033file +size=8k +time_based +runtime=2s +ioengine=libaio +iodepth=1 + +[job1] +write_bw_log=log +log_prio=1 + +[job2] +write_lat_log=log +log_avg_msec=100 +log_window_value=both + +[job3] +write_iops_log=log +log_offset=1 +log_prio=1 + +[job4] +write_iops_log=log +log_avg_msec=100 +log_window_value=both +log_offset=1
t/jobs/t0034.fio new file +27 -0
@@ -0,0 +1,27 @@ +[global] +rw=read +filename=t0034file +size=8k +time_based +runtime=2s +ioengine=libaio +iodepth=1 + +[job1] +write_lat_log=log +log_offset=1 +log_issue_time=1 + +[job2] +write_lat_log=log +log_offset=1 +log_issue_time=1 +log_avg_msec=100 +log_window_value=both + +[job3] +write_lat_log=log +write_bw_log=log +write_iops_log=log +log_offset=1 +log_issue_time=1
t/run-fio-tests.py +66 -0
84 lines not on this page · raw message
thread_options.h +2 -0
@@ -400,6 +400,7 @@ struct thread_options {unsigned int log_entries;unsigned int log_prio; +unsigned int log_issue_time; };#define FIO_TOP_STR_MAX 256
@@ -708,6 +709,7 @@ struct thread_options_pack {uint32_t log_entries;uint32_t log_prio; +uint32_t log_issue_time;uint32_t fdp;uint32_t dp_type;