AuxCounter support missing in Single Shot benchmarks

Erich Schubert schubert at informatik.uni-heidelberg.de
Fri Sep 14 12:08:50 UTC 2018


AFAICT, AuxCounters do not work in single shot benchmarks.

Why?

IMHO there are useful scenarios, for example when benchmarking the 
amount of memory used by particular data structures:

     @AuxCounters(AuxCounters.Type.EVENTS)
     @State(Scope.Thread)
     public static class Memory {
         public long totalsize;
     }

     /**
      * Memory measurement at teardown.
      *
      * @param memory
      *            Memory counter
      */
     @TearDown(Level.Iteration)
     public void memory(Memory memory) {
         memory.totalsize = 
GraphLayout.parseInstance(datastructure).totalSize();
     }

this seems to work fine with throughput benchmarks, but not with single 
shot. The teardown method is called, but the counters are not reported. 
But clearly for measuring deterministic things like memory of different 
data structures (which tend to not be micro-benchmarks) a single shot 
measurement may be fine.



More information about the jmh-dev mailing list