syslet engine: style fix and ->queue() error return value fix
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index ab46cbe7aadb163578517578a7b41b962c6711c4..23a64b046861bcf13e68bf316fd5111593468ca4 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -289,23 +289,23 @@ static void io_u_mark_latency(struct thread_data *td, unsigned long msec)
        switch (msec) {
        default:
                index++;
-       case 1024 ... 2047:
+       case 1000 ... 1999:
                index++;
-       case 512 ... 1023:
+       case 750 ... 999:
                index++;
-       case 256 ... 511:
+       case 500 ... 749:
                index++;
-       case 128 ... 255:
+       case 250 ... 499:
                index++;
-       case 64 ... 127:
+       case 100 ... 249:
                index++;
-       case 32 ... 63:
+       case 50 ... 99:
                index++;
-       case 16 ... 31:
+       case 20 ... 49:
                index++;
-       case 8 ... 15:
+       case 10 ... 19:
                index++;
-       case 4 ... 7:
+       case 4 ... 9:
                index++;
        case 2 ... 3:
                index++;
@@ -506,6 +506,9 @@ static void ios_completed(struct thread_data *td,
        }
 }
 
+/*
+ * Complete a single io_u for the sync engines.
+ */
 long io_u_sync_complete(struct thread_data *td, struct io_u *io_u,
                        endio_handler *handler)
 {
@@ -521,6 +524,9 @@ long io_u_sync_complete(struct thread_data *td, struct io_u *io_u,
        return -1;
 }
 
+/*
+ * Called to complete min_events number of io for the async engines.
+ */
 long io_u_queued_complete(struct thread_data *td, int min_events,
                          endio_handler *handler)
 
@@ -555,3 +561,14 @@ long io_u_queued_complete(struct thread_data *td, int min_events,
 
        return -1;
 }
+
+/*
+ * Call when io_u is really queued, to update the submission latency.
+ */
+void io_u_queued(struct thread_data *td, struct io_u *io_u)
+{
+       unsigned long slat_time;
+
+       slat_time = mtime_since(&io_u->start_time, &io_u->issue_time);
+       add_slat_sample(td, io_u->ddir, slat_time);
+}