-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbenchmarking.sh
executable file
·79 lines (61 loc) · 4.28 KB
/
benchmarking.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
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
set -e
ITERATIONS=1
SAFETYFACTOR=1
echo "=================================BRACK========================================="
echo "======= Benchmarking Read-write user Agents and Clients for linKed data ======"
echo "=================================BRACK========================================="
if [ $(curl -qf http://localhost:40200/ldbbc/ 2> /dev/null > /dev/null ; echo $?) -ne "0" ] || [ $(curl -qf http://localhost:40300/ 2> /dev/null > /dev/null ; echo $?) -ne "0" ] ; then
echo "Please start the servers first, ie. run \"./server.sh start all\" to start all"
exit 1
fi
echo "Benchmarking with $ITERATIONS iterations..."
rm -f ldf.out
function tlo {
# Resetting the property server
curl -qf -X DELETE http://localhost:40300/ 2> /dev/null > /dev/null
for file in $(find rules/behaviour/ -name $2".wing.*n3"); do
NEWNAME=$(echo $file | sed 's/wing/x/')
cp $file $NEWNAME
sed -i "s/Wing_SOR46/$1/g" $NEWNAME
done
#echo -ne "Reading the entire building from disk. Median time [ms]:\t\t"
#(timeout $((400 * $SAFETYFACTOR * $ITERATIONS / 1000)) \
#./linked-data-fu-0.9.12/bin/ldfu.sh -p rules/reasoning/hasPartIsTransitive.n3 -p tmp/brick-inverse-properties.n3 \
#-i brick/GroundTruth/building_instances/IBM_B3.ttl -i tmp/IBM_B3-property-links-f*ttl \
#-p rules/behaviour/$2/$2.x.get.rdf.n3 -p rules/behaviour/$2/$2.x.put.rdf.n3 \
#-n 2>&1 ) | tee -a ldf.out | grep lapsed | head -$ITERATIONS | awk '{sub(/\./,"",$4); print $4}' | sort | ./scripts/median.awk
#echo -ne "Reading the entire building from disk (caching). Median time [ms]:\t"
#(timeout $((500 * $SAFETYFACTOR * $ITERATIONS / 1000)) \
#./linked-data-fu-0.9.12/bin/ldfu.sh -p rules/reasoning/hasPartIsTransitive.n3 -p tmp/brick-inverse-properties.n3 \
#-p brick/GroundTruth/building_instances/IBM_B3.ttl -p tmp/IBM_B3-property-links-f*nt \
#-p rules/behaviour/$2/$2.x.get.rdf.n3 -p rules/behaviour/$2/$2.x.put.rdf.n3 \
#-n 2>&1 ) | tee -a ldf.out | grep lapsed | head -$ITERATIONS | awk '{sub(/\./,"",$4); print $4}' | sort | ./scripts/median.awk
echo -ne "Reading the entire building from network. Time [ms]:\t\t"
(timeout $((110 * 500 * $SAFETYFACTOR * $ITERATIONS / 1000)) \
./linked-data-fu-0.9.12/bin/ldfu.sh -p rules/reasoning/hasPartIsTransitive.n3 -p tmp/brick-inverse-properties.n3 \
-i "http://localhost:40200/ldbbc/IBM_B3.ttl" -i "http://localhost:40200/ldbbc/IBM_B3-property-links-for-lights.ttl" -i "http://localhost:40200/ldbbc/IBM_B3-property-links-for-occupancy-sensors.ttl" -i "http://localhost:40200/ldbbc/IBM_B3-property-links-for-luminance-commands.ttl" -i "http://localhost:40200/ldbbc/IBM_B3-property-links-for-luminance-sensors.ttl" -i "http://localhost:40200/ldbbc/IBM_B3-property-links-for-luminance-alarms.ttl" -i "http://localhost:40200/ldbbc/IBM_B3-personal-comfort-values-for-luminance-sensors.ttl" \
-p rules/behaviour/$2/$2.x.get.rdf.n3 -p rules/behaviour/$2/$2.x.put.rdf.n3 \
-n 2>&1 ) | tee -a ldf.out | grep lapsed | awk '{sub(/\./,"",$4); print $4}' | sort | ./scripts/median-stddev-mean.awk
# Resetting the property server
curl -qf -X DELETE http://localhost:40300/ 2> /dev/null > /dev/null
echo -ne "Reading the relevant Linked Data from the network. Time [ms]:\t"
(timeout $((43 * 1300 * $SAFETYFACTOR * $ITERATIONS / 1000)) \
./linked-data-fu-0.9.12/bin/ldfu.sh -p rules/reasoning/hasPartIsTransitive.n3 -p tmp/brick-inverse-properties.n3 \
-p rules/behaviour/$2/$2.x.get.ld.n3 -p rules/behaviour/$2/$2.x.put.ld.n3 \
-n 2>&1 ) | tee -a ldf.out | grep lapsed | awk '{sub(/\./,"",$4); print $4}' | sort | ./scripts/median-stddev-mean.awk
#echo -ne "Rules without variables. Median time [ms]:\t"
#(timeout $((600 * $SAFETYFACTOR * $ITERATIONS / 1000)) \
#./linked-data-fu-0.9.12/bin/ldfu.sh -p tmp/$2.$1.get.n3 -p tmp/$2.$1.put.n3 \
#-n 2>&1 ) | tee -a ldf.out | grep lapsed | head -$ITERATIONS | awk '{sub(/\./,"",$4); print $4}' | sort | ./scripts/median.awk
}
for behaviour in "turn-lightswitches-on" "clock-based-control" "sun-hour-based-control" "light-sensor-based-control" "individual-light-sensor-based-control" ; do
echo
echo "============== behaviour: $behaviour =============="
for place in Room_SOR42_G_19 fiverooms tenrooms twentyrooms Floor_FirstFloor Wing_SOR46 Building_B3 ; do
echo
echo "== $behaviour in $place..."
tlo $place $behaviour
done
find rules/behaviour/ -name "$behaviour.x.*n3" -delete
done