-
Notifications
You must be signed in to change notification settings - Fork 317
/
Copy pathbenchmark.sh
executable file
·61 lines (55 loc) · 1.38 KB
/
benchmark.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
#!/bin/sh
#
# Benchmark runner
#
# Usage: benchmark.sh [--jbigi] [JMH_ARGS]
#
# To use:
# 1) Set jmh.home in override.properties to a folder containing:
# - jmh-core.jar
# - jmh-generator-annprocess.jar
# - jopt-simple.jar
# - commons-math3.jar
# Fetch these from Maven Central. Tested using JMH 1.19 which requires
# jopt-simple 4.6 and commons-math3 3.2.
# 2) Compile the benchmarks with "ant bench".
# 3) Run the benchmarks:
# - To see underlying JMH options:
# - ./benchmark.sh -h
# - To run the benchmarks in pure-Java mode:
# - ./benchmark.sh
# - To run the benchmarks with jbigi.jar in the classpath:
# - ./benchmark.sh --jbigi
# - To run the benchmarks with a different JVM:
# - JAVA=/path/to/java ./benchmarks/benchmark.sh
#
CWD=$(dirname "$0")
if [ "x$JAVA" = 'x' ]
then
JAVA=java
fi
if [ "x$BENCHMARKS" = 'x' ]
then
BENCHMARKS="$CWD/i2p-benchmarks.jar"
stat "$BENCHMARKS" >/dev/null 2>&1
if [ "x$?" != 'x0' ]
then
BENCHMARKS="$CWD/../../core/java/build/i2p-benchmarks.jar"
fi
fi
if [ "x$JBIGI" = 'x' ]
then
JBIGI="$CWD/jbigi.jar"
stat "$JBIGI" >/dev/null 2>&1
if [ "x$?" != 'x0' ]
then
JBIGI="$CWD/../../build/jbigi.jar"
fi
fi
CLASSPATH="$BENCHMARKS"
if [ "x${1:-}" = 'x--jbigi' ]
then
CLASSPATH="$CLASSPATH:$JBIGI"
shift
fi
$JAVA -cp "$CLASSPATH" org.openjdk.jmh.Main "$@"