-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
57 lines (49 loc) · 1.7 KB
/
run.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
#!bin/sh
make clear
make -B main
make a
make b
./bin/a &
./bin/b &
# calc(){ awk "BEGIN { print "$*" }"; }
while true; do
pa=$(pgrep -x "a")
pb=$(pgrep -x "b")
if [ -z "$pa" ] && [ -z "$pb" ]; then
echo "Done with waiting queue!"
echo "DEPORTES: Football Club" >> output.txt
echo "-----------------------" >> output.txt
echo "Scenario 1:" >> output.txt
echo "" >> output.txt
./bin/main >> output.txt
echo "" >> output.txt
time1=$(awk '{ sum += $1 } END { print sum }' log.txt);
rm log.txt
echo "Scenario 2:" >> output.txt
echo "" >> output.txt
echo "Increased Memory by 20%" >> output.txt
sed -i -e 's/count >= 5/count >= 6/g' main_memory.c
make clear2
make -B main
./bin/main >> output.txt
time2=$(awk '{ sum += $1 } END { print sum }' log.txt);
rm log.txt
echo "" >> output.txt
echo "Increased Memory by 50%" >> output.txt
sed -i -e 's/count >= 6/count >= 9/g' main_memory.c
make clear2
make -B main
./bin/main >> output.txt
time3=$(awk '{ sum += $1 } END { print sum}' log.txt);
rm log.txt
sed -i -e 's/count >= 9/count >= 5/g' main_memory.c
echo "" >> output.txt
echo "Scenario 3:" >> output.txt
echo "" >> output.txt
echo "Original times: $time1 $time2 $time3" >> output.txt
echo "Updated times: $((time1 / 2)) $((time2 / 2)) $((time3 / 2))" >> output.txt
echo ""
cat output.txt
break;
fi
done