Add options for disabling slat/clat/bw measurements
authorJens Axboe <jens.axboe@oracle.com>
Thu, 16 Oct 2008 19:03:27 +0000 (21:03 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Thu, 16 Oct 2008 19:03:27 +0000 (21:03 +0200)
Useful for cutting down on the number of gettimeofday calls in
situations where that does impact performance. This is mostly for
really high IOPS rates.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
HOWTO
fio.h
io_u.c
ioengines.c
options.c

diff --git a/HOWTO b/HOWTO
index 129926b33be660faae02bc6cef0e4f5f4048cdd3..1d1aa61d3daf357d734545e83b1ecabb35e237f2 100644 (file)
--- a/HOWTO
+++ b/HOWTO
@@ -835,6 +835,19 @@ cpuchunks=int      If the job is a CPU cycle eater, split the load into
 disk_util=bool Generate disk utilization statistics, if the platform
                supports it. Defaults to on.
 
+disable_clat=bool Disable measurements of completion latency numbers. Useful
+               only for cutting back the number of calls to gettimeofday,
+               as that does impact performance at really high IOPS rates.
+               Note that to really get rid of a large amount of these
+               calls, this option must be used with disable_slat and
+               disable_bw as well.
+
+disable_slat=bool Disable measurements of submission latency numbers. See
+               disable_clat.
+
+disable_bw=bool        Disable measurements of throughput/bandwidth numbers. See
+               disable_clat.
+
 
 6.0 Interpreting the output
 ---------------------------
diff --git a/fio.h b/fio.h
index 1484749862d6aa181521e0719145674b3374ecfc..690afad607b9d0b39c1d69153063d4d99ad10f0e 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -496,6 +496,9 @@ struct thread_options {
        unsigned int zero_buffers;
        unsigned int refill_buffers;
        unsigned int time_based;
+       unsigned int disable_clat;
+       unsigned int disable_slat;
+       unsigned int disable_bw;
 
        char *read_iolog_file;
        char *write_iolog_file;
diff --git a/io_u.c b/io_u.c
index 08969427dd41b3753058b831987492e845ac27f5..62a76b9db9c4b98759fbb46f86231ea0c9ac9539 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -905,11 +905,16 @@ static void io_completed(struct thread_data *td, struct io_u *io_u,
                td->this_io_bytes[idx] += bytes;
 
                if (ramp_time_over(td)) {
-                       usec = utime_since(&io_u->issue_time, &icd->time);
+                       if (!td->o.disable_clat || !td->o.disable_bw)
+                               usec = utime_since(&io_u->issue_time,
+                                                       &icd->time);
 
-                       add_clat_sample(td, idx, usec);
-                       add_bw_sample(td, idx, &icd->time);
-                       io_u_mark_latency(td, usec);
+                       if (!td->o.disable_clat) {
+                               add_clat_sample(td, idx, usec);
+                               io_u_mark_latency(td, usec);
+                       }
+                       if (!td->o.disable_bw)
+                               add_bw_sample(td, idx, &icd->time);
                }
 
                if (td_write(td) && idx == DDIR_WRITE &&
@@ -930,9 +935,11 @@ static void io_completed(struct thread_data *td, struct io_u *io_u,
        }
 }
 
-static void init_icd(struct io_completion_data *icd, int nr)
+static void init_icd(struct thread_data *td, struct io_completion_data *icd,
+                    int nr)
 {
-       fio_gettime(&icd->time, NULL);
+       if (!td->o.disable_clat || !td->o.disable_bw)
+               fio_gettime(&icd->time, NULL);
 
        icd->nr = nr;
 
@@ -961,7 +968,7 @@ long io_u_sync_complete(struct thread_data *td, struct io_u *io_u)
 {
        struct io_completion_data icd;
 
-       init_icd(&icd, 1);
+       init_icd(td, &icd, 1);
        io_completed(td, io_u, &icd);
        put_io_u(td, io_u);
 
@@ -994,7 +1001,7 @@ long io_u_queued_complete(struct thread_data *td, int min_evts)
        } else if (!ret)
                return ret;
 
-       init_icd(&icd, ret);
+       init_icd(td, &icd, ret);
        ios_completed(td, &icd);
        if (!icd.error)
                return icd.bytes_done[0] + icd.bytes_done[1];
@@ -1008,10 +1015,12 @@ long io_u_queued_complete(struct thread_data *td, int min_evts)
  */
 void io_u_queued(struct thread_data *td, struct io_u *io_u)
 {
-       unsigned long slat_time;
+       if (!td->o.disable_slat) {
+               unsigned long slat_time;
 
-       slat_time = utime_since(&io_u->start_time, &io_u->issue_time);
-       add_slat_sample(td, io_u->ddir, slat_time);
+               slat_time = utime_since(&io_u->start_time, &io_u->issue_time);
+               add_slat_sample(td, io_u->ddir, slat_time);
+       }
 }
 
 /*
index 3ef0d032938a11062ba513fe5154ba9b6b04d678..9daeaab0bb6b599291f2dd1c24163323405cb501 100644 (file)
@@ -210,6 +210,15 @@ out:
        return r;
 }
 
+static inline int get_issue_time(struct thread_data *td)
+{
+       if (td->o.read_iolog_file ||
+           !td->o.disable_clat || !td->o.disable_slat || !td->o.disable_bw)
+               return 1;
+
+       return 0;
+}
+
 int td_io_queue(struct thread_data *td, struct io_u *io_u)
 {
        int ret;
@@ -226,7 +235,8 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u)
        io_u->resid = 0;
 
        if (td->io_ops->flags & FIO_SYNCIO) {
-               fio_gettime(&io_u->issue_time, NULL);
+               if (get_issue_time(td))
+                       fio_gettime(&io_u->issue_time, NULL);
 
                /*
                 * only used for iolog
@@ -269,7 +279,8 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u)
        }
 
        if ((td->io_ops->flags & FIO_SYNCIO) == 0) {
-               fio_gettime(&io_u->issue_time, NULL);
+               if (get_issue_time(td))
+                       fio_gettime(&io_u->issue_time, NULL);
 
                /*
                 * only used for iolog
index 8723adff589321729e5501d458174ccdef5ad830..d4fc18489683c5522edf5d825f0d8fb2ba400f42 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1290,6 +1290,27 @@ static struct fio_option options[] = {
                .def    = "1",
        },
 #endif
+       {
+               .name   = "disable_clat",
+               .type   = FIO_OPT_BOOL,
+               .off1   = td_var_offset(disable_clat),
+               .help   = "Disable completion latency numbers",
+               .def    = "0",
+       },
+       {
+               .name   = "disable_slat",
+               .type   = FIO_OPT_BOOL,
+               .off1   = td_var_offset(disable_slat),
+               .help   = "Disable submissionn latency numbers",
+               .def    = "0",
+       },
+       {
+               .name   = "disable_bw_measurement",
+               .type   = FIO_OPT_BOOL,
+               .off1   = td_var_offset(disable_bw),
+               .help   = "Disable bandwidth logging",
+               .def    = "0",
+       },
        {
                .name = NULL,
        },