1#!/bin/bash 2 3PAPERPATH=~/hg/papers/asplos11/barrelfish/plots 4 5# we use more and more devices and bridge to check how well the algorithms 6# allocate resources and how long they need 7 8#ALGORITHMS="bridge_page.pl bridge_postorder.pl bridge_postorder_sorted.pl bridge_postorder_sorted_sum.pl bridge_postorder_sorted_ascending.pl bridge_postorder_sorted_sum_ascending.pl" 9#ALGONAMES[0]="CLP" 10#ALGONAMES[1]="postorder" 11#ALGONAMES[2]="postorder_sorted" 12#ALGONAMES[3]="postorder_sum" 13#ALGONAMES[4]="postorder_asc" 14#ALGONAMES[5]="postorder_asc_sum" 15 16#ALGORITHMS="bridge_page.pl bridge_postorder_sorted.pl bridge_postorder_sorted_sum.pl" 17#ALGONAMES[0]="CLP" 18#ALGONAMES[1]="postorder_sorted" 19#ALGONAMES[2]="postorder_sorted_sum" 20 21ALGORITHMS="bridge_page.pl bridge_postorder_sorted_ascending.pl" 22ALGONAMES[0]="CLP" 23ALGONAMES[1]="postorder_sorted_ascending" 24 25################################################################################ 26# TEST 1: sample test devices and test bridges 27################################################################################ 28 29# the file from which devices should be added 30DEVICEFILE="testdevices.txt" 31 32# the the line number in testdevices.txt just before the first device() fact 33# starts 34OFFSET=189 35 36# how many devices do we want to have at the end to compute the assignment? 37#MAXDEVICES=47 38MAXDEVICES=41 39################################################################################ 40 41 42################################################################################ 43# TEST 2: devices from gruyere 44################################################################################ 45 46# the file from which devices should be added 47#DEVICEFILE="testdevices2.txt" 48 49# the the line number in testdevices.txt just before the first device() fact 50# starts 51#OFFSET=46 52 53# how many devices do we want to have at the end to compute the assignment? 54#MAXDEVICES=64 55################################################################################ 56 57 58 59 60 61 62 63OUTFILE="space_consumption.dat" 64GNUPLOTFILE="space_consumption.gnuplot" 65PNGOUTPUT="space_consumption.eps" 66BAUMFILE="tmp.baum.dat"; 67 68 69echo "" > $BAUMFILE 70echo "" > $OUTFILE 71echo -n "minrealbase_1 maxrealbase_2 realres_3 devicesum_4 paddingoverhead_5 " >> $OUTFILE 72echo -n "rootminmem_6 rootmaxmem_7 rootsize_8 rootminoverflow_9 rootlimitoverflow_10 " >> $OUTFILE 73echo -n "rootbasedifference_11 rootlimitdifference_12 fillrate_13 fillpercent_14 " >> $OUTFILE 74echo -n "consumptionrate_15 consumptionpercent_16 new_bridge_added_17" >> $OUTFILE 75echo "" >> $OUTFILE 76 77 78# allgemeine einstellungen 79echo "clear" > $GNUPLOTFILE 80echo "reset" >> $GNUPLOTFILE 81#echo "set terminal postscript eps enhanced dashed color" >> $GNUPLOTFILE 82echo "set terminal postscript eps enhanced dashed" >> $GNUPLOTFILE 83echo "set output \"$PNGOUTPUT\"" >> $GNUPLOTFILE 84 85# SPACE CONSUMPTION 86echo "set boxwidth 0.1" >> $GNUPLOTFILE 87echo "set key bottom right" >> $GNUPLOTFILE 88echo "set xlabel \"Fillrate (device sum / max available size) [%]\"" >> $GNUPLOTFILE 89echo "set ylabel \"Physical address size required [bytes]\"" >> $GNUPLOTFILE 90echo -n "plot [0:100] \"$OUTFILE\" index 0 using 14:8 title \"Root size (max)\" with lines, " >> $GNUPLOTFILE; 91echo -n " \"$OUTFILE\" index 0 using 14:4 title \"DeviceSum\" with lines," >> $GNUPLOTFILE; 92echo -n " \"$OUTFILE\" index 0 using 14:(\$17==1?\$8:0) notitle with boxes" >> $GNUPLOTFILE; 93#echo -n " \"$OUTFILE\" index 0 using 14:(\$17==1?\$8:0) title \"Added Bridge\" with boxes" >> $GNUPLOTFILE; 94treedata=""; 95 96 97padding_overhead=""; 98 99algoindex=0; 100for i in $ALGORITHMS; do 101 echo "# $i" >> $OUTFILE 102 count=0; 103 while [ $count -lt $MAXDEVICES ]; do 104 echo $count; 105 count=$[$count+1]; 106 echo $i; 107 head -$[$count+$OFFSET] $DEVICEFILE > tmp.devices.dat; 108 ./mach $i tmp.devices.dat > tmp.out.dat; 109 110 egrep Abort tmp.out.dat; 111 if [ 0 -eq $? ]; then 112 echo "ECLIPSE-Fehler"; 113 echo "Algorithm: $i, count: $count"; 114 exit 1; 115 fi 116 117 egrep No tmp.out.dat; 118 if [ 0 -eq $? ]; then 119 echo "ECLIPSE did not find a solution"; 120 echo "Algorithm: $i, count: $count"; 121 exit 1; 122 fi 123## sed -r -e '/res\(.*\)./!d' tmp.out.dat 124# sed -r -e '/^res.*/!d' -e 's/res[\t]//' tmp.out.dat >> $OUTFILE 125 zahlen=$(sed -r -e '/^res.*/!d' -e 's/res[\t]//' -e 's/\n//g' tmp.out.dat) 126 bridge=$(tail -1 tmp.devices.dat | egrep bridge); 127 if [ 0 -eq $? ]; then 128 b=1; 129 else 130 b=0; 131 fi 132 echo "$zahlen $b" >> $OUTFILE 133 done 134 echo "" >> $OUTFILE; 135 echo "" >> $OUTFILE; 136 echo "# $i" >> $BAUMFILE 137 sed -r -e '/^treedata/!d' -e 's/treedata[\t]//' -e 's/base/\nbase/g' tmp.out.dat >> $BAUMFILE 138 echo "" >> $BAUMFILE; 139 echo "" >> $BAUMFILE; 140# nama=$(echo $i|sed -r -e 's/_/\\_/g'); 141 nama=$(echo ${ALGONAMES[$algoindex]}|sed -r -e 's/_/\\_/g'); 142 echo -n ", \"$OUTFILE\" index $algoindex using 14:3 title '$nama' with linespoints" >> $GNUPLOTFILE; 143 paddingoverhead="$paddingoverhead,\"$OUTFILE\" index $algoindex using 14:5 title '$nama' with linespoints"; 144# echo "paddingoverhead: $paddingoverhead"; 145 146 algoindex=$[$algoindex+1]; 147done 148 149echo "" >> $OUTFILE 150echo "" >> $OUTFILE 151cat $BAUMFILE >> $OUTFILE 152 153echo "" >> $GNUPLOTFILE 154echo "" >> $GNUPLOTFILE 155 156 157baumindex=$[$algoindex]; 158 159 160# PADDING OVERHEAD 161echo "set output \"padding_overhead.eps\"" >> $GNUPLOTFILE 162echo "set key top left" >> $GNUPLOTFILE 163echo "set xlabel \"Fillrate (device sum / max available size) [%]\"" >> $GNUPLOTFILE 164echo "set ylabel \"Padding overhead [bytes]\"" >> $GNUPLOTFILE 165# arrows for bridges missing 166paddingoutput=$(echo $paddingoverhead|sed -r -e 's/,(.*)/\1/'); 167echo "plot [0:100] $paddingoutput" >> $GNUPLOTFILE 168 169#with bridgebox, but bad scaling... 170#echo -n "plot [0:100] " >> $GNUPLOTFILE 171#echo -n " \"$OUTFILE\" index 0 using 14:(\$17==1?\$8:0) notitle with boxes" >> $GNUPLOTFILE; 172#echo -n "$paddingoverhead" >> $GNUPLOTFILE; 173 174echo "" >> $GNUPLOTFILE 175echo "" >> $GNUPLOTFILE 176 177 178# BAUM 179 180echo "set key top right" >> $GNUPLOTFILE 181echo "set xlabel \"Address [bytes]\"" >> $GNUPLOTFILE 182echo "set ylabel \"Bus Nr\"" >> $GNUPLOTFILE 183 184for i in $ALGORITHMS; do 185 echo "# $i" >> $GNUPLOTFILE 186 echo "set output \"tree_$i.eps\"" >> $GNUPLOTFILE; 187 echo -n "plot " >> $GNUPLOTFILE 188 echo -n "\"./space_consumption.dat\" index $algoindex using 4:(\$6==1?\$3:1/0):yticlabels(7) title \"Bridge\" with linespoints, " >> $GNUPLOTFILE 189 echo "\"./space_consumption.dat\" index $algoindex using 4:(\$6==0?\$3:1/0):yticlabels(7) title \"Device\" with linespoints" >> $GNUPLOTFILE 190 191 algoindex=$[$algoindex+1]; 192done 193 194 195#echo ";" >> $GNUPLOTFILE 196gnuplot $GNUPLOTFILE 197cp *.eps $PAPERPATH 198cp *.dat $PAPERPATH 199echo "fertig." 200 201