@Group requires Control to be used in all methods or none

Nitsan Wakart nitsanw at yahoo.com
Thu Dec 12 00:22:17 PST 2013


This:
@State(Scope.Group)
public class BaselinePingPong {
    public final AtomicBoolean flag = new AtomicBoolean();
    @GenerateMicroBenchmark
    @Group("pingpong")
    public void ping(Control cnt) {
        while (!cnt.stopMeasurement && !flag.compareAndSet(false, true)) {
            // this body is intentionally left blank
        }
    }

    @GenerateMicroBenchmark
    @Group("pingpong")
    public boolean pong() {
        return !flag.compareAndSet(true, false);
    }
}
Doesn't build (but adding the Control param makes it alright)


More information about the jmh-dev mailing list