Add total latency log
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index f451d1a756141e3a29eaad8f3f2fb74d113ae82e..b2b72302d58ee8b0790fb123dd882c508bbd9360 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -1079,7 +1079,13 @@ static void io_completed(struct thread_data *td, struct io_u *io_u,
                        if (!td->o.disable_clat || !td->o.disable_bw)
                                lusec = utime_since(&io_u->issue_time,
                                                        &icd->time);
+                       if (!td->o.disable_lat) {
+                               unsigned long tusec;
 
+                               tusec = utime_since(&io_u->start_time,
+                                                       &icd->time);
+                               add_lat_sample(td, idx, tusec, bytes);
+                       }
                        if (!td->o.disable_clat) {
                                add_clat_sample(td, idx, lusec, bytes);
                                io_u_mark_latency(td, lusec);
@@ -1240,20 +1246,8 @@ void io_u_queued(struct thread_data *td, struct io_u *io_u)
 void io_u_fill_buffer(struct thread_data *td, struct io_u *io_u,
                      unsigned int max_bs)
 {
-       long *ptr = io_u->buf;
-
-       if (!td->o.zero_buffers) {
-               unsigned long r = __rand(&__fio_rand_state);
-
-               if (sizeof(int) != sizeof(*ptr))
-                       r *= (unsigned long) __rand(&__fio_rand_state);
-
-               while ((void *) ptr - io_u->buf < max_bs) {
-                       *ptr = r;
-                       ptr++;
-                       r *= GOLDEN_RATIO_PRIME;
-                       r >>= 3;
-               }
-       } else
-               memset(ptr, 0, max_bs);
+       if (!td->o.zero_buffers)
+               fill_random_buf(io_u->buf, max_bs);
+       else
+               memset(io_u->buf, 0, max_bs);
 }