YAMAMOTO Takashi | 40cfddb | 2010-06-02 08:24:03 +0200 | [diff] [blame] | 1 | #! /bin/sh |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 2 | |
| 3 | # Use gnuplot to generate plots from fio run with -l and/or -w |
| 4 | |
YAMAMOTO Takashi | 40cfddb | 2010-06-02 08:24:03 +0200 | [diff] [blame] | 5 | if [ "$1"x = "x" ]; then |
Martin Steigerwald | 4d1577b | 2011-08-05 19:47:51 +0200 | [diff] [blame] | 6 | echo "Usage: fio_generate_plots title [xres yres]" |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 7 | exit 1 |
| 8 | fi |
| 9 | |
Jens Axboe | 1618495 | 2006-06-12 10:28:06 +0200 | [diff] [blame] | 10 | GNUPLOT=$(which gnuplot) |
| 11 | if [ ! -x $GNUPLOT ]; then |
| 12 | echo You need gnuplot installed to generate graphs |
| 13 | exit 1 |
| 14 | fi |
| 15 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 16 | TITLE=$1 |
| 17 | |
Martin Steigerwald | 4d1577b | 2011-08-05 19:47:51 +0200 | [diff] [blame] | 18 | # set resolution |
| 19 | if [ "$2"x != "x" -a "$3"x != "x" ]; then |
| 20 | XRES="$2" |
| 21 | YRES="$3" |
| 22 | else |
| 23 | XRES=1024 |
| 24 | YRES=768 |
| 25 | fi |
| 26 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 27 | PLOT_LINE="" |
| 28 | for i in *bw.log; do |
| 29 | if [ ! -r $i ]; then |
| 30 | continue |
| 31 | fi |
Jens Axboe | 84f8317 | 2008-04-04 23:15:19 +0200 | [diff] [blame] | 32 | PT=$(echo $i | sed s/_bw.log//g) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 33 | if [ "$PLOT_LINE"x != "x" ]; then |
| 34 | PLOT_LINE=$PLOT_LINE", " |
| 35 | fi |
| 36 | |
Jens Axboe | 84f8317 | 2008-04-04 23:15:19 +0200 | [diff] [blame] | 37 | PLOT_LINE=$PLOT_LINE"'$i' title '$PT' with lines" |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 38 | done |
| 39 | |
| 40 | if [ "$PLOT_LINE"x != "x" ]; then |
| 41 | echo Making bw logs |
Martin Steigerwald | 4d1577b | 2011-08-05 19:47:51 +0200 | [diff] [blame] | 42 | echo "set title 'Bandwidth - $TITLE'; set xlabel 'time (msec)'; set ylabel 'KB/sec'; set terminal png size $XRES,$YRES; set output '$TITLE-bw.png'; plot " $PLOT_LINE | $GNUPLOT - |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 43 | fi |
| 44 | |
| 45 | PLOT_LINE="" |
Jens Axboe | c8eeb9d | 2011-10-05 14:02:22 +0200 | [diff] [blame] | 46 | for i in *iops.log; do |
| 47 | if [ ! -r $i ]; then |
| 48 | continue |
| 49 | fi |
| 50 | PT=$(echo $i | sed s/_iops.log//g) |
| 51 | if [ "$PLOT_LINE"x != "x" ]; then |
| 52 | PLOT_LINE=$PLOT_LINE", " |
| 53 | fi |
| 54 | |
| 55 | PLOT_LINE=$PLOT_LINE"'$i' title '$PT' with lines" |
| 56 | done |
| 57 | |
| 58 | if [ "$PLOT_LINE"x != "x" ]; then |
| 59 | echo Making bw logs |
| 60 | echo "set title 'IOPS - $TITLE'; set xlabel 'time (msec)'; set ylabel 'IOPS'; set terminal png size $XRES,$YRES; set output '$TITLE-IOPS.png'; plot " $PLOT_LINE | $GNUPLOT - |
| 61 | fi |
| 62 | |
| 63 | PLOT_LINE="" |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 64 | for i in *slat.log; do |
| 65 | if [ ! -r $i ]; then |
| 66 | continue |
| 67 | fi |
Jens Axboe | 84f8317 | 2008-04-04 23:15:19 +0200 | [diff] [blame] | 68 | PT=$(echo $i | sed s/_slat.log//g) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 69 | if [ "$PLOT_LINE"x != "x" ]; then |
| 70 | PLOT_LINE=$PLOT_LINE", " |
| 71 | fi |
| 72 | |
Jens Axboe | 84f8317 | 2008-04-04 23:15:19 +0200 | [diff] [blame] | 73 | PLOT_LINE=$PLOT_LINE"'$i' title '$PT' with lines" |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 74 | done |
| 75 | |
| 76 | if [ "$PLOT_LINE"x != "x" ]; then |
| 77 | echo Making slat logs $PLOT_LINE |
Martin Steigerwald | 4d1577b | 2011-08-05 19:47:51 +0200 | [diff] [blame] | 78 | echo "set title 'Submission latency - $TITLE'; set xlabel 'time (msec)'; set ylabel 'latency (msec)'; set terminal png size $XRES,$YRES; set output '$TITLE-slat.png'; plot " $PLOT_LINE | $GNUPLOT - |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 79 | fi |
| 80 | |
| 81 | PLOT_LINE="" |
| 82 | for i in *clat.log; do |
| 83 | if [ ! -r $i ]; then |
| 84 | continue |
| 85 | fi |
Jens Axboe | 84f8317 | 2008-04-04 23:15:19 +0200 | [diff] [blame] | 86 | PT=$(echo $i | sed s/_clat.log//g) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 87 | if [ "$PLOT_LINE"x != "x" ]; then |
| 88 | PLOT_LINE=$PLOT_LINE", " |
| 89 | fi |
| 90 | |
Jens Axboe | 84f8317 | 2008-04-04 23:15:19 +0200 | [diff] [blame] | 91 | PLOT_LINE=$PLOT_LINE"'$i' title '$PT' with lines" |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 92 | done |
| 93 | |
| 94 | if [ "$PLOT_LINE"x != "x" ]; then |
| 95 | echo Making clat logs $PLOT_LINE |
Martin Steigerwald | 4d1577b | 2011-08-05 19:47:51 +0200 | [diff] [blame] | 96 | echo "set title 'Completion latency - $TITLE'; set xlabel 'time (msec)'; set ylabel 'latency (msec)'; set terminal png size $XRES,$YRES; set output '$TITLE-clat.png'; plot " $PLOT_LINE | $GNUPLOT - |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 97 | fi |
Jens Axboe | 02af098 | 2010-06-24 09:59:34 +0200 | [diff] [blame] | 98 | |
| 99 | PLOT_LINE="" |
| 100 | for i in *_lat.log; do |
| 101 | if [ ! -r $i ]; then |
| 102 | continue |
| 103 | fi |
| 104 | PT=$(echo $i | sed s/_lat.log//g) |
| 105 | if [ "$PLOT_LINE"x != "x" ]; then |
| 106 | PLOT_LINE=$PLOT_LINE", " |
| 107 | fi |
| 108 | |
| 109 | PLOT_LINE=$PLOT_LINE"'$i' title '$PT' with lines" |
| 110 | done |
| 111 | |
| 112 | if [ "$PLOT_LINE"x != "x" ]; then |
| 113 | echo Making lat logs $PLOT_LINE |
Martin Steigerwald | 4d1577b | 2011-08-05 19:47:51 +0200 | [diff] [blame] | 114 | echo "set title 'Latency - $TITLE'; set xlabel 'time (msec)'; set ylabel 'latency (msec)'; set terminal png size $XRES,$YRES; set output '$TITLE-lat.png'; plot " $PLOT_LINE | $GNUPLOT - |
Jens Axboe | 02af098 | 2010-06-24 09:59:34 +0200 | [diff] [blame] | 115 | fi |