My current setup:
public void launchBenchmark() throws Exception {
Options opt = new OptionsBuilder()
.include(this.getClass().getName())
.mode(Mode.Throughput) //Calculate number of operations in a time unit.
.mode(Mode.AverageTime) //Calculate an average running time per operation
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(1)
.measurementIterations(30)
.threads(Runtime.getRuntime().availableProcessors())
.forks(1)
.shouldFailOnError(true)
.shouldDoGC(true)
.build();
new Runner(opt).run();
}
How can I know/control (if possible) the number of operations is performed per benchmark ?
And is it important to set warmUp time and measurementIteration time?
Thank you.
You cannot control the number of operations per iteration. The whole point of JMH is to correctly measure that number.
You can configure the warmup using the annotation:
@Warmup(iterations = 10, time = 500, timeUnit = MILLISECONDS)
And the measurement by:
@Measurement(iterations = 200, time = 200, timeUnit = MILLISECONDS)
Just set the appropriate values for your use case
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With