From: Jens Axboe Date: Thu, 30 Nov 2017 04:25:32 +0000 (-0700) Subject: io_u: do nsec -> usec converison in one spot in account_io_completion() X-Git-Tag: fio-3.3~55 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=e58beec1add60406cb70e5d0668514c1b3800cf6 io_u: do nsec -> usec converison in one spot in account_io_completion() Should not matter for runtime, but it's cleaner. What we should really do is convert the internal values to nsec, so we don't have to do this conversion. Signed-off-by: Jens Axboe --- diff --git a/io_u.c b/io_u.c index e1e44952..0466ac01 100644 --- a/io_u.c +++ b/io_u.c @@ -1862,23 +1862,24 @@ static void account_io_completion(struct thread_data *td, struct io_u *io_u, llnsec = ntime_since(&io_u->issue_time, &icd->time); if (!td->o.disable_lat) { - unsigned long long tnsec; + unsigned long long tnsec, tusec; tnsec = ntime_since(&io_u->start_time, &icd->time); + tusec = tnsec / 1000; add_lat_sample(td, idx, tnsec, bytes, io_u->offset); if (td->flags & TD_F_PROFILE_OPS) { struct prof_io_ops *ops = &td->prof_io_ops; if (ops->io_u_lat) - icd->error = ops->io_u_lat(td, tnsec/1000); + icd->error = ops->io_u_lat(td, tusec); } - if (td->o.max_latency && tnsec/1000 > td->o.max_latency) - lat_fatal(td, icd, tnsec/1000, td->o.max_latency); - if (td->o.latency_target && tnsec/1000 > td->o.latency_target) { + if (td->o.max_latency && tusec > td->o.max_latency) + lat_fatal(td, icd, tusec, td->o.max_latency); + if (td->o.latency_target && tusec > td->o.latency_target) { if (lat_target_failed(td)) - lat_fatal(td, icd, tnsec/1000, td->o.latency_target); + lat_fatal(td, icd, tusec, td->o.latency_target); } }