JMH Thread index?

Aleksey Shipilev aleksey.shipilev at oracle.com
Mon May 6 03:41:35 PDT 2013


On 05/04/2013 11:36 PM, Nitsan Wakart wrote:
> Hi, Doing a writeup on using JMH for writing multi-threaded
> benchmarks. It would be very useful for my benchmark/reporting if I
> could tell in my benchmark what is the thread index and how many
> threads are participating in this run/group.

I'm not sure what thread index is, but JMH sure does show how many
threads are participating in each group. See the sample output:

$ java -jar target/microbenchmarks.jar ".*JMHSample_15_Asymmetric.*"
# Measurement Section
# Runtime (per iteration): 5s
# Iterations: 20
# Thread counts (concurrent threads per iteration): [4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
# Threads will synchronize iterations
# Running:
org.openjdk.jmh.samples.generated.avgtime.JMHSample_15_Asymmetric.g
Iteration   1 (5s in 4 threads): get{t=1} = 12.137, inc{t=3} = 207.697
nsec/op

You can see there are:
  * 4 threads total
  * get() is executed with 1 thread
  * inc() is executed with 3 threads

-Aleksey.


More information about the jmh-dev mailing list