#!/bin/bash #NICE="blacktext linewidth 4.0 \"Helvetica\" 16 " # try thinner lines NICE="blacktext linewidth 1.0 \"Helvetica\" 16 " if [ "$1" == "--eps" ]; then EXT="eps" # TERMINAL="postscript eps color $NICE" TERMINAL="postscript 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/'` FDIST=`basename $CSV1 | sed -e 's/^[^_]*_[^_]*_dist=\(.*\).csv/\1/'` case "$FDIST" 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" XLABEL="utilization cap" XRANGE="set xrange [0.5:32.5]; set xtics 0, 2" STYLE="lines lw 3" #STYLE=linespoints LINESTYLE=" \ set style line 1 lt rgb 'blue'; \ set style line 2 lt rgb 'orange-red'; \ " 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 $STYLE, \ '$CSV1' using 1:3 title 'C-EDF' with $STYLE, \ '$CSV1' using 1:4 title 'G-EDF' with $STYLE, \ '$CSV1' using 1:5 title 'PFAIR' with $STYLE, \ '$CSV1' using 1:6 title 'S-PFAIR' with $STYLE, \ '$CSV1' using 1:7 title 'G-NP-EDF' with $STYLE " if [ "$FDIST" != "uni_light" ]; then XRANGE="set xrange [21.5:32.5]; set xtics 0, 2" fi ;; hard) PLOT="plot '$CSV1' using 1:2 title 'P-EDF' with $STYLE, \ '$CSV1' using 1:3 title 'C-EDF' with $STYLE, \ '$CSV1' using 1:4 title 'G-EDF' with $STYLE, \ '$CSV1' using 1:5 title 'PFAIR' with $STYLE, \ '$CSV1' using 1:6 title 'S-PFAIR' with $STYLE " ;; esac ;; tard) YLABEL="tardiness (in ms)" YRANGE= PLOT="plot '$CSV1' using 1:2 title 'C-EDF' with $STYLE, \ '$CSV1' using 1:3 title 'G-EDF' with $STYLE, \ '$CSV1' using 1:4 title 'G-NP-EDF' with $STYLE " ;; util) YLABEL="utilization (incl. overheads)" YRANGE= case "$HARDSOFT" in soft) PLOT="plot '$CSV1' using 1:2 title 'P-EDF' with $STYLE, \ '$CSV1' using 1:3 title 'C-EDF' with $STYLE, \ '$CSV1' using 1:4 title 'G-EDF' with $STYLE, \ '$CSV1' using 1:5 title 'PFAIR' with $STYLE, \ '$CSV1' using 1:6 title 'G-NP-EDF' with $STYLE " ;; hard) PLOT="plot '$CSV1' using 1:2 title 'P-EDF' with $STYLE, \ '$CSV1' using 1:3 title 'C-EDF' with $STYLE, \ '$CSV1' using 1:4 title 'G-EDF' with $STYLE, \ '$CSV1' using 1:5 title 'PFAIR' with $STYLE \ " ;; esac ;; gedf) YLABEL="schedulability" YRANGE="set yrange [-0.1:1.1]" PLOT="plot '$CSV1' using 1:2 title 'P-EDF' with $STYLE, \ '$CSV1' using 1:8 title 'G-EDF (all)' with $STYLE, \ '$CSV1' using 1:3 title 'G-EDF [GFB03]' with $STYLE, \ '$CSV1' using 1:4 title 'G-EDF [BAK03]' with $STYLE, \ '$CSV1' using 1:5 title 'G-EDF [BCL05]' with $STYLE, \ '$CSV1' using 1:6 title 'G-EDF [BCL08]' with $STYLE, \ '$CSV1' using 1:7 title 'G-EDF [SKB07]' with $STYLE \ " ;; *) YLABEL="" YRANGE="" ;; esac 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 $STYLE set out '$OUT' set palette defined ( 0 "blue", 3 "green", 6 "yellow", 10 "red" ) replot set out EOM if [ "$EXT" == "eps" ]; then ps2pdf -dEPSCrop $OUT fi