Solaris: support for proper random functions
[fio.git] / fio_generate_plots
1 #!/bin/bash
2
3 # Use gnuplot to generate plots from fio run with -l and/or -w
4
5 if [ "$1"x == "x" ]; then
6         echo Need title as arg
7         exit 1
8 fi
9
10 GNUPLOT=$(which gnuplot)
11 if [ ! -x $GNUPLOT ]; then
12         echo You need gnuplot installed to generate graphs
13         exit 1
14 fi
15
16 TITLE=$1
17
18 PLOT_LINE=""
19 for i in *bw.log; do
20         if [ ! -r $i ]; then
21                 continue
22         fi
23         PT=$(echo $i | sed s/_bw.log//g)
24         if [ "$PLOT_LINE"x != "x" ]; then
25                 PLOT_LINE=$PLOT_LINE", "
26         fi
27
28         PLOT_LINE=$PLOT_LINE"'$i' title '$PT' with lines"
29 done
30
31 if [ "$PLOT_LINE"x != "x" ]; then
32         echo Making bw logs
33         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 -
34 fi
35
36 PLOT_LINE=""
37 for i in *slat.log; do
38         if [ ! -r $i ]; then
39                 continue
40         fi
41         PT=$(echo $i | sed s/_slat.log//g)
42         if [ "$PLOT_LINE"x != "x" ]; then
43                 PLOT_LINE=$PLOT_LINE", "
44         fi
45
46         PLOT_LINE=$PLOT_LINE"'$i' title '$PT' with lines"
47 done
48
49 if [ "$PLOT_LINE"x != "x" ]; then
50         echo Making slat logs $PLOT_LINE
51         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 -
52 fi
53
54 PLOT_LINE=""
55 for i in *clat.log; do
56         if [ ! -r $i ]; then
57                 continue
58         fi
59         PT=$(echo $i | sed s/_clat.log//g)
60         if [ "$PLOT_LINE"x != "x" ]; then
61                 PLOT_LINE=$PLOT_LINE", "
62         fi
63
64         PLOT_LINE=$PLOT_LINE"'$i' title '$PT' with lines"
65 done
66
67 if [ "$PLOT_LINE"x != "x" ]; then
68         echo Making clat logs $PLOT_LINE
69         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 -
70 fi