New benchmark modes

Nitsan Wakart nitsanw at
Wed Nov 16 11:04:30 UTC 2016

I apologize, Yahoo messed up the formatting...

Here's the suggestion, formatted as intended:

I would like to suggest/have a few new benchmark modes:
1. Histogram: This is similar to SampleTime, but I would like to always 
   I realize that pre/post timestamps may not be a good idea for small 
workloads, and that nanoTime doesn't scale.
   This is so similar to Sample that one could argue for making this a 
configurable mode of SampleTime (e.g add controls for sample probability 
and max samples per ms), I'd be happy with that solution too.
   I would also like to have the timing data recorded in HdrHistogram. 
Not that there's anything wrong with the JMH histogram, they are very 
similar, but I'd like to serialize the data in the HdrHistogram format 
to support downstream processing with other tools.
   Supporting a pluggable sink for measurements is an integration 
challenge, not sure how best to allow for that or if there's a game plan 
already in the wings.
2. Fixed rate + Histogram (response+service): JMH currently supports 
only an all-out measurement mode. I'd like to have a fixed operation 
rate mode where a given operation is executed X times a second.
   The measurement collected is both for response time(end time - 
scheduled start time) and service time(end time - actual start time). 
This to avoid coordinated omission in measurement.

I realize benchmark modes and the code generation they require is 
fundamental to the workings of JMH, I'm not sure this part can be opened 
up to extension such that the above benchmark modes can be added as 
extensions rather than included in the JMH codebase. If you see a clear 
path to openning up JMH for extension that way it might be easier to 
allow users more freedom to experiment with custom benchmark modes as 
above while retaining the benefits of the rest of JMH.
I'm happy to contribute code to enable the above.

More information about the jmh-dev mailing list