]> git.llucax.com Git - software/dgc/dgcbench.git/blob - pause-run.sh
Add scripts to generate memory usage pattern charts
[software/dgc/dgcbench.git] / pause-run.sh
1 #!/bin/sh
2
3 . ./tests-args.sh
4 factor_rnddata=0.1
5
6
7 FORMATS=${FORMATS:-png svg eps}
8
9 NAMES=${NAMES:-`echo ./micro/*.d | xargs -n1 sh -c 'basename $0 .d'` dil}
10
11 TYPES=${TYPES:-stw fork ea}
12
13 CPUS=${CPUS:-`grep '^processor' /proc/cpuinfo | wc -l`}
14
15 PLOTONLY=${PLOTONLY:-0}
16
17 NORUN=${NORUN:-}
18
19 STRIP=${STRIP:-1}
20
21 ARCH=${ARCH:-}
22
23
24 run() {
25         name=$1
26         type=$2
27         prog=$3
28         eval "args=\"\$args_$name\""
29         if test $type = "warm"
30         then
31                 echo "   WARM  $name"
32                 $prog $args > /dev/null
33                 return 0
34         fi
35         dst="./build/cdgc/pause/$name-$type-${CPUS}cpu.csv"
36         if test -f $dst
37         then
38                 echo "$NORUN" | grep -q "cdgc\\|$name" &&
39                         continue
40                 test $PLOTONLY -eq 1 &&
41                         continue
42         fi
43         gc_opts=
44         test $type = "stw" && gc_opts="fork=0"
45         test $type = "fork" && gc_opts="eager_alloc=0"
46         test $type = "ea" && gc_opts=""
47         pa="$args"
48         test ${#args} -gt 40 &&
49                 pa="`echo $args | cut -b1-40`..."
50         echo "   RUN   $name $pa > $dst"
51         D_GC_OPTS="$D_GC_OPTS:collect_stats_file=$dst:$gc_opts" \
52                         setarch i386 $ARCH $prog $args > /dev/null
53 }
54
55
56 make -srj4 micro-gc-build dil-gc-build GC=cdgc
57
58 for name in $NAMES
59 do
60         prog="./build/cdgc/bin/$name"
61         test $STRIP -eq 1 &&
62                 strip $prog
63         for type in warm $TYPES
64         do
65                 run $name $type $prog
66         done
67 done
68
69 for name in $NAMES
70 do
71         for time in stw pause
72         do
73                 dst=./build/$time-$name-${CPUS}cpu.csv
74                 if test -f $dst
75                 then
76                         echo "$NORUN" | grep -q "$name" &&
77                                 continue
78                         test $PLOTONLY -eq 1 &&
79                                 continue
80                         mv $dst ./build/$time-$name-${CPUS}cpu-old.csv
81                 fi
82                 col=4 # Stop-the-world data column
83                 test $time = "pause" && col=2 # Total pause data column
84                 echo -n > $dst
85                 for type in $TYPES
86                 do
87                         src="./build/cdgc/pause/$name-$type-${CPUS}cpu.csv"
88                         eval "factor=\"\$factor_$name\""
89                         test -z "$factor" &&
90                                 factor=1
91                         (echo -n $type,; awk -F, \
92                                         "{if (FNR > 1 && \$$col > 0)
93                                                 print \$$col*$factor}" $src \
94                                 | ./stats.py) >> $dst
95                         echo "   STATS `tail -n1 $dst | tr , ' '` >> $dst"
96                 done
97         done
98 done
99
100 for time in stw pause
101 do
102         echo -n "   PLOT  $time ${CPUS}cpu > ./build/$time-${CPUS}cpu.{"
103         for fmt in $FORMATS
104         do
105                 dst=./build/$time-${CPUS}cpu.$fmt
106                 test -f $dst &&
107                         mv $dst ./build/$time-${CPUS}cpu-old.$fmt
108                 echo -n "$fmt,"
109                 files=''
110                 for name in $NAMES
111                 do
112                         files="$files ./build/$time-$name-${CPUS}cpu.csv"
113                 done
114                 test $time = "stw" && title="Stop-the-world Time"
115                 test $time = "pause" && title="Pause Time"
116                 ./pause-plot.sh "$title" $fmt $dst $files
117         done
118         echo '}'
119 done
120