]> git.llucax.com Git - software/dgc/dgcbench.git/blob - time-run.sh
Create time/pause sub-directories in ./build
[software/dgc/dgcbench.git] / time-run.sh
1 #!/bin/sh
2
3 . ./tests-args.sh
4
5
6 export N=${N:-3}
7
8 TIME=${TIME:-/usr/bin/time}
9
10 FORMATS=${FORMATS:-png svg eps}
11
12 NAMES=${NAMES:-`echo ./micro/*.d | xargs -n1 sh -c 'basename $0 .d'` dil}
13
14 GCS=${GCS:-basic cdgc}
15
16 CPUS=${CPUS:-`grep '^processor' /proc/cpuinfo | wc -l`}
17
18 PLOTONLY=${PLOTONLY:-0}
19
20 NORUN=${NORUN:-}
21
22 STRIP=${STRIP:-1}
23
24 ARCH=${ARCH:-}
25
26
27 for gc in $GCS
28 do
29         make -srj4 micro-gc-build dil-gc-build GC=$gc
30         for name in $NAMES
31         do
32                 prog="./build/$gc/bin/$name"
33                 dst="./build/$gc/time/$name-${CPUS}cpu.csv"
34                 if test -f $dst
35                 then
36                         echo "$NORUN" | grep -q "$gc\\|$name" &&
37                                 continue
38                         test $PLOTONLY -eq 1 &&
39                                 continue
40                 fi
41                 eval "args=\"\$args_$name\""
42                 pa="$args"
43                 test ${#args} -gt 40 &&
44                         pa="`echo $args | cut -b1-40`..."
45                 test $STRIP -eq 1 &&
46                         strip $prog
47                 echo -n "   RUN   $name $pa > $dst: "
48                 echo -n > $dst
49                 for i in `seq $N`
50                 do
51                         test $(($i % 5)) -eq 0 &&
52                                 echo -n "$i" ||
53                                 echo -n "."
54                         setarch i386 $ARCH \
55                                 $TIME -f%e -a -o $dst \
56                                 $prog $args > /dev/null
57                 done
58                 echo
59         done
60 done
61
62 for name in $NAMES
63 do
64         dst=./build/time-$name-${CPUS}cpu.csv
65         if test -f $dst
66         then
67                 echo "$NORUN" | grep -q "$name" &&
68                         continue
69                 test $PLOTONLY -eq 1 &&
70                         continue
71                 mv $dst ./build/time-$name-${CPUS}cpu-old.csv
72         fi
73         echo -n > $dst
74         for gc in $GCS
75         do
76                 src=./build/$gc/time/$name-${CPUS}cpu.csv
77                 eval "factor=\"\$factor_$name\""
78                 test -z "$factor" &&
79                         factor=1
80                 (echo -n $gc,; awk "{print \$1*$factor}" $src | ./stats.py) >> $dst
81                 echo "   STATS `tail -n1 $dst | tr , ' '` >> $dst"
82         done
83 done
84
85 echo -n "   PLOT  ${CPUS}cpu > ./build/time-${CPUS}cpu.{"
86 for fmt in $FORMATS
87 do
88         dst=./build/time-${CPUS}cpu.$fmt
89         test -f $dst &&
90                 mv $dst ./build/time-${CPUS}cpu-old.$fmt
91         echo -n "$fmt,"
92         files=''
93         for name in $NAMES
94         do
95                 files="$files ./build/time-$name-${CPUS}cpu.csv"
96         done
97         ./time-plot.sh $fmt $dst $files
98 done
99 echo '}'
100