JBench.jar
file. That's all you'll really need
just to use JBench.
java -jar JBench.jar jbench.properties
JBench.jar
in your
classpath. Unfortunately, putting JBench in your extension
directory won't work, as its classloader then won't be able to find
your task classes. With JBench in your classpath, you should use:java uk.org.skeet.jbench.JBench jbench.properties
The above examples use jbench.properties
as the configuration file,
but you can, of course, call the configuration file whatever you
like - just put it as the parameter.
When you use the first form (ie when you use the -jar
option) any classpath options you've set up for your environment are
ignored - this is just how executable jar files work. However, I
have included "." in the classpath that the jar file uses, so any
class files based in the same directory as JBench.jar
will be picked up. If you wish to use other entries in your
classpath, I suggest you put JBench.jar
in your
classpath and use the second form.
JBench.jar
, and run it using either of the
ways given above. You should get results that look something like
this:
--- JBench log Sat Aug 25 14:12:05 BST 2001 --- System properties: VM: Java HotSpot(TM) Client VM;1.3.1-b24;Sun Microsystems Inc. OS: Windows 2000;x86;5.0 Clock granularity: 10ms General Configuration: Number of test runs per task: 5 Abort on task configuration error: no Excluding worst result and best result from stats. Task configuration: Configured Collections.sort(java.util.ArrayList) size=1000000 Configured Collections.sort(java.util.Vector) size=1000000 2 tasks successfully configured. Running tests... ----------- Collections.sort(java.util.ArrayList) size=1000000 Testing..... All tests passed. Results: 4286ms [excluded] 4186ms 4186ms 4186ms 4176ms [excluded] Mean=4186; variance=0; standard deviation=0 ----------- Collections.sort(java.util.Vector) size=1000000 Testing..... All tests passed. Results: 4015ms [excluded] 4016ms 4016ms 4016ms 4026ms [excluded] Mean=4016; variance=0; standard deviation=0 -----------
(If it looks like it's hung, give it some time and watch the dots
after "Testing.."; one dot is printed for each test run - if it's going very
slowly, you may wish to decrease the size
parameters in
jbench.properties
.)
If the results don't look anything like that, and you can't work out why, mail me and I'll try to sort it out.
That's it, pretty much - you may wish to experiment with the
parameters in jbench.properties
a bit, but I expect
you'll be more interested in developing
your own tasks.