blob: 7d384fee99f4c2ca3ed1de4b0f75a3b76d819cdf (
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
|
#!/bin/bash
# $1: executable file name
# $2: name list of script files
# ex: ./sptest_scripts.sh sml 'fib5.sml fib10.sml'
# Then, 'sml < fib5.sml' and "sml < fib10.sml' are executed.
# repeat and waittimes
ct=10
waittime=5
# etc
comf=$1
log="log.txt"
sfs=($2); # sourcefiles
# -------------------------------------------------
function mywait() {
for w in $(seq 1 $waittime) ; do
echo -n "."
sleep 1
done
}
function gettime() {
rm -f _result.txt
for i in $(seq 1 $ct) ; do
(time $1 < $2) 2>> _result.txt
echo
echo -n "Done ($i/$ct)"
if [[ $(($i + 1)) -le $ct ]]; then
mywait
echo 'Restart'
fi
done
echo
echo
logtime=`grep real _result.txt | cut -f2 | sed -e "s/\(.*\)m\(.*\)s/\1 \2/" | awk -F' ' '{print ($1*60+$2)}'`
echo "execution time"
echo "$logtime"
# for return value
res=`echo $logtime | awk 'BEGIN{r=0;c=0} {r=r+$0;c++} END{print r/c}'`
rm -f _result.txt
}
rm -f $log
echo '' >> $log
echo "$ct" | awk -F',' '{printf("%-27s| avg. time over %d runs (sec)\n","",$1)}' >> $log
echo '===========================+=============================' >> $log
for f in "${sfs[@]}"
do
command="$f"
echo -n "Cooling CPU in $waittime sec"
mywait
echo ' The experiment starts.'
echo "------------------"
echo "$comf < $f"
gettime "$comf" "$f"
echo "Average ${res}sec"
echo
echo "$command,$res" | awk -F',' '{printf("%-27s| %.2f\n",$1,$2)}' >> $log
done
echo
cat $log
|