forked from parzonka/prm4j-eval
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqea
executable file
·125 lines (104 loc) · 4.81 KB
/
qea
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/usr/bin/env bash
#
# Compiles, runs and evaluations QEA aspects with the DaCapo-9.12-bach benchmark using aspectj load-time weaving.
#
# Created by Giles Reger by copying and altering the javamop file.
#
#
# usage: ./qea <list of parametric properties> <list of benchmarks>
# Runs an evaluation of QEA monitoring a parametric property in the given list of parametric properties
# and benchmark in the given list of DacCapo benchmarks.
#
# examples: ./qea HasNext avrora
# ./qea "HasNext UnsafeMapIterator" "avrora h2 tradebeans"
#
# usage: ./qea (parameterless)
# Runs an evaluation of QEA monitoring a parametric properties in {HasNext UnsafeIterator UnsafeMapIterator
# SafeSyncCollection SafeSyncMap} using a DacCapo benchmark in {avrora batik eclipse fop h2 jython luindex
# pmd sunflow tomcat tradebeans tradesoap xalan}.
#
# notes: A list of all monitored properties can be found in target/jars/mop; each jar is a property
# A list of all benchmarks can be found at http://dacapobench.org/benchmarks.html
# Benchmark "lusearch" is not used because of random crashes in lucine on the evaluation hardware.
#
#
# CONFIGURATION:
invocations=5 # sets the number of JVM invocations
maxIterations=25 # sets the maximal number iterations per JVM invocation
######################################################################################################################
if [ -z "$1" ]; then
paramProperties="HasNext UnsafeIterator UnsafeMapIterator SafeSyncCollection SafeSyncMap"
else
paramProperties=$1
fi
if [ -z "$2" ]; then
benchmarks="avrora batik eclipse fop h2 jython luindex pmd sunflow tomcat tradebeans tradesoap xalan"
else
benchmarks=$2
fi
if [ -z "$3" ]; then
comp=false
else
comp=$3
fi
# remember directory where this script is called (some benchmarks need absolute paths)
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "Resolving maven dependencies... (may take a while)"
mvn dependency:resolve --update-snapshots
# get and process classpath from maven pom
mvn -q dependency:build-classpath -Dmdep.outputFile=dependency-outputfile
tr ':' '\n' < dependency-outputfile > dependency-list
# get classpaths to local maven repo
AJC=$(grep "aspectjtools" dependency-list)
RT=$(grep "aspectjrt" dependency-list)
WEAVER=$(grep "aspectjweaver" dependency-list)
QEART=$(grep "qea" dependency-list)
GUAVA=$(grep "guava" dependency-list)
APACHEMATH=$(grep "math3" dependency-list)
APACHECOM=$(grep "collections4" dependency-list)
DACAPO=$(grep "dacapo" dependency-list)
# cleanup tempfiles
rm dependency-outputfile dependency-list
# create working and target directories
rm -rf target
mkdir -p target/classes/META-INF target/jars/qea
mkdir -p logs
# compile the aspect into classes
echo "Compiling aspect..."
java -jar $AJC -cp "${RT}:${QEART}:$DACAPO:$GUAVA:$APACHEMATH" src/main/java/qea/* -d target/classes -7 -Xjoinpoints:synchronization
# create jar with callback
javac src/main/java/prm4jeval/*.java -d target/classes -cp "$DACAPO:$APACHEMATH:$GUAVA"
jar cf target/jars/Callback.jar -C target/classes .
echo "Will perform ${invocations} JVM invocations with parametric properties in (${paramProperties}) and benchmarks in (${benchmarks}) until reaching static state (max. $maxIterations iterations)."
# load-time weaving via aspectjweaver, will run the specified number of invocations with up to 25 iterations
for invocation in $(jot $invocations 1) ; do
for paramProperty in $paramProperties ; do
if $comp; then
paramPropertyName=$paramProperty'Competition';
else
paramPropertyName=$paramProperty;
fi
# create custom aop-ajc.xml and put in META-INF
sed 's/<aspectname>/qea.'$paramPropertyName'Aspect/g' src/main/resources/qea/aop-ajc.xml > target/classes/META-INF/aop-ajc.xml
# repackage each aspect into a single jars with the custom aop-ajc.xml
jar cf target/jars/qea/${paramProperty}.jar -C target/classes META-INF/aop-ajc.xml -C target/classes qea/${paramPropertyName}Aspect.class -C target/classes qea/MemoryLogger.class
# cleanup custom aop-ajc.xml
rm target/classes/META-INF/aop-ajc.xml
for benchmark in $benchmarks ; do
STATUS=0
while [ $STATUS -eq 0 ]; do
echo "Starting benchmark [qea:$benchmark:$paramProperty] JVM invocation $invocation..."
java -Xmx2048M -javaagent:"$WEAVER" -Xbootclasspath/a:"$RT" \
-Dprm4jeval.outputfile=logs/qea.log \
-Dprm4jeval.statsLogging=true \
-Dprm4jeval.benchmark="${benchmark}" \
-Dprm4jeval.paramProperty="${paramProperty}" \
-Dprm4jeval.invocation="${invocation}" \
-Dprm4jeval.maxIterations=${maxIterations} \
-cp "$DACAPO:$GUAVA:$QEART:$APACHEMATH:$APACHECOM:${DIR}/target/jars/qea/$paramProperty.jar:${DIR}/target/jars/Callback.jar" \
Harness --no-validation -c prm4jeval.EvalCallback $benchmark
STATUS=$?
done
done
done
done