Checkout source code.
git clone git://github.com/atychyna/caliper-maven-plugin.git
Install it.
mvn clean install
Add following XML to your $HOME/.m2/settings.xml if you want to be able to use shortened commands like mvn caliper:run
.
<pluginGroups>
<pluginGroup>org.atychyna</pluginGroup>
<pluginGroups>
#Using
You need to have Caliper declared as a dependency in runtime or compile scope of your project (plugin's dependencyResolution = COMPILE_PLUS_RUNTIME).
To run all benchmarks (all classes that begin or end with Benchmark).
mvn compile caliper:run
To run single benchmark.
mvn -Dbenchmark=**/SpecificBenchmark* compile caliper:run
You can also run your benchmarks as a part of a build. By default plugin binds to VERIFY lifecycle phase.
<build>
<plugins>
<plugin>
<groupId>org.atychyna</groupId>
<artifactId>caliper-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<executions>
<execution>
<id>run</id>
<goals>
<goal>run</goal>
</goals>
<configuration>
<!-- see possible configuration options below -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
All configuration options (except properties and params) have command line counterparts in form of mvn -D<name>=<value>
for strings and mvn -D<name>
for booleans.
- type: String
- default: ${project.build.outputDirectory}
Where to look for compiled benchmark classes.
- type: String
- default: 30s
Maximum length of time allowed for a single trial. Use 0 to allow trials to run indefinitely.
- type: boolean
- default: false
Instead of measuring, execute a single rep for each scenario.
- type: boolean
- default: false
Fail build if benchmark throws an exception.
- type: Integer
- default: 1
Number of independent trials to peform per benchmark scenario.
- type: List<String>
- default: Caliper's default
List of measuring instruments to use.
- type: String
A user-friendly string used to identify the run.
- type: boolean
- default: false
In addition to normal console output, display a raw feed of very detailed information.
- type: String
- default: $HOME/.caliper/config.properties
Location of Caliper's configuration file.
- type: String
- default: $HOME/.caliper
Location of Caliper's configuration and data directory.
- type: boolean
- default: false
Print the effective configuration that will be used by Caliper.
- type: String
Java agent for allocation instrument. Plugin will look for agent on a classpath if not defined.
- type: List<String>
- default: Caliper's default
List of VMs to test on.
<!-- example:
if ~/.caliper/config.properties contains:
vm.jdk6.home=/path/to/jdk6
vm.jdk7.home=/path/to/jdk7
-->
<vms>
<vm>jdk6</vm>
<vm>jdk7</vm>
</vms>
- type: List<String>
Specifies a value for any property that could otherwise be specified in $HOME/.caliper/config.properties.
<properties>
<vm.jdk6.home>/path/to/jdk6</vm.jdk6.home>
<vm.jdk7.home>/path/to/jdk7</vm.jdk7.home>
</properties>
- type: List<String>
Specifies the values to inject into the 'param' field of the benchmark.
<params>
<length>1,2,3</length>
<width>2</width>
</params>
- type: List<String>
Benchmarks to include in this run. By default all classes that begin or end with Benchmark are included.
<includes>
<include>**/Bench*</include>
</includes>
- type: List<String>
Benchmarks to exclude from this run.
<excludes>
<exclude>**/DoNotRun*</exclude>
</excludes>