[PATCH] fio: log clat and slat seperately, and add data direction as well
authorJens Axboe <axboe@suse.de>
Thu, 8 Dec 2005 13:43:19 +0000 (14:43 +0100)
committerJens Axboe <axboe@suse.de>
Thu, 8 Dec 2005 13:43:19 +0000 (14:43 +0100)
fio-ini.c
fio.c
fio.h
fio_generate_plots

index 3a668306994bc354be0c2fc66262823e3bfd6d14..549be0ec5791ff5b6021848c1cd6249dd13ac4ae 100644 (file)
--- a/fio-ini.c
+++ b/fio-ini.c
@@ -91,7 +91,7 @@ void finish_log(struct thread_data *td, struct io_log *log, const char *name)
        }
 
        for (i = 0; i < log->nr_samples; i++)
-               fprintf(f, "%lu, %lu\n", log->log[i].time, log->log[i].val);
+               fprintf(f, "%lu, %lu, %u\n", log->log[i].time, log->log[i].val, log->log[i].ddir);
 
        fclose(f);
        free(log->log);
@@ -226,8 +226,10 @@ static int add_job(struct thread_data *td, const char *jobname, int prioclass,
        if (setup_rate(td))
                goto err;
 
-       if (write_lat_log)
-               setup_log(&td->lat_log);
+       if (write_lat_log) {
+               setup_log(&td->slat_log);
+               setup_log(&td->clat_log);
+       }
        if (write_bw_log)
                setup_log(&td->bw_log);
 
diff --git a/fio.c b/fio.c
index 2d850b7f7ee41a602ae3d5eb89e9475215242047..6f122c9bbd0c68692df441d3c1edcf317145771e 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -272,7 +272,7 @@ static inline void add_stat_sample(struct io_stat *is, unsigned long val)
 }
 
 static void add_log_sample(struct thread_data *td, struct io_log *iolog,
-                          unsigned long val)
+                          unsigned long val, int ddir)
 {
        if (iolog->nr_samples == iolog->max_samples) {
                int new_size = sizeof(struct io_sample) * iolog->max_samples*2;
@@ -282,7 +282,8 @@ static void add_log_sample(struct thread_data *td, struct io_log *iolog,
        }
 
        iolog->log[iolog->nr_samples].val = val;
-       iolog->log[iolog->nr_samples].time = mtime_since_now(&td->start);
+       iolog->log[iolog->nr_samples].time = mtime_since_now(&td->epoch);
+       iolog->log[iolog->nr_samples].ddir = ddir;
        iolog->nr_samples++;
 }
 
@@ -290,13 +291,16 @@ static void add_clat_sample(struct thread_data *td, int ddir,unsigned long msec)
 {
        add_stat_sample(&td->clat_stat[ddir], msec);
 
-       if (td->lat_log)
-               add_log_sample(td, td->lat_log, msec);
+       if (td->clat_log)
+               add_log_sample(td, td->clat_log, msec, ddir);
 }
 
 static void add_slat_sample(struct thread_data *td, int ddir,unsigned long msec)
 {
        add_stat_sample(&td->slat_stat[ddir], msec);
+
+       if (td->slat_log)
+               add_log_sample(td, td->slat_log, msec, ddir);
 }
 
 static void add_bw_sample(struct thread_data *td, int ddir)
@@ -311,7 +315,7 @@ static void add_bw_sample(struct thread_data *td, int ddir)
        add_stat_sample(&td->bw_stat[ddir], rate);
 
        if (td->bw_log)
-               add_log_sample(td, td->bw_log, rate);
+               add_log_sample(td, td->bw_log, rate, ddir);
 
        gettimeofday(&td->stat_sample_time[ddir], NULL);
        td->stat_io_bytes[ddir] = td->this_io_bytes[ddir];
@@ -1705,8 +1709,10 @@ static void *thread_main(void *data)
 
        if (td->bw_log)
                finish_log(td, td->bw_log, "bw");
-       if (td->lat_log)
-               finish_log(td, td->lat_log, "lat");
+       if (td->slat_log)
+               finish_log(td, td->slat_log, "slat");
+       if (td->clat_log)
+               finish_log(td, td->clat_log, "clat");
 
        if (exitall_on_terminate)
                terminate_threads(td->groupid);
diff --git a/fio.h b/fio.h
index db9714070b935a243d549783a1fe074e90c433e5..dbce4af347ec34ae85d93b0e2242256c5f957b39 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -25,6 +25,7 @@ struct io_stat {
 struct io_sample {
        unsigned long time;
        unsigned long val;
+       unsigned int ddir;
 };
 
 struct io_log {
@@ -195,7 +196,8 @@ struct thread_data {
        unsigned long stat_io_bytes[2];
        struct timeval stat_sample_time[2];
 
-       struct io_log *lat_log;
+       struct io_log *slat_log;
+       struct io_log *clat_log;
        struct io_log *bw_log;
 
        struct timeval start;   /* start of this loop */
index 6321c341ab1f195b8381367917c7cb80b0856d6d..f410efe2b50c30b194d9892891693d690393698b 100755 (executable)
@@ -11,6 +11,9 @@ TITLE=$1
 
 PLOT_LINE=""
 for i in *bw.log; do
+       if [ ! -r $i ]; then
+               continue
+       fi
        if [ "$PLOT_LINE"x != "x" ]; then
                PLOT_LINE=$PLOT_LINE", "
        fi
@@ -18,14 +21,16 @@ for i in *bw.log; do
        PLOT_LINE=$PLOT_LINE"'$i' with lines"
 done
 
-if [ "$PLOT_LINE"x == "x" ]; then
-       exit 0
+if [ "$PLOT_LINE"x != "x" ]; then
+       echo Making bw logs
+       echo "set title 'Bandwidth - $TITLE'; set xlabel 'time (msec)'; set ylabel 'KiB/sec'; set terminal png; set output '$TITLE-bw.png'; plot " $PLOT_LINE | gnuplot -
 fi
 
-echo "set title 'Bandwidth - $TITLE'; set xlabel 'time (msec)'; set ylabel 'KiB/sec'; set terminal png; set output '$TITLE-bw.png'; plot " $PLOT_LINE | gnuplot -
-
 PLOT_LINE=""
-for i in *lat.log; do
+for i in *slat.log; do
+       if [ ! -r $i ]; then
+               continue
+       fi
        if [ "$PLOT_LINE"x != "x" ]; then
                PLOT_LINE=$PLOT_LINE", "
        fi
@@ -33,8 +38,24 @@ for i in *lat.log; do
        PLOT_LINE=$PLOT_LINE"'$i' with lines"
 done
 
-if [ "$PLOT_LINE"x == "x" ]; then
-       exit 0
+if [ "$PLOT_LINE"x != "x" ]; then
+       echo Making slat logs $PLOT_LINE
+       echo "set title 'Submission latency - $TITLE'; set xlabel 'time (msec)'; set ylabel 'latency (msec)'; set terminal png; set output '$TITLE-slat.png'; plot " $PLOT_LINE | gnuplot -
 fi
 
-echo "set title 'Latency - $TITLE'; set xlabel 'time (msec)'; set ylabel 'latency (msec)'; set terminal png; set output '$TITLE-lat.png'; plot " $PLOT_LINE | gnuplot -
+PLOT_LINE=""
+for i in *clat.log; do
+       if [ ! -r $i ]; then
+               continue
+       fi
+       if [ "$PLOT_LINE"x != "x" ]; then
+               PLOT_LINE=$PLOT_LINE", "
+       fi
+
+       PLOT_LINE=$PLOT_LINE"'$i' with lines"
+done
+
+if [ "$PLOT_LINE"x != "x" ]; then
+       echo Making clat logs $PLOT_LINE
+       echo "set title 'Completion latency - $TITLE'; set xlabel 'time (msec)'; set ylabel 'latency (msec)'; set terminal png; set output '$TITLE-clat.png'; plot " $PLOT_LINE | gnuplot -
+fi