forked from real-logic/simple-binary-encoding
-
Notifications
You must be signed in to change notification settings - Fork 1
/
perf-build.xml
181 lines (154 loc) · 7.48 KB
/
perf-build.xml
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?xml version="1.0" encoding="UTF-8"?>
<project name="sbe-benchmarks" default="java:perf:test">
<description>Benchmarks for different codecs</description>
<property name="ant.build.javac.source" value="1.7" />
<property name="ant.build.javac.target" value="1.7" />
<property name="dir.perf.java" location="perf/java"/>
<property name="dir.resources.sbe" location="perf/resources/sbe"/>
<property name="dir.resources.protobuf" location="perf/resources/protobuf"/>
<property name="dir.target.perf" location="target/perf"/>
<property name="dir.target.perf.classes" location="target/perf/classes"/>
<property name="dir.target.perf.java" location="target/perf/java"/>
<property name="dir.target.perf.dist" location="target/perf/dist"/>
<property name="dir.target.perf.cpp" location="target/perf/cpp"/>
<property name="dir.deps" location="deps"/>
<property name="dir.deps.protobuf.build" location="deps/pb"/>
<property file="build-local.properties"/>
<path id="perf.tools.classpath">
<fileset dir="perf/lib" includes="**/*.jar"/>
<file file="target/dist/sbe.jar"/>
</path>
<path id="perf.build.classpath">
<path refid="perf.tools.classpath"/>
<pathelement location="${dir.target.perf.classes}"/>
</path>
<target name="init">
<mkdir dir="${dir.target.perf.java}"/>
<mkdir dir="${dir.target.perf.classes}"/>
<mkdir dir="${dir.target.perf.dist}"/>
</target>
<target name="clean">
<delete dir="target/perf"/>
</target>
<target name="java:codegen" depends="init">
<java classname="uk.co.real_logic.sbe.SbeTool">
<classpath refid="perf.tools.classpath"/>
<sysproperty key="sbe.output.dir" value="${dir.target.perf.java}"/>
<sysproperty key="sbe.target.language" value="Java"/>
<arg value="${dir.resources.sbe}/car.xml"/>
</java>
<java classname="uk.co.real_logic.sbe.SbeTool">
<classpath refid="perf.tools.classpath"/>
<sysproperty key="sbe.output.dir" value="${dir.target.perf.java}"/>
<sysproperty key="sbe.target.language" value="Java"/>
<arg value="${dir.resources.sbe}/fix-message-samples.xml"/>
</java>
<fail unless="protobuf.home" message="protobuf.home is not defined (please add a build-local.properties and define it."/>
<exec executable="${protobuf.home}/bin/protoc">
<arg value="-I${dir.resources.protobuf}"/>
<arg value="--java_out"/>
<arg value="${dir.target.perf.java}"/>
<arg value="${dir.resources.protobuf}/car.proto"/>
<arg value="${dir.resources.protobuf}/fix-messages.proto"/>
</exec>
</target>
<target name="java:compile" depends="clean, init, java:codegen">
<javac srcdir="${dir.target.perf.java}" destdir="${dir.target.perf.classes}" includeAntRuntime="false" debug="true">
<classpath refid="perf.tools.classpath"/>
</javac>
<javac srcdir="${dir.perf.java}" destdir="${dir.target.perf.classes}" includeAntRuntime="false" debug="true">
<classpath refid="perf.build.classpath"/>
<compilerarg value="-s"/>
<compilerarg value="${dir.target.perf.java}"/>
</javac>
<jar destfile="${dir.target.perf.dist}/microbenchmarks.jar">
<manifest>
<attribute name="Main-Class" value="org.openjdk.jmh.Main"/>
</manifest>
<fileset dir="${dir.target.perf.classes}" includes="**/*"/>
<zipgroupfileset dir="target/dist" includes="**/sbe.jar"/>
<zipgroupfileset dir="perf/lib" includes="**/*.jar"/>
</jar>
</target>
<target name="java:perf:test" depends="java:compile">
<exec executable="java">
<arg value="-jar"/>
<arg value="target/perf/dist/microbenchmarks.jar"/>
<arg value="-wi"/>
<arg value="3"/>
<arg value="-i"/>
<arg value="3"/>
<arg value=".*Benchmark.*"/>
</exec>
</target>
<target name="cpp:codegen" depends="init">
<java classname="uk.co.real_logic.sbe.SbeTool">
<classpath refid="perf.tools.classpath"/>
<sysproperty key="sbe.output.dir" value="${dir.target.perf.cpp}"/>
<sysproperty key="sbe.target.language" value="Cpp98"/>
<arg value="${dir.resources.sbe}/car-c.xml"/>
</java>
<java classname="uk.co.real_logic.sbe.SbeTool">
<classpath refid="perf.tools.classpath"/>
<sysproperty key="sbe.output.dir" value="${dir.target.perf.cpp}"/>
<sysproperty key="sbe.target.language" value="Cpp98"/>
<arg value="${dir.resources.sbe}/fix-message-samples.xml"/>
</java>
</target>
<target name="cpp:compile" depends="clean, init, cpp:codegen">
<sequential>
<exec executable="cmake" dir="target/perf">
<arg value="../../perf/cpp"/>
</exec>
<exec executable="make" dir="target/perf"/>
</sequential>
</target>
<target name="cpp:perf:test" depends="cpp:compile">
<sequential>
<exec executable="target/perf/benchlet-sbe-md-runner"/>
<exec executable="target/perf/benchlet-sbe-car-runner"/>
</sequential>
</target>
<target name="deps:init" depends="">
<mkdir dir="${dir.deps}"/>
<mkdir dir="${dir.deps.protobuf.build}"/>
</target>
<target name="deps:clean" depends="">
<delete dir="${dir.deps}"/>
</target>
<target name="protobuf:download" depends="deps:init">
<sequential>
<local name="protobuf.name"/>
<local name="sha.fail"/>
<local name="cksum.fail"/>
<property name="protobuf.name" value="protobuf-2.5.0.tar.gz"/>
<get dest="/tmp">
<url url="https://protobuf.googlecode.com/files/${protobuf.name}"/>
</get>
<checksum file="/tmp/${protobuf.name}" algorithm="sha1" property="7f6ea7bc1382202fb1ce8c6933f1ef8fea0c0148" verifyproperty="sha.fail"/>
<condition property="cksum.fail">
<equals arg1="${sha.fail}" arg2="false"/>
</condition>
<fail if="cksum.fail">Checksum failed</fail>
<copy file="/tmp/${protobuf.name}" todir="${dir.deps.protobuf.build}"/>
</sequential>
</target>
<target name="protobuf:unpack" depends="deps:init, protobuf:download">
<!-- untar/unzip, etc. won't preserve executable bits... grumble... -->
<exec executable="tar" dir="${dir.deps.protobuf.build}" failonerror="true">
<arg value="xzf"/>
<arg value="protobuf-2.5.0.tar.gz"/>
</exec>
</target>
<target name="protobuf:build" depends="protobuf:unpack">
<sequential>
<exec executable="./configure" dir="${dir.deps.protobuf.build}/protobuf-2.5.0" output="${dir.deps.protobuf.build}/protobuf-configure.out" failonerror="true">
<arg value="--prefix=${dir.deps}/protobuf-2.5.0"/>
</exec>
<exec executable="make" dir="${dir.deps.protobuf.build}/protobuf-2.5.0" output="${dir.deps.protobuf.build}/protobuf-make.out" failonerror="true"/>
<exec executable="make" dir="${dir.deps.protobuf.build}/protobuf-2.5.0" output="${dir.deps.protobuf.build}/protobuf-make-insta.out" failonerror="true">
<arg value="install"/>
</exec>
</sequential>
</target>
</project>