#!/bin/bash NICE="blacktext linewidth 4.0 \"Helvetica\" 16 " if [ "$1" == "--eps" ]; then EXT="eps" TERMINAL="postscript color eps $NICE" shift else EXT="png" TERMINAL="png picsize 1024 768" fi CSV1=$1 TITLE=$2 OUT=$3 if [ ! -f "$CSV1" ]; then echo "Usage: plot_sched [] [<out.png>]" exit 1 fi HARDSOFT=`basename $CSV1 | sed -e 's/^\([^_]*\).*/\1/'` KIND=`basename $CSV1 | sed -e 's/^[^_]*_\([^_]*\).*/\1/'` DIST=`basename $CSV1 | sed -e 's/^[^_]*_[^_]*_dist=\(.*\).csv/\1/'` case "$DIST" in uni_light) DIST="uniformly distributed in [0.001, 0.1]" ;; uni_medium) DIST="uniformly distributed in [0.1, 0.4]" ;; uni_heavy) DIST="uniformly distributed in [0.5, 0.9]" ;; bimo_light) DIST="bimodally distributed in [0.001, 0.5] (8/9) and [0.5, 0.9] (1/9)" ;; bimo_medium) DIST="bimodally distributed in [0.001, 0.5] (6/9) and [0.5, 0.9] (3/9)" ;; bimo_heavy) DIST="bimodally distributed in [0.001, 0.5] (4/9) and [0.5, 0.9] (5/9)" ;; *) ;; esac echo "Hard/Soft : $HARDSOFT" echo "Study : $KIND" echo "Distribution: $DIST" case "$KIND" in sched) YLABEL="schedulability" YRANGE="set yrange [-0.1:1.1]" case "$HARDSOFT" in soft) PLOT="plot '$CSV1' using 1:2 title 'P-EDF' with linespoints, \ '$CSV1' using 1:3 title 'C-EDF' with linespoints, \ '$CSV1' using 1:4 title 'G-EDF' with linespoints, \ '$CSV1' using 1:5 title 'PFAIR' with linespoints, \ '$CSV1' using 1:6 title 'G-NP-EDF' with linespoints " ;; hard) PLOT="plot '$CSV1' using 1:2 title 'P-EDF' with linespoints, \ '$CSV1' using 1:3 title 'C-EDF' with linespoints, \ '$CSV1' using 1:4 title 'G-EDF' with linespoints, \ '$CSV1' using 1:5 title 'PFAIR' with linespoints \ " ;; esac ;; tard) YLABEL="tardiness (in ms)" YRANGE= PLOT="plot '$CSV1' using 1:2 title 'C-EDF' with linespoints, \ '$CSV1' using 1:3 title 'G-EDF' with linespoints, \ '$CSV1' using 1:4 title 'G-NP-EDF' with linespoints " ;; util) YLABEL="utilization (incl. overheads)" YRANGE= case "$HARDSOFT" in soft) PLOT="plot '$CSV1' using 1:2 title 'P-EDF' with linespoints, \ '$CSV1' using 1:3 title 'C-EDF' with linespoints, \ '$CSV1' using 1:4 title 'G-EDF' with linespoints, \ '$CSV1' using 1:5 title 'PFAIR' with linespoints, \ '$CSV1' using 1:6 title 'G-NP-EDF' with linespoints " ;; hard) PLOT="plot '$CSV1' using 1:2 title 'P-EDF' with linespoints, \ '$CSV1' using 1:3 title 'C-EDF' with linespoints, \ '$CSV1' using 1:4 title 'G-EDF' with linespoints, \ '$CSV1' using 1:5 title 'PFAIR' with linespoints \ " ;; esac ;; gedf) YLABEL="schedulability" YRANGE="set yrange [-0.1:1.1]" PLOT="plot '$CSV1' using 1:2 title 'P-EDF' with linespoints, \ '$CSV1' using 1:3 title 'G-EDF [GFB]' with linespoints, \ '$CSV1' using 1:4 title 'G-EDF [BAK]' with linespoints, \ '$CSV1' using 1:5 title 'G-EDF [BCL]' with linespoints, \ '$CSV1' using 1:6 title 'G-EDF [SKB]' with linespoints \ " ;; *) YLABEL="" YRANGE="" ;; esac XLABEL="utilization cap" XRANGE="set xrange [0.5:32.5]; set xtics 0, 2" BASE=`basename $CSV1 | sed -e s/.csv//g -e s/dist=//g ` #echo $BASE if [ "$OUT" == "" ]; then OUT="${BASE}.${EXT}" fi if [ "$TITLE" == "" ]; then TITLE="$DIST" fi # fixup csv file, gnuplot is picky sed -i -e 's/,\([^ ]\)/, \1/g' $CSV1 gnuplot <<EOM set terminal $TERMINAL set out '/dev/null' $YRANGE $XRANGE $PLOT set ylabel '$YLABEL' set xlabel '$XLABEL' set title '$TITLE' set key below set data style linespoints set out '$OUT' replot set out EOM if [ "$EXT" == "eps" ]; then ps2pdf -dEPSCrop $OUT fi