Add disk utilization to terse format output
authorJens Axboe <axboe@kernel.dk>
Thu, 13 Oct 2011 12:03:52 +0000 (14:03 +0200)
committerJens Axboe <axboe@kernel.dk>
Thu, 13 Oct 2011 12:03:52 +0000 (14:03 +0200)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
HOWTO
SERVER-TODO
client.c
diskutil.c
diskutil.h
fio.1
stat.c

diff --git a/HOWTO b/HOWTO
index a0d244b..a8d5197 100644 (file)
--- a/HOWTO
+++ b/HOWTO
@@ -1379,6 +1379,11 @@ Split up, the format is as follows:
        IO depths: <=1, 2, 4, 8, 16, 32, >=64
        IO latencies microseconds: <=2, 4, 10, 20, 50, 100, 250, 500, 750, 1000
        IO latencies milliseconds: <=2, 4, 10, 20, 50, 100, 250, 500, 750, 1000, 2000, >=2000
+       Disk utilization: Disk name, Read ios, write ios,
+                         Read merges, write merges,
+                         Read ticks, write ticks,
+                         Read in-queue time, write in-queue time,
+                         Disk utilization percentage
        Additional Info (dependant on continue_on_error, default off): total # errors, first error code 
        
        Additional Info (dependant on description being set): Text description
@@ -1390,6 +1395,9 @@ for the terse output fio writes all of them. Each field will look like this:
 
 which is the Xth percentile, and the usec latency associated with it.
 
+For disk utilization, all disks used by fio are shown. So for each disk
+there will be a disk utilization section.
+
 
 8.0 Trace file format
 ---------------------
index 3005383..b988405 100644 (file)
@@ -1,6 +1,2 @@
-- Bump terse version format:
-       - Add disk stats
-       - Add IOPS
-       - Add clat percentiles
 - Collate ETA output from multiple connections into 1
 - If group_reporting is set, collate final output from multiple connections
index 56accf0..c72f034 100644 (file)
--- a/client.c
+++ b/client.c
@@ -647,7 +647,7 @@ static void handle_du(struct fio_client *client, struct fio_net_cmd *cmd)
                log_info("\nDisk stats (read/write):\n");
        }
 
-       print_disk_util(&du->dus, &du->agg);
+       print_disk_util(&du->dus, &du->agg, terse_output);
 }
 
 static void convert_jobs_eta(struct jobs_eta *je)
index 67c47bc..24e1782 100644 (file)
@@ -453,21 +453,33 @@ void init_disk_util(struct thread_data *td)
                f->du = __init_disk_util(td, f);
 }
 
-static void show_agg_stats(struct disk_util_agg *agg)
+static void show_agg_stats(struct disk_util_agg *agg, int terse)
 {
        if (!agg->slavecount)
                return;
 
-       log_info(", aggrios=%u/%u, aggrmerge=%u/%u, aggrticks=%u/%u,"
-                       " aggrin_queue=%u, aggrutil=%3.2f%%",
-                       agg->ios[0] / agg->slavecount,
-                       agg->ios[1] / agg->slavecount,
-                       agg->merges[0] / agg->slavecount,
-                       agg->merges[1] / agg->slavecount,
-                       agg->ticks[0] / agg->slavecount,
-                       agg->ticks[1] / agg->slavecount,
-                       agg->time_in_queue / agg->slavecount,
-                       agg->max_util.u.f);
+       if (!terse) {
+               log_info(", aggrios=%u/%u, aggrmerge=%u/%u, aggrticks=%u/%u,"
+                               " aggrin_queue=%u, aggrutil=%3.2f%%",
+                               agg->ios[0] / agg->slavecount,
+                               agg->ios[1] / agg->slavecount,
+                               agg->merges[0] / agg->slavecount,
+                               agg->merges[1] / agg->slavecount,
+                               agg->ticks[0] / agg->slavecount,
+                               agg->ticks[1] / agg->slavecount,
+                               agg->time_in_queue / agg->slavecount,
+                               agg->max_util.u.f);
+       } else {
+               log_info("slaves;%u;%u;%u;%u;%u;%u;%u;%3.2f%%",
+                               agg->ios[0] / agg->slavecount,
+                               agg->ios[1] / agg->slavecount,
+                               agg->merges[0] / agg->slavecount,
+                               agg->merges[1] / agg->slavecount,
+                               agg->ticks[0] / agg->slavecount,
+                               agg->ticks[1] / agg->slavecount,
+                               agg->time_in_queue / agg->slavecount,
+                               agg->max_util.u.f);
+       }
 }
 
 static void aggregate_slaves_stats(struct disk_util *masterdu)
