The benchmark is not taking into account nanoTime granularity (#9033)

Motivation:

Results are just wrong for small delays.

Modifications:

Switching to AvarageTime avoid to rely on OS nanoTime granularity.

Result:

Uncontended low delay results are not reliable
This commit is contained in:
Francesco Nigro 2019-04-15 15:14:36 +02:00 committed by Norman Maurer
parent 78be8ee2f5
commit 635fc9eae0

View File

@ -49,7 +49,7 @@ public class AbstractReferenceCountedByteBufBenchmark extends AbstractMicrobench
}
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public boolean retainReleaseUncontended() {
buf.retain();
@ -58,9 +58,9 @@ public class AbstractReferenceCountedByteBufBenchmark extends AbstractMicrobench
}
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@GroupThreads(6)
@GroupThreads(4)
public boolean retainReleaseContended() {
buf.retain();
Blackhole.consumeCPU(delay);