diff options
| -rwxr-xr-x | csv2graph | 23 | ||||
| -rwxr-xr-x | plot_dist | 30 | ||||
| -rwxr-xr-x | plot_sched | 76 |
3 files changed, 129 insertions, 0 deletions
diff --git a/csv2graph b/csv2graph new file mode 100755 index 0000000..8f7d795 --- /dev/null +++ b/csv2graph | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | FILE=$1 | ||
| 4 | |||
| 5 | shift | ||
| 6 | |||
| 7 | if [ ! -f "$FILE" ] ; then | ||
| 8 | echo "Usage: csv2graph <csv file>" | ||
| 9 | fi | ||
| 10 | |||
| 11 | CUM=`mktemp` | ||
| 12 | DIST=`mktemp` | ||
| 13 | OUT=`echo $FILE | sed s/csv/png/` | ||
| 14 | |||
| 15 | analyze -adist -b1000 "$FILE" --csv -n -i $* > $DIST | ||
| 16 | analyze -adist -c -b1000 "$FILE" --csv -n -i $* > $CUM | ||
| 17 | |||
| 18 | if [ -s $CUM ] && [ -s $DIST ]; then | ||
| 19 | plot_dist $DIST $CUM $OUT "$FILE: $*" | ||
| 20 | rm $DIST $CUM | ||
| 21 | else | ||
| 22 | echo "$FILE: Empty." | ||
| 23 | fi | ||
diff --git a/plot_dist b/plot_dist new file mode 100755 index 0000000..18cb48c --- /dev/null +++ b/plot_dist | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | CSV1=$1 | ||
| 4 | CSV2=$2 | ||
| 5 | OUT=$3 | ||
| 6 | TITLE=$4 | ||
| 7 | |||
| 8 | if [ ! -f "$CSV1" ] || [ ! -f "$CSV2" ] || | ||
| 9 | [ "" == "$OUT" ] ; then | ||
| 10 | echo "Usage: plot_dist <normal.csv> <cumulative.csv> <out.png> <title>" | ||
| 11 | exit 1 | ||
| 12 | fi | ||
| 13 | |||
| 14 | gnuplot <<EOM | ||
| 15 | set terminal png picsize 1024 768 | ||
| 16 | set out '/dev/null' | ||
| 17 | plot '$CSV1' title 'distribution' with lines | ||
| 18 | replot '$CSV2' title 'distribution (cumulative)' axes x1y2 with lines | ||
| 19 | set ylabel 'probability' | ||
| 20 | set y2label 'probability (cumulative)' | ||
| 21 | set xlabel 'overhead (in us)' | ||
| 22 | set y2tics | ||
| 23 | set y2range [0.0:1.0] | ||
| 24 | set title '$TITLE' | ||
| 25 | set key top left | ||
| 26 | set out '$OUT' | ||
| 27 | replot | ||
| 28 | set out | ||
| 29 | EOM | ||
| 30 | |||
diff --git a/plot_sched b/plot_sched new file mode 100755 index 0000000..41ab38b --- /dev/null +++ b/plot_sched | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | NICE="blacktext linewidth 4.0 \"Helvetica\" 16 " | ||
| 4 | |||
| 5 | if [ "$1" == "--eps" ]; then | ||
| 6 | EXT="eps" | ||
| 7 | TERMINAL="postscript color eps $NICE" | ||
| 8 | shift | ||
| 9 | else | ||
| 10 | EXT="png" | ||
| 11 | TERMINAL="png picsize 1024 768" | ||
| 12 | fi | ||
| 13 | |||
| 14 | CSV1=$1 | ||
| 15 | TITLE=$2 | ||
| 16 | OUT=$3 | ||
| 17 | |||
| 18 | if [ ! -f "$CSV1" ]; then | ||
| 19 | echo "Usage: plot_sched <data.csv> [<title>] [<out.png>]" | ||
| 20 | exit 1 | ||
| 21 | fi | ||
| 22 | |||
| 23 | KIND=`basename $CSV1 | sed -e 's/^\([^_]*\).*/\1/'` | ||
| 24 | |||
| 25 | case "$KIND" in | ||
| 26 | util) | ||
| 27 | XLABEL="utilization cap" | ||
| 28 | ;; | ||
| 29 | freq) | ||
| 30 | XLABEL="K" | ||
| 31 | ;; | ||
| 32 | mcsl) | ||
| 33 | XLABEL="L (in us)" | ||
| 34 | ;; | ||
| 35 | cpus) | ||
| 36 | XLABEL="processor count" | ||
| 37 | ;; | ||
| 38 | *) | ||
| 39 | XLABEL=""; | ||
| 40 | ;; | ||
| 41 | esac | ||
| 42 | |||
| 43 | |||
| 44 | BASE=`basename $CSV1 | sed -e s/.csv//g -e s/_[a-z]*=0.123000//g -e 's/\([0-9]*\.[^0]\+\)0*\([_c]\)/\1_\2/g' -e 's/\([0-9]\)\.0*\([_c]\)/\1_\2/g' -e s/_cpus=16//g -e s/_freq=0//g` | ||
| 45 | |||
| 46 | echo $BASE | ||
| 47 | |||
| 48 | if [ "$OUT" == "" ]; then | ||
| 49 | OUT="${BASE}.${EXT}" | ||
| 50 | fi | ||
| 51 | |||
| 52 | if [ "$TITLE" == "" ]; then | ||
| 53 | TITLE=`echo -n $BASE | tr '_' ' ' | sed -e 's/^\(util\|freq\|mcsl\|cpus\) //g' -e s/freq=/K=/g -e s/mcsl=/L=/g ` | ||
| 54 | fi | ||
| 55 | |||
| 56 | gnuplot <<EOM | ||
| 57 | set terminal $TERMINAL | ||
| 58 | set out '/dev/null' | ||
| 59 | set yrange [-0.1:1.1] | ||
| 60 | plot '$CSV1' using 1:2 title 'FMLP (short)' with linespoints | ||
| 61 | replot '$CSV1' using 1:3 title 'FMLP (long)' with linespoints | ||
| 62 | replot '$CSV1' using 1:4 title 'M-PCP' with linespoints | ||
| 63 | replot '$CSV1' using 1:5 title 'D-PCP' with linespoints | ||
| 64 | set ylabel 'schedulability' | ||
| 65 | set xlabel '$XLABEL' | ||
| 66 | set title '$TITLE' | ||
| 67 | set key below | ||
| 68 | set data style linespoints | ||
| 69 | set out '$OUT' | ||
| 70 | replot | ||
| 71 | set out | ||
| 72 | EOM | ||
| 73 | |||
| 74 | if [ "$EXT" == "eps" ]; then | ||
| 75 | ps2pdf -dEPSCrop $OUT | ||
| 76 | fi \ No newline at end of file | ||
