aboutsummaryrefslogtreecommitdiffstats
path: root/plot_sched
blob: f074314f5648d8ee8d3da094d2ce3fcc46ea4c43 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/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 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 <data.csv> [<title>] [<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:8 title 'G-EDF (all)' with linespoints, \
                    '$CSV1' using 1:3 title 'G-EDF [GFB03]' with linespoints, \
                    '$CSV1' using 1:4 title 'G-EDF [BAK03]' with linespoints, \
                    '$CSV1' using 1:5 title 'G-EDF [BCL05]' with linespoints, \
                    '$CSV1' using 1:6 title 'G-EDF [BCL08]' with linespoints, \
                    '$CSV1' using 1:7 title 'G-EDF [SKB07]' 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