Usage of Blackhole in a loop distorts benchmark results

Сергей Цыпанов sergei.tsypanov at yandex.ru
Tue Jan 23 20:50:11 UTC 2018


All right, I've done the measurements with -prof perfasm, as it appears from the results

When I use Blackhole inside of a loop (as stated in JMHSample_34_SafeLooping.measureRight_1) I've got his output:

....[Hottest Regions]...............................................................................
 55,38%      C2, level 4  com.luxoft.logeek.benchmark.iterator.generated.IteratorFromStreamBenchmark_iteratorFromStream_jmhTest::iteratorFromStream_avgt_jmhStub, version 647 (203 bytes) 
 16,57%      C2, level 4  org.openjdk.jmh.infra.Blackhole::consume, version 607 (51 bytes) 
  9,30%                   <unknown> (0 bytes) 

for wrong way (accumulating iteration results) in local variable and returning it:

....[Hottest Regions]...............................................................................
 76,64%      C2, level 4  com.luxoft.logeek.benchmark.iterator.generated.IteratorFromStreamBenchmark_iteratorFromStream_jmhTest::iteratorFromStream_avgt_jmhStub, version 621 (93 bytes) 
  8,36%                   <unknown> (0 bytes) 
  1,01%        ntdll.dll  0x00000000777bf287 (78 bytes) 


I wonder what is <unknown>, some infrastructure costs? Is it possible to have a deeper look into the code?


P. S. Suddenly it all stopped working and now writes:

java.lang.IllegalStateException: Failed to start xperf: [xperf: error: NT Kernel Logger: Cannot create a file when that file already exists. (0xb7).

Has anyone faced it?


More information about the jmh-dev mailing list