-
Notifications
You must be signed in to change notification settings - Fork 0
/
eval.sh
executable file
·65 lines (54 loc) · 986 Bytes
/
eval.sh
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
#!/bin/bash
# check param
if [ $# != 2 ]
then
echo "usage: evalu.sh <program> <method>"
exit 1
fi
PROGRAM="./$1-$2-rec"
NTHR="1 2 4"
TEST_RUN=10
# check whether executable exits
if [ ! -x $PROGRAM ]
then
echo Fail to run $PROGRAM
echo Maybe it doesn\'t exist, or you have no permission!
exit 1
fi
# run program and collect data
function run() {
local log
local prog
local thr
local runs
log="log/$1.$2"
prog=$1
thr=$2
runs=$3
rm -f $log $log.tmp
echo $thr > $log
for i in `seq 1 $runs`
do
$prog $thr > $log.tmp
awk '/tsc/ {print $2}' $log.tmp >> $log
done
rm $log.tmp
}
# assume there are $PROGAM.$THREAD_NUM files
function merge() {
local prog
local log
prog=$1
log="log/$prog"
paste "log/$prog".* > $log
rm "log/$prog".*
}
function main() {
for thr in $NTHR
do
run $PROGRAM $thr $TEST_RUN
done
merge $PROGRAM
}
mkdir -p log
main