@@ -518,7 +530,8 @@ void free_disk_util(void)
        last_majdev = last_mindev = -1;
 }
 
-void print_disk_util(struct disk_util_stat *dus, struct disk_util_agg *agg)
+void print_disk_util(struct disk_util_stat *dus, struct disk_util_agg *agg,
+                    int terse)
 {
        double util;
 
@@ -529,24 +542,33 @@ void print_disk_util(struct disk_util_stat *dus, struct disk_util_agg *agg)
        if (agg->slavecount)
                log_info("  ");
 
-       log_info("  %s: ios=%u/%u, merge=%u/%u, ticks=%u/%u, "
-                "in_queue=%u, util=%3.2f%%", dus->name,
+       if (!terse) {
+               log_info("  %s: ios=%u/%u, merge=%u/%u, ticks=%u/%u, "
+                        "in_queue=%u, util=%3.2f%%", dus->name,
                                        dus->ios[0], dus->ios[1],
                                        dus->merges[0], dus->merges[1],
                                        dus->ticks[0], dus->ticks[1],
                                        dus->time_in_queue, util);
+       } else {
+               log_info(";%s;%u;%u;%u;%u;%lu;%lu;%u;%u;%u;%u;%3.2f%%",
+                                       dus->name, dus->ios[0], dus->ios[1],
+                                       dus->merges[0], dus->merges[1],
+                                       dus->ticks[0], dus->ticks[1],
+                                       dus->time_in_queue, util);
+       }
 
        /*
         * If the device has slaves, aggregate the stats for
         * those slave devices also.
         */
        if (agg->slavecount)
-               show_agg_stats(agg);
+               show_agg_stats(agg, terse);
 
-       log_info("\n");
+       if (!terse)
+               log_info("\n");
 }
 
-void show_disk_util(void)
+void show_disk_util(int terse)
 {
        struct flist_head *entry;
        struct disk_util *du;
@@ -554,12 +576,13 @@ void show_disk_util(void)
        if (flist_empty(&disk_list))
                return;
 
-       log_info("\nDisk stats (read/write):\n");
+       if (!terse)
+               log_info("\nDisk stats (read/write):\n");
 
        flist_for_each(entry, &disk_list) {
                du = flist_entry(entry, struct disk_util, list);
 
                aggregate_slaves_stats(du);
-               print_disk_util(&du->dus, &du->agg);
+               print_disk_util(&du->dus, &du->agg, terse);
        }
 }
index 49c56ae..5a9b079 100644 (file)
@@ -98,14 +98,14 @@ extern struct flist_head disk_list;
  * disk util stuff
  */
 #ifdef FIO_HAVE_DISK_UTIL
-extern void print_disk_util(struct disk_util_stat *, struct disk_util_agg *);
-extern void show_disk_util(void);
+extern void print_disk_util(struct disk_util_stat *, struct disk_util_agg *, int terse);
+extern void show_disk_util(int terse);
 extern void free_disk_util(void);
 extern void init_disk_util(struct thread_data *);
 extern void update_io_ticks(void);
 #else
-#define print_disk_util(dus, agg)
-#define show_disk_util()
+#define print_disk_util(dus, agg, terse)
+#define show_disk_util(terse)
 #define free_disk_util()
 #define init_disk_util(td)
 #define update_io_ticks()
diff --git a/fio.1 b/fio.1
index ce08ff2..9f4b4a9 100644 (file)
--- a/fio.1
+++ b/fio.1
@@ -1176,6 +1176,11 @@ Milliseconds:
 .RE
 .RE
 .P
+Disk utilization (1 for each disk used):
+.RS
+.B name, read ios, write ios, read merges, write merges, read ticks, write ticks, read in-queue time, write in-queue time, disk utilization percentage
+.RE
+.P
 Error Info (dependent on continue_on_error, default off):
 .RS
 .B total # errors, first error code 
diff --git a/stat.c b/stat.c
index 1c4491b..558464f 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -691,6 +691,10 @@ static void show_thread_status_terse(struct thread_stat *ts,
        /* Millisecond latency */
        for (i = 0; i < FIO_IO_U_LAT_M_NR; i++)
                log_info(";%3.2f%%", io_u_lat_m[i]);
+
+       /* disk util stats, if any */
+       show_disk_util(1);
+
        /* Additional output if continue_on_error set - default off*/
        if (ts->continue_on_error)
                log_info(";%lu;%d", ts->total_err_count, ts->first_error);
@@ -1006,7 +1010,7 @@ void show_run_stats(void)
                if (is_backend)
                        fio_server_send_du();
                else
-                       show_disk_util();
+                       show_disk_util(0);
 
                free_disk_util();
        }