Include transfer size in the clat/slat measurements
authorJens Axboe <jens.axboe@oracle.com>
Mon, 18 May 2009 11:08:12 +0000 (13:08 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 18 May 2009 11:08:12 +0000 (13:08 +0200)
It's useful to know the block size that matches the given latency, so
add that to the end.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
eta.c
fio.h
io_u.c
log.c
stat.c

diff --git a/eta.c b/eta.c
index 1c809eede5711dca2502cca46ac181fb2fb1ddec..5a5188f1378d9010ed8f8576cfd3c2f56dc0168c 100644 (file)
--- a/eta.c
+++ b/eta.c
@@ -296,8 +296,8 @@ void print_thread_status(void)
        if (write_bw_log && rate_time > bw_avg_time && !in_ramp_time(td)) {
                calc_rate(rate_time, io_bytes, rate_io_bytes, rate);
                memcpy(&rate_prev_time, &now, sizeof(now));
        if (write_bw_log && rate_time > bw_avg_time && !in_ramp_time(td)) {
                calc_rate(rate_time, io_bytes, rate_io_bytes, rate);
                memcpy(&rate_prev_time, &now, sizeof(now));
-               add_agg_sample(rate[DDIR_READ], DDIR_READ);
-               add_agg_sample(rate[DDIR_WRITE], DDIR_WRITE);
+               add_agg_sample(rate[DDIR_READ], DDIR_READ, 0);
+               add_agg_sample(rate[DDIR_WRITE], DDIR_WRITE, 0);
        }
 
        disp_time = mtime_since(&disp_prev_time, &now);
        }
 
        disp_time = mtime_since(&disp_prev_time, &now);
diff --git a/fio.h b/fio.h
index f5786ea69a1d5500d4cb9a73d24cf7e6a7f42b0a..1ccc862e4a59ed455f40ef72fc2d5fad1be67382 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -75,6 +75,7 @@ struct io_sample {
        unsigned long time;
        unsigned long val;
        enum fio_ddir ddir;
        unsigned long time;
        unsigned long val;
        enum fio_ddir ddir;
+       unsigned int bs;
 };
 
 /*
 };
 
 /*
@@ -810,9 +811,12 @@ extern void write_iolog_close(struct thread_data *);
 /*
  * Logging
  */
 /*
  * Logging
  */
-extern void add_clat_sample(struct thread_data *, enum fio_ddir, unsigned long);
-extern void add_slat_sample(struct thread_data *, enum fio_ddir, unsigned long);
-extern void add_bw_sample(struct thread_data *, enum fio_ddir, struct timeval *);
+extern void add_clat_sample(struct thread_data *, enum fio_ddir, unsigned long,
+                               unsigned int);
+extern void add_slat_sample(struct thread_data *, enum fio_ddir, unsigned long,
+                               unsigned int);
+extern void add_bw_sample(struct thread_data *, enum fio_ddir, unsigned int,
+                               struct timeval *);
 extern void show_run_stats(void);
 extern void init_disk_util(struct thread_data *);
 extern void update_rusage_stat(struct thread_data *);
 extern void show_run_stats(void);
 extern void init_disk_util(struct thread_data *);
 extern void update_rusage_stat(struct thread_data *);
@@ -823,7 +827,7 @@ extern void finish_log_named(struct thread_data *, struct io_log *, const char *
 extern void __finish_log(struct io_log *, const char *);
 extern struct io_log *agg_io_log[2];
 extern int write_bw_log;
 extern void __finish_log(struct io_log *, const char *);
 extern struct io_log *agg_io_log[2];
 extern int write_bw_log;
-extern void add_agg_sample(unsigned long, enum fio_ddir);
+extern void add_agg_sample(unsigned long, enum fio_ddir, unsigned int);
 
 /*
  * Time functions
 
 /*
  * Time functions
diff --git a/io_u.c b/io_u.c
index 8c2f33b5e85e1e16bb3d6aea7564cbd5181a5e62..fc49bd325879f01d63c53efaaff25cc0e34e63e2 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -917,11 +917,11 @@ static void io_completed(struct thread_data *td, struct io_u *io_u,
                                                        &icd->time);
 
                        if (!td->o.disable_clat) {
                                                        &icd->time);
 
                        if (!td->o.disable_clat) {
-                               add_clat_sample(td, idx, usec);
+                               add_clat_sample(td, idx, usec, bytes);
                                io_u_mark_latency(td, usec);
                        }
                        if (!td->o.disable_bw)
                                io_u_mark_latency(td, usec);
                        }
                        if (!td->o.disable_bw)
-                               add_bw_sample(td, idx, &icd->time);
+                               add_bw_sample(td, idx, bytes, &icd->time);
                }
 
                if (td_write(td) && idx == DDIR_WRITE &&
                }
 
                if (td_write(td) && idx == DDIR_WRITE &&
@@ -1026,7 +1026,7 @@ void io_u_queued(struct thread_data *td, struct io_u *io_u)
                unsigned long slat_time;
 
                slat_time = utime_since(&io_u->start_time, &io_u->issue_time);
                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);
+               add_slat_sample(td, io_u->ddir, io_u->xfer_buflen, slat_time);
        }
 }
 
        }
 }
 
diff --git a/log.c b/log.c
index 6913357c73f2cc1aa4de41ef69e6c12b61f36776..6d5e68da580b5ac72d3dfde8c47c3df85ae722f4 100644 (file)
--- a/log.c
+++ b/log.c
@@ -471,8 +471,10 @@ void __finish_log(struct io_log *log, const char *name)
        }
 
        for (i = 0; i < log->nr_samples; i++) {
        }
 
        for (i = 0; i < log->nr_samples; i++) {
-               fprintf(f, "%lu, %lu, %u\n", log->log[i].time, log->log[i].val,
-                                               log->log[i].ddir);
+               fprintf(f, "%lu, %lu, %u, %u\n", log->log[i].time,
+                                               log->log[i].val,
+                                               log->log[i].ddir,
+                                               log->log[i].bs);
        }
 
        fclose(f);
        }
 
        fclose(f);
diff --git a/stat.c b/stat.c
index beeceb7359372c51616dc10b898311cd2edfb90e..a42ed98843bbf6b4d892d0fc6bd1b1af9f2c2e6c 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -700,8 +700,11 @@ static inline void add_stat_sample(struct io_stat *is, unsigned long data)
 }
 
 static void __add_log_sample(struct io_log *iolog, unsigned long val,
 }
 
 static void __add_log_sample(struct io_log *iolog, unsigned long val,
-                            enum fio_ddir ddir, unsigned long time)
+                            enum fio_ddir ddir, unsigned int bs,
+                            unsigned long time)
 {
 {
+       const int nr_samples = iolog->nr_samples;
+
        if (iolog->nr_samples == iolog->max_samples) {
                int new_size = sizeof(struct io_sample) * iolog->max_samples*2;
 
        if (iolog->nr_samples == iolog->max_samples) {
                int new_size = sizeof(struct io_sample) * iolog->max_samples*2;
 
@@ -709,48 +712,50 @@ static void __add_log_sample(struct io_log *iolog, unsigned long val,
                iolog->max_samples <<= 1;
        }
 
                iolog->max_samples <<= 1;
        }
 
-       iolog->log[iolog->nr_samples].val = val;
-       iolog->log[iolog->nr_samples].time = time;
-       iolog->log[iolog->nr_samples].ddir = ddir;
+       iolog->log[nr_samples].val = val;
+       iolog->log[nr_samples].time = time;
+       iolog->log[nr_samples].ddir = ddir;
+       iolog->log[nr_samples].bs = bs;
        iolog->nr_samples++;
 }
 
 static void add_log_sample(struct thread_data *td, struct io_log *iolog,
        iolog->nr_samples++;
 }
 
 static void add_log_sample(struct thread_data *td, struct io_log *iolog,
-                          unsigned long val, enum fio_ddir ddir)
+                          unsigned long val, enum fio_ddir ddir,
+                          unsigned int bs)
 {
 {
-       __add_log_sample(iolog, val, ddir, mtime_since_now(&td->epoch));
+       __add_log_sample(iolog, val, ddir, bs, mtime_since_now(&td->epoch));
 }
 
 }
 
-void add_agg_sample(unsigned long val, enum fio_ddir ddir)
+void add_agg_sample(unsigned long val, enum fio_ddir ddir, unsigned int bs)
 {
        struct io_log *iolog = agg_io_log[ddir];
 
 {
        struct io_log *iolog = agg_io_log[ddir];
 
-       __add_log_sample(iolog, val, ddir, mtime_since_genesis());
+       __add_log_sample(iolog, val, ddir, bs, mtime_since_genesis());
 }
 
 void add_clat_sample(struct thread_data *td, enum fio_ddir ddir,
 }
 
 void add_clat_sample(struct thread_data *td, enum fio_ddir ddir,
-                    unsigned long usec)
+                    unsigned long usec, unsigned int bs)
 {
        struct thread_stat *ts = &td->ts;
 
        add_stat_sample(&ts->clat_stat[ddir], usec);
 
        if (ts->clat_log)
 {
        struct thread_stat *ts = &td->ts;
 
        add_stat_sample(&ts->clat_stat[ddir], usec);
 
        if (ts->clat_log)
-               add_log_sample(td, ts->clat_log, usec, ddir);
+               add_log_sample(td, ts->clat_log, usec, ddir, bs);
 }
 
 void add_slat_sample(struct thread_data *td, enum fio_ddir ddir,
 }
 
 void add_slat_sample(struct thread_data *td, enum fio_ddir ddir,
-                    unsigned long usec)
+                    unsigned long usec, unsigned int bs)
 {
        struct thread_stat *ts = &td->ts;
 
        add_stat_sample(&ts->slat_stat[ddir], usec);
 
        if (ts->slat_log)
 {
        struct thread_stat *ts = &td->ts;
 
        add_stat_sample(&ts->slat_stat[ddir], usec);
 
        if (ts->slat_log)
-               add_log_sample(td, ts->slat_log, usec, ddir);
+               add_log_sample(td, ts->slat_log, usec, ddir, bs);
 }
 
 }
 
-void add_bw_sample(struct thread_data *td, enum fio_ddir ddir,
+void add_bw_sample(struct thread_data *td, enum fio_ddir ddir, unsigned int bs,
                   struct timeval *t)
 {
        struct thread_stat *ts = &td->ts;
                   struct timeval *t)
 {
        struct thread_stat *ts = &td->ts;
@@ -764,7 +769,7 @@ void add_bw_sample(struct thread_data *td, enum fio_ddir ddir,
        add_stat_sample(&ts->bw_stat[ddir], rate);
 
        if (ts->bw_log)
        add_stat_sample(&ts->bw_stat[ddir], rate);
 
        if (ts->bw_log)
-               add_log_sample(td, ts->bw_log, rate, ddir);
+               add_log_sample(td, ts->bw_log, rate, ddir, bs);
 
        fio_gettime(&ts->stat_sample_time[ddir], NULL);
        ts->stat_io_bytes[ddir] = td->this_io_bytes[ddir];
 
        fio_gettime(&ts->stat_sample_time[ddir], NULL);
        ts->stat_io_bytes[ddir] = td->this_io_bytes[ddir];