From 6e745d32cd55b4e3724522b0b629989232feff6c Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 8 Dec 2005 14:43:19 +0100 Subject: [PATCH] [PATCH] fio: log clat and slat seperately, and add data direction as well --- fio-ini.c | 8 +++++--- fio.c | 20 +++++++++++++------- fio.h | 4 +++- fio_generate_plots | 37 +++++++++++++++++++++++++++++-------- 4 files changed, 50 insertions(+), 19 deletions(-) diff --git a/fio-ini.c b/fio-ini.c index 3a66830..549be0e 100644 --- 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 2d850b7..6f122c9 100644 --- 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 db97140..dbce4af 100644 --- 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 */ diff --git a/fio_generate_plots b/fio_generate_plots index 6321c34..f410efe 100755 --- a/fio_generate_plots +++ b/fio_generate_plots @@ -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 -- 2.25.1