private double x = Math.PI; @GenerateMicroBenchmark public void baseline() { // do nothing, this is a baseline } @GenerateMicroBenchmark public double measureWrong() { // This is wrong: the result is provably the same, optimized out. return Math.log(Math.PI); } @GenerateMicroBenchmark public double measureRight() { // This is correct: the result is being used. return Math.log(x); }