-
Notifications
You must be signed in to change notification settings - Fork 2
/
solve.sh
68 lines (53 loc) · 1.07 KB
/
solve.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
66
67
68
DO_EST=0
DO_SOLVE=1
# dump benchmark name
prog_name()
{
echo $1
}
# get simulation time and ilp file for a benchmark
run_prog()
{
cd $1
if [ $DO_SOLVE -eq 1 ]; then
#echo $1
#$solve $1.lp
$solve $1.lp | awk 'BEGIN{wcet=0; bm=0; cm=0} \
/objective/ { wcet=$NF} /bm/ { bm=$NF } /cm/ { cm=$NF } \
END{printf("%d %d %d\n", wcet, bm, cm)} '
#$solve $1.lp 2> /dev/null | awk '{if (NF == 4) printf("%d %d %d\n", $1, $3, $4)}'
fi
cd ..
}
# get code size for analysis
code_size()
{
cd $1
arg=`head -1 $1.arg`
cat $1.arg | awk '{printf("0x%s 0x%s\n", $1, $2)}' | awk --non-decimal-data '{print $2-$1}'
cd ..
}
#if [ "$1" == "" ]; then
# main=$PWD/main
#else
# main=$PWD/$1
#fi
est=$PWD/est
lp_solve_dir=$PWD/../lp_solve_5.5
solve="$lp_solve_dir/lp_solve -rxli $lp_solve_dir/libxli_CPLEX.so"
#solve=$PWD/solve
bench_path=../benchmarks
#bench_path=../bench-O0
cd $bench_path
if [ "$1" == "" ]; then
for i in * ; do
if [ -d $i -a $i != "CVS" ]; then
#echo -e -n $i "\t"
run_prog $i
#code_size $i
fi
done
else
run_prog $1
fi
cd ..