Configuring JBench

JBench uses a normal Java properties file for configuration. Some properties affect how JBench itself works (eg which system properties to display) and some are used to configure the tasks.

Any boolean properties can be specified by true/false, yes/no, or on/off, and these values are case-insensitive.

General configuration

Property name Effect Default value
jbench.runs Number of times to run each task 5
jbench.failfast Whether or not JBench should abort completely if any of the tasks fail the configuration phase false
jbench.log Filename to save log to. If unspecified, System.out is used instead. (Unspecified)
jbench.log.append Whether or not to append to the log file (if specified - see above) rather than overwriting it true (ie append)
jbench.stats.excludeworst The number of worst results to exclude when calculating statistics 1
jbench.stats.excludebest The number of best results to exclude when calculating statistics 1
jbench.timer The timer implementation to use; either an alias (cpu and clock being supported at the moment) or the name of a class (with a public no-arg constructor) which implements uk.org.skeet.jbench.JBenchTimer. See Using the CPU timer for details of how to use the cpu value. clock
jbench.timer.* Properties to pass to the timer to configure it. Note that the jbench.timer. part is stripped off each property before being passed to BenchTimer.configure n/a
jbench.sysinfo A comma-separated list of system properties to display. Currently available properties are:
  • vmspec: virtual machine specification
  • vm: virtual machine implementation
  • os: operating system
  • jrespec: runtime environment specification
  • jre: runtime environment implementation
  • timer: timer type and granularity
vm, os, timer
jbench.packages A comma-separated list of packages to use when finding packages. In fact, this is just a list of prefixes for classnames, so using a package entry of com.mycompany and a classname of app1.Benchmark will find com.mycompany.app1.Benchmark. (The "." is automatically added at the end of each specified prefix.) An empty string is included at the end whether or not this properties is set. (None - just the empty string)

Task Configuration

Tasks are found by starting at 1 and looking for task.1.class, task.2.class etc until task.n.class isn't found for some n. (It will stop at the first number where a task isn't specified - if you only specify 1, 2 and 4, for example, JBench will only load the first two tasks.)

Loading the task consists of four steps:

If any of the steps fail, the task is not run. If jbench.failfast is set to true, this will cause the whole benchmark to stop. Note that two configured tasks may use the same class - JBench treats them as entirely separate instances. (The example configuration file shows one possible use for this. You could also give each task a different size of test in order to measure how the performance depends on size.)


JBench Manual