source: tests/scripts/benchmark.sh @ 1a49309

Last change on this file since 1a49309 was 1a49309, checked in by str4d <str4d@…>, 4 years ago

Add usage info to benchmark script

  • Property mode set to 100755
File size: 1.4 KB
RevLine 
[a06c3fe]1#!/bin/sh
2
[1a49309]3#
4# Benchmark runner
5#
6# Usage: benchmark.sh [--jbigi] [JMH_ARGS]
7#
8# To use:
9# 1) Set jmh.home in override.properties to a folder containing:
10#    - jmh-core.jar
11#    - jmh-generator-annprocess.jar
12#    - jopt-simple.jar
13#    - commons-math3.jar
14#    Fetch these from Maven Central. Tested using JMH 1.19 which requires
15#    jopt-simple 4.6 and commons-math3 3.2.
16# 2) Compile the benchmarks with "ant bench".
17# 3) Run the benchmarks:
18#    - To see underlying JMH options:
19#      - ./benchmark.sh -h
20#    - To run the benchmarks in pure-Java mode:
21#      - ./benchmark.sh
22#    - To run the benchmarks with jbigi.jar in the classpath:
23#      - ./benchmark.sh --jbigi
24#    - To run the benchmarks with a different JVM:
25#      - JAVA=/path/to/java ./benchmarks/benchmark.sh
26#
27
[a06c3fe]28CWD=$(dirname "$0")
29if [ "x$JAVA" = 'x' ]
30then
31    JAVA=java
32fi
33
[7346ce1]34if [ "x$BENCHMARKS" = 'x' ]
35then
[3d24cc9]36    BENCHMARKS="$CWD/i2p-benchmarks.jar"
[7346ce1]37    stat "$BENCHMARKS" >/dev/null 2>&1
38    if [ "x$?" != 'x0' ]
39    then
[3d24cc9]40        BENCHMARKS="$CWD/../../core/java/build/i2p-benchmarks.jar"
[7346ce1]41    fi
42fi
43
44if [ "x$JBIGI" = 'x' ]
45then
46    JBIGI="$CWD/jbigi.jar"
47    stat "$JBIGI" >/dev/null 2>&1
48    if [ "x$?" != 'x0' ]
49    then
[3d24cc9]50        JBIGI="$CWD/../../build/jbigi.jar"
[7346ce1]51    fi
52fi
53
54CLASSPATH="$BENCHMARKS"
[a06c3fe]55if [ "x${1:-}" = 'x--jbigi' ]
56then
57    CLASSPATH="$CLASSPATH:$JBIGI"
58    shift
59fi
60
[3d24cc9]61$JAVA -cp "$CLASSPATH" org.openjdk.jmh.Main "$@"
Note: See TracBrowser for help on using the repository browser.