aboutsummaryrefslogtreecommitdiffstats
path: root/plot_sched
blob: 41ab38b4d521588093e11cee7dac29d65e822043 (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
#!/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 <data.csv> [<title>] [<out.png>]"
    exit 1
fi

KIND=`basename $CSV1 | sed -e 's/^\([^_]*\).*/\1/'`

case "$KIND" in
    util)
         XLABEL="utilization cap"
         ;;
    freq)
         XLABEL="K"
         ;;
    mcsl)
         XLABEL="L (in us)"
         ;;
    cpus)
         XLABEL="processor count"
         ;;
    *)
         XLABEL="";
         ;;
esac


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`

echo $BASE

if [ "$OUT" == "" ]; then
    OUT="${BASE}.${EXT}"
fi

if [ "$TITLE" == "" ]; then
    TITLE=`echo -n $BASE | tr '_' ' ' | sed  -e 's/^\(util\|freq\|mcsl\|cpus\) //g' -e s/freq=/K=/g -e s/mcsl=/L=/g `
fi

gnuplot <<EOM
set terminal $TERMINAL
set out '/dev/null'
set yrange [-0.1:1.1]
plot     '$CSV1' using 1:2 title 'FMLP (short)' with linespoints
replot   '$CSV1' using 1:3 title 'FMLP (long)' with linespoints
replot   '$CSV1' using 1:4 title 'M-PCP' with linespoints
replot   '$CSV1' using 1:5 title 'D-PCP' with linespoints
set ylabel  'schedulability'
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