The functions add_clat_sample(), add_lat_sample() and add_slat_sample()
have a rather large number of arguments, and some of the arguments are
members of the struct io_u. Pass io_u instead of those arguments to
reduce the number of arguments.
Some add_clat_sample() callers in engines/fileoperations.c do not have
io_u reference, then pass NULL instead of the io_u. This indicates to
use 0 values instead of the io_u fields.
While add_slat_sample() takes only struct thread_data * and struct
*io_u, add_clat_sample() and add_lat_sample() still require three more
arguments: 1) nsec is required because struct io_u does not have
completion time, 2) ddir is required to support fileoperations IO
engine, and 3) bs to record partial IO completion.
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240829085826.999859-2-shinichiro.kawasaki@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
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;
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;
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;
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;
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);
}
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);
}
}
void add_clat_sample(struct thread_data *td, enum fio_ddir ddir,
unsigned long long nsec, unsigned long long bs,
- uint64_t offset, unsigned int ioprio,
- unsigned short clat_prio_index)
+ struct io_u *io_u)
{
const bool needs_lock = td_async_processing(td);
unsigned long elapsed, this_window;
struct thread_stat *ts = &td->ts;
struct io_log *iolog = td->clat_hist_log;
+ uint64_t offset = 0;
+ unsigned int ioprio = 0;
+ unsigned short clat_prio_index = 0;
if (needs_lock)
__td_io_u_lock(td);
+ if (io_u) {
+ offset = io_u->offset;
+ ioprio = io_u->ioprio;
+ clat_prio_index = io_u->clat_prio_index;
+ }
+
add_stat_sample(&ts->clat_stat[ddir], nsec);
/*
__td_io_u_unlock(td);
}
-void add_slat_sample(struct thread_data *td, enum fio_ddir ddir,
- unsigned long long nsec, unsigned long long bs,
- uint64_t offset, unsigned int ioprio)
+void add_slat_sample(struct thread_data *td, struct io_u *io_u)
{
const bool needs_lock = td_async_processing(td);
struct thread_stat *ts = &td->ts;
+ enum fio_ddir ddir;
+ unsigned long long nsec;
+ ddir = io_u->ddir;
if (!ddir_rw(ddir))
return;
if (needs_lock)
__td_io_u_lock(td);
+ nsec = ntime_since(&io_u->start_time, &io_u->issue_time);
+
add_stat_sample(&ts->slat_stat[ddir], nsec);
if (td->slat_log)
- add_log_sample(td, td->slat_log, sample_val(nsec), ddir, bs,
- offset, ioprio);
+ add_log_sample(td, td->slat_log, sample_val(nsec), ddir,
+ io_u->xfer_buflen, io_u->offset, io_u->ioprio);
if (ts->slat_percentiles)
add_lat_percentile_sample(ts, nsec, ddir, FIO_SLAT);
void add_lat_sample(struct thread_data *td, enum fio_ddir ddir,
unsigned long long nsec, unsigned long long bs,
- uint64_t offset, unsigned int ioprio,
- unsigned short clat_prio_index)
+ struct io_u * io_u)
{
const bool needs_lock = td_async_processing(td);
struct thread_stat *ts = &td->ts;
if (td->lat_log)
add_log_sample(td, td->lat_log, sample_val(nsec), ddir, bs,
- offset, ioprio);
+ io_u->offset, io_u->ioprio);
/*
* When lat_percentiles=1 (default 0), the reported per priority
*/
if (ts->lat_percentiles) {
add_lat_percentile_sample(ts, nsec, ddir, FIO_LAT);
- add_lat_percentile_prio_sample(ts, nsec, ddir, clat_prio_index);
- add_stat_prio_sample(ts->clat_prio[ddir], clat_prio_index,
+ add_lat_percentile_prio_sample(ts, nsec, ddir,
+ io_u->clat_prio_index);
+ add_stat_prio_sample(ts->clat_prio[ddir], io_u->clat_prio_index,
nsec);
}
if (needs_lock)
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);