changeset 1278:1bbe29bb4639

7901502: jmh-core-benchmark validation suite updates
author shade
date Fri, 11 Sep 2015 01:16:34 +0300
parents 9afedbf3784c
children d24f71ad041e
files jmh-core-benchmarks/pom.xml jmh-core-benchmarks/src/main/java/org/openjdk/jmh/MainValidation.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/BlackholeBench.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/BlackholeConsecutiveBench.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/BlackholeConsumeCPUBench.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/BlackholePipelineBench.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/BlackholePipelinePayloadBench.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/BlackholeValueBench.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/LevelInvocationBench.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/LevelIterationBench.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/LevelTrialBench.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/ScoreStabilityBench.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/ThermalRundownBench.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/IterationScoresFormatter.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/Main.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/ValidationTest.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/tests/BlackholeConsecutiveTest.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/tests/BlackholeConsumeCPUTest.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/tests/BlackholePipelinedTest.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/tests/BlackholeSingleTest.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/tests/HelperMethodsTest.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/tests/ScoreStabilityTest.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/tests/ThermalRundownTest.java jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/tests/TimingMeasurementsTest.java jmh-core/src/main/java/org/openjdk/jmh/runner/CompilerHints.java jmh-core/src/main/java/org/openjdk/jmh/runner/options/OptionFormatter.java jmh-core/src/main/java/org/openjdk/jmh/util/Utils.java
diffstat 27 files changed, 1801 insertions(+), 653 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core-benchmarks/pom.xml	Tue Sep 08 22:32:50 2015 +0300
+++ b/jmh-core-benchmarks/pom.xml	Fri Sep 11 01:16:34 2015 +0300
@@ -114,11 +114,13 @@
                             <goal>shade</goal>
                         </goals>
                         <configuration>
-                            <finalName>validation</finalName>
+                            <finalName>jmh-core-benchmarks</finalName>
+                            <shadedArtifactAttached>true</shadedArtifactAttached>
+                            <shadedClassifierName>all</shadedClassifierName>
                             <transformers>
                                 <transformer
                                         implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                                    <mainClass>org.openjdk.jmh.MainValidation</mainClass>
+                                    <mainClass>org.openjdk.jmh.validation.Main</mainClass>
                                 </transformer>
                             </transformers>
                         </configuration>
--- a/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/MainValidation.java	Tue Sep 08 22:32:50 2015 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,232 +0,0 @@
-/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package org.openjdk.jmh;
-
-import org.openjdk.jmh.benchmarks.EmptyBench;
-import org.openjdk.jmh.benchmarks.LevelInvocationBench;
-import org.openjdk.jmh.benchmarks.LevelIterationBench;
-import org.openjdk.jmh.benchmarks.LevelTrialBench;
-import org.openjdk.jmh.benchmarks.NanoTimerBench;
-import org.openjdk.jmh.results.Result;
-import org.openjdk.jmh.results.RunResult;
-import org.openjdk.jmh.runner.Runner;
-import org.openjdk.jmh.runner.RunnerException;
-import org.openjdk.jmh.runner.options.Options;
-import org.openjdk.jmh.runner.options.OptionsBuilder;
-import org.openjdk.jmh.runner.options.TimeValue;
-import org.openjdk.jmh.runner.options.VerboseMode;
-
-import java.io.PrintWriter;
-
-public class MainValidation {
-
-    public static void main(String[] args) throws RunnerException {
-
-        PrintWriter pw = new PrintWriter(System.out, true);
-
-        pw.println("JMH Infrastructure Validation Tests");
-        pw.println("-------------------------------------------------------------------------");
-        pw.println();
-
-        Options opts = new OptionsBuilder()
-                .warmupIterations(5)
-                .warmupTime(TimeValue.milliseconds(100))
-                .measurementIterations(5)
-                .measurementTime(TimeValue.milliseconds(100))
-                .forks(3)
-                .build();
-
-        timingMeasurements(pw, opts);
-        basic(pw, opts);
-    }
-
-    private static void basic(PrintWriter pw, Options parent) throws RunnerException {
-        pw.println("Basic benchmark tests:");
-        pw.println("  These tests show the basic overheads of calling the benchmark method.");
-        pw.println("  Additionally, the overheads of calling empty Fixture methods are measured.");
-        pw.println("  ");
-
-        {
-            Options opts = new OptionsBuilder()
-                    .parent(parent)
-                    .include(EmptyBench.class.getCanonicalName())
-                    .verbosity(VerboseMode.SILENT)
-                    .build();
-
-            RunResult result = new Runner(opts).runSingle();
-            Result r = result.getPrimaryResult();
-
-            pw.printf("%50s", "running empty benchmark: ");
-            pw.flush();
-            pw.printf("%.2f +- %.2f ns\n", r.getScore(), r.getScoreError());
-        }
-
-        {
-            Options opts = new OptionsBuilder()
-                    .parent(parent)
-                    .include(LevelTrialBench.class.getCanonicalName() + ".benchmark_setup$")
-                    .verbosity(VerboseMode.SILENT)
-                    .build();
-
-            RunResult result = new Runner(opts).runSingle();
-            Result r = result.getPrimaryResult();
-
-            pw.printf("%50s", "Level.Trial, Scope.Benchmark, @Setup: ");
-            pw.flush();
-            pw.printf("%.2f +- %.2f ns\n", r.getScore(), r.getScoreError());
-        }
-
-        {
-            Options opts = new OptionsBuilder()
-                    .parent(parent)
-                    .include(LevelTrialBench.class.getCanonicalName() + ".benchmark_teardown$")
-                    .verbosity(VerboseMode.SILENT)
-                    .build();
-
-            RunResult result = new Runner(opts).runSingle();
-            Result r = result.getPrimaryResult();
-
-            pw.printf("%50s", "Level.Trial, Scope.Benchmark, @TearDown: ");
-            pw.flush();
-            pw.printf("%.2f +- %.2f ns\n", r.getScore(), r.getScoreError());
-        }
-
-        {
-            Options opts = new OptionsBuilder()
-                    .parent(parent)
-                    .include(LevelIterationBench.class.getCanonicalName() + ".benchmark_setup$")
-                    .verbosity(VerboseMode.SILENT)
-                    .build();
-
-            RunResult result = new Runner(opts).runSingle();
-            Result r = result.getPrimaryResult();
-
-            pw.printf("%50s", "Level.Iteration, Scope.Benchmark, @Setup: ");
-            pw.flush();
-            pw.printf("%.2f +- %.2f ns\n", r.getScore(), r.getScoreError());
-        }
-
-        {
-            Options opts = new OptionsBuilder()
-                    .parent(parent)
-                    .include(LevelIterationBench.class.getCanonicalName() + ".benchmark_teardown$")
-                    .verbosity(VerboseMode.SILENT)
-                    .build();
-
-            RunResult result = new Runner(opts).runSingle();
-            Result r = result.getPrimaryResult();
-
-            pw.printf("%50s", "Level.Iteration, Scope.Benchmark, @TearDown: ");
-            pw.flush();
-            pw.printf("%.2f +- %.2f ns\n", r.getScore(), r.getScoreError());
-        }
-
-        {
-            Options opts = new OptionsBuilder()
-                    .parent(parent)
-                    .include(LevelInvocationBench.class.getCanonicalName() + ".benchmark_setup$")
-                    .verbosity(VerboseMode.SILENT)
-                    .build();
-
-            RunResult result = new Runner(opts).runSingle();
-            Result r = result.getPrimaryResult();
-
-            pw.printf("%50s", "Level.Invocation, Scope.Benchmark, @Setup: ");
-            pw.flush();
-            pw.printf("%.2f +- %.2f ns\n", r.getScore(), r.getScoreError());
-        }
-
-        {
-            Options opts = new OptionsBuilder()
-                    .parent(parent)
-                    .include(LevelInvocationBench.class.getCanonicalName() + ".benchmark_teardown$")
-                    .verbosity(VerboseMode.SILENT)
-                    .build();
-
-            RunResult result = new Runner(opts).runSingle();
-            Result r = result.getPrimaryResult();
-
-            pw.printf("%50s", "Level.Invocation, Scope.Benchmark, @TearDown: ");
-            pw.flush();
-            pw.printf("%.2f +- %.2f ns\n", r.getScore(), r.getScoreError());
-        }
-
-        pw.println();
-    }
-
-    private static void timingMeasurements(PrintWriter pw, Options parent) throws RunnerException {
-        pw.println("Timing measurements test");
-        pw.println("  This test shows the minimal individual timing possible to measure.");
-        pw.println("  This normally affects only SampleTime and SingleShot benchmark modes.");
-        pw.println("  Throughput/AverageTime tests can do better since they do only a few");
-        pw.println("  timestamps before and after the complete iteration.");
-        pw.println("  ");
-
-        long latency;
-        {
-            Options opts = new OptionsBuilder()
-                    .parent(parent)
-                    .include(NanoTimerBench.class.getCanonicalName() + ".latency$")
-                    .verbosity(VerboseMode.SILENT)
-                    .build();
-
-            RunResult result = new Runner(opts).runSingle();
-            Result r = result.getPrimaryResult();
-
-            pw.printf("%50s", "System.nanoTime latency: ");
-            pw.flush();
-            pw.printf("%.2f +- %.2f ns\n", r.getScore(), r.getScoreError());
-
-            latency = (long) r.getScore();
-        }
-
-        long granularity;
-        {
-            Options opts = new OptionsBuilder()
-                    .parent(parent)
-                    .include(NanoTimerBench.class.getCanonicalName() + ".granularity$")
-                    .verbosity(VerboseMode.SILENT)
-                    .build();
-
-            RunResult result = new Runner(opts).runSingle();
-            Result r = result.getPrimaryResult();
-
-            pw.printf("%50s", "System.nanoTime granularity: ");
-            pw.flush();
-            pw.printf("%.2f +- %.2f ns\n", r.getScore(), r.getScoreError());
-            granularity = (long) r.getScore();
-        }
-
-        pw.println();
-        pw.printf("   Verdict: ");
-        if (latency < 100 && granularity < 100) {
-            pw.println("OK!");
-        } else {
-            pw.println("WARNING, latency and/or granularity is suspiciously high.");
-        }
-        pw.println();
-    }
-
-}
--- a/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/BlackholeBench.java	Tue Sep 08 22:32:50 2015 +0300
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/BlackholeBench.java	Fri Sep 11 01:16:34 2015 +0300
@@ -24,14 +24,7 @@
  */
 package org.openjdk.jmh.benchmarks;
 
-import org.openjdk.jmh.annotations.Benchmark;
-import org.openjdk.jmh.annotations.BenchmarkMode;
-import org.openjdk.jmh.annotations.Level;
-import org.openjdk.jmh.annotations.Mode;
-import org.openjdk.jmh.annotations.OutputTimeUnit;
-import org.openjdk.jmh.annotations.Scope;
-import org.openjdk.jmh.annotations.Setup;
-import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.*;
 import org.openjdk.jmh.infra.Blackhole;
 
 import java.util.ArrayList;
@@ -71,102 +64,102 @@
     }
 
     @Benchmark
-    public byte implicit_testByte() {
+    public byte implicit_byte() {
         return b;
     }
 
     @Benchmark
-    public boolean implicit_testBoolean() {
+    public boolean implicit_boolean() {
         return bool;
     }
 
     @Benchmark
-    public char implicit_testChar() {
+    public char implicit_char() {
         return c;
     }
 
     @Benchmark
-    public short implicit_testShort() {
+    public short implicit_short() {
         return s;
     }
 
     @Benchmark
-    public int implicit_testInt() {
+    public int implicit_int() {
         return i;
     }
 
     @Benchmark
-    public long implicit_testLong() {
+    public long implicit_long() {
         return l;
     }
 
     @Benchmark
-    public float implicit_testFloat() {
+    public float implicit_float() {
         return f;
     }
 
     @Benchmark
-    public double implicit_testDouble() {
+    public double implicit_double() {
         return d;
     }
 
     @Benchmark
-    public Object implicit_testObject() {
+    public Object implicit_Object() {
         return o;
     }
 
     @Benchmark
-    public Object[] implicit_testArray() {
+    public Object[] implicit_Array() {
         return os;
     }
 
     @Benchmark
-    public void explicit_testByte(Blackhole bh) {
+    public void explicit_byte(Blackhole bh) {
         bh.consume(b);
     }
 
     @Benchmark
-    public void explicit_testBoolean(Blackhole bh) {
+    public void explicit_boolean(Blackhole bh) {
         bh.consume(bool);
     }
 
     @Benchmark
-    public void explicit_testChar(Blackhole bh) {
+    public void explicit_char(Blackhole bh) {
         bh.consume(c);
     }
 
     @Benchmark
-    public void explicit_testShort(Blackhole bh) {
+    public void explicit_short(Blackhole bh) {
         bh.consume(s);
     }
 
     @Benchmark
-    public void explicit_testInt(Blackhole bh) {
+    public void explicit_int(Blackhole bh) {
         bh.consume(i);
     }
 
     @Benchmark
-    public void explicit_testLong(Blackhole bh) {
+    public void explicit_long(Blackhole bh) {
         bh.consume(l);
     }
 
     @Benchmark
-    public void explicit_testFloat(Blackhole bh) {
+    public void explicit_float(Blackhole bh) {
         bh.consume(f);
     }
 
     @Benchmark
-    public void explicit_testDouble(Blackhole bh) {
+    public void explicit_double(Blackhole bh) {
         bh.consume(d);
     }
 
     @Benchmark
-    public void explicit_testObject(Blackhole bh) {
+    public void explicit_Object(Blackhole bh) {
         bh.consume(o);
     }
 
     @Benchmark
-    public void explicit_testArray(Blackhole bh) {
+    public void explicit_Array(Blackhole bh) {
         bh.consume(os);
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/BlackholeConsecutiveBench.java	Fri Sep 11 01:16:34 2015 +0300
@@ -0,0 +1,300 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jmh.benchmarks;
+
+import org.openjdk.jmh.annotations.*;
+import org.openjdk.jmh.infra.Blackhole;
+
+import java.util.concurrent.TimeUnit;
+
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@BenchmarkMode(Mode.AverageTime)
+@State(Scope.Thread)
+public class BlackholeConsecutiveBench {
+
+    private int x = 4242;
+    private int y = 1414;
+
+    @Benchmark
+    public void test_boolean_1(Blackhole bh) {
+        bh.consume((x / y + 1331) > 0);
+    }
+
+    @Benchmark
+    public void test_boolean_4(Blackhole bh) {
+        bh.consume((x / y + 1331) > 0);
+        bh.consume((x / y + 1331) > 0);
+        bh.consume((x / y + 1331) > 0);
+        bh.consume((x / y + 1331) > 0);
+    }
+
+    @Benchmark
+    public void test_boolean_8(Blackhole bh) {
+        bh.consume((x / y + 1331) > 0);
+        bh.consume((x / y + 1331) > 0);
+        bh.consume((x / y + 1331) > 0);
+        bh.consume((x / y + 1331) > 0);
+
+        bh.consume((x / y + 1331) > 0);
+        bh.consume((x / y + 1331) > 0);
+        bh.consume((x / y + 1331) > 0);
+        bh.consume((x / y + 1331) > 0);
+    }
+
+    @Benchmark
+    public void test_byte_1(Blackhole bh) {
+        bh.consume((byte) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_byte_4(Blackhole bh) {
+        bh.consume((byte) (x / y + 1331));
+        bh.consume((byte) (x / y + 1331));
+        bh.consume((byte) (x / y + 1331));
+        bh.consume((byte) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_byte_8(Blackhole bh) {
+        bh.consume((byte) (x / y + 1331));
+        bh.consume((byte) (x / y + 1331));
+        bh.consume((byte) (x / y + 1331));
+        bh.consume((byte) (x / y + 1331));
+
+        bh.consume((byte) (x / y + 1331));
+        bh.consume((byte) (x / y + 1331));
+        bh.consume((byte) (x / y + 1331));
+        bh.consume((byte) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_short_1(Blackhole bh) {
+        bh.consume((short) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_short_4(Blackhole bh) {
+        bh.consume((short) (x / y + 1331));
+        bh.consume((short) (x / y + 1331));
+        bh.consume((short) (x / y + 1331));
+        bh.consume((short) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_short_8(Blackhole bh) {
+        bh.consume((short) (x / y + 1331));
+        bh.consume((short) (x / y + 1331));
+        bh.consume((short) (x / y + 1331));
+        bh.consume((short) (x / y + 1331));
+
+        bh.consume((short) (x / y + 1331));
+        bh.consume((short) (x / y + 1331));
+        bh.consume((short) (x / y + 1331));
+        bh.consume((short) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_char_1(Blackhole bh) {
+        bh.consume((char) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_char_4(Blackhole bh) {
+        bh.consume((char) (x / y + 1331));
+        bh.consume((char) (x / y + 1331));
+        bh.consume((char) (x / y + 1331));
+        bh.consume((char) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_char_8(Blackhole bh) {
+        bh.consume((char) (x / y + 1331));
+        bh.consume((char) (x / y + 1331));
+        bh.consume((char) (x / y + 1331));
+        bh.consume((char) (x / y + 1331));
+
+        bh.consume((char) (x / y + 1331));
+        bh.consume((char) (x / y + 1331));
+        bh.consume((char) (x / y + 1331));
+        bh.consume((char) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_int_1(Blackhole bh) {
+        bh.consume((int) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_int_4(Blackhole bh) {
+        bh.consume((int) (x / y + 1331));
+        bh.consume((int) (x / y + 1331));
+        bh.consume((int) (x / y + 1331));
+        bh.consume((int) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_int_8(Blackhole bh) {
+        bh.consume((int) (x / y + 1331));
+        bh.consume((int) (x / y + 1331));
+        bh.consume((int) (x / y + 1331));
+        bh.consume((int) (x / y + 1331));
+
+        bh.consume((int) (x / y + 1331));
+        bh.consume((int) (x / y + 1331));
+        bh.consume((int) (x / y + 1331));
+        bh.consume((int) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_float_1(Blackhole bh) {
+        bh.consume((float) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_float_4(Blackhole bh) {
+        bh.consume((float) (x / y + 1331));
+        bh.consume((float) (x / y + 1331));
+        bh.consume((float) (x / y + 1331));
+        bh.consume((float) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_float_8(Blackhole bh) {
+        bh.consume((float) (x / y + 1331));
+        bh.consume((float) (x / y + 1331));
+        bh.consume((float) (x / y + 1331));
+        bh.consume((float) (x / y + 1331));
+
+        bh.consume((float) (x / y + 1331));
+        bh.consume((float) (x / y + 1331));
+        bh.consume((float) (x / y + 1331));
+        bh.consume((float) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_long_1(Blackhole bh) {
+        bh.consume((long) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_long_4(Blackhole bh) {
+        bh.consume((long) (x / y + 1331));
+        bh.consume((long) (x / y + 1331));
+        bh.consume((long) (x / y + 1331));
+        bh.consume((long) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_long_8(Blackhole bh) {
+        bh.consume((long) (x / y + 1331));
+        bh.consume((long) (x / y + 1331));
+        bh.consume((long) (x / y + 1331));
+        bh.consume((long) (x / y + 1331));
+
+        bh.consume((long) (x / y + 1331));
+        bh.consume((long) (x / y + 1331));
+        bh.consume((long) (x / y + 1331));
+        bh.consume((long) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_double_1(Blackhole bh) {
+        bh.consume((double) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_double_4(Blackhole bh) {
+        bh.consume((double) (x / y + 1331));
+        bh.consume((double) (x / y + 1331));
+        bh.consume((double) (x / y + 1331));
+        bh.consume((double) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_double_8(Blackhole bh) {
+        bh.consume((double) (x / y + 1331));
+        bh.consume((double) (x / y + 1331));
+        bh.consume((double) (x / y + 1331));
+        bh.consume((double) (x / y + 1331));
+
+        bh.consume((double) (x / y + 1331));
+        bh.consume((double) (x / y + 1331));
+        bh.consume((double) (x / y + 1331));
+        bh.consume((double) (x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_Object_1(Blackhole bh) {
+        bh.consume(Double.valueOf(x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_Object_4(Blackhole bh) {
+        bh.consume(Double.valueOf(x / y + 1331));
+        bh.consume(Double.valueOf(x / y + 1331));
+        bh.consume(Double.valueOf(x / y + 1331));
+        bh.consume(Double.valueOf(x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_Object_8(Blackhole bh) {
+        bh.consume(Double.valueOf(x / y + 1331));
+        bh.consume(Double.valueOf(x / y + 1331));
+        bh.consume(Double.valueOf(x / y + 1331));
+        bh.consume(Double.valueOf(x / y + 1331));
+
+        bh.consume(Double.valueOf(x / y + 1331));
+        bh.consume(Double.valueOf(x / y + 1331));
+        bh.consume(Double.valueOf(x / y + 1331));
+        bh.consume(Double.valueOf(x / y + 1331));
+    }
+
+    @Benchmark
+    public void test_Array_1(Blackhole bh) {
+        bh.consume(new Double[]{Double.valueOf(x / y + 1331)});
+    }
+
+    @Benchmark
+    public void test_Array_4(Blackhole bh) {
+        bh.consume(new Double[]{Double.valueOf(x / y + 1331)});
+        bh.consume(new Double[]{Double.valueOf(x / y + 1331)});
+        bh.consume(new Double[]{Double.valueOf(x / y + 1331)});
+        bh.consume(new Double[]{Double.valueOf(x / y + 1331)});
+    }
+
+    @Benchmark
+    public void test_Array_8(Blackhole bh) {
+        bh.consume(new Double[]{Double.valueOf(x / y + 1331)});
+        bh.consume(new Double[]{Double.valueOf(x / y + 1331)});
+        bh.consume(new Double[]{Double.valueOf(x / y + 1331)});
+        bh.consume(new Double[]{Double.valueOf(x / y + 1331)});
+
+        bh.consume(new Double[]{Double.valueOf(x / y + 1331)});
+        bh.consume(new Double[]{Double.valueOf(x / y + 1331)});
+        bh.consume(new Double[]{Double.valueOf(x / y + 1331)});
+        bh.consume(new Double[]{Double.valueOf(x / y + 1331)});
+    }
+
+}
--- a/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/BlackholeConsumeCPUBench.java	Tue Sep 08 22:32:50 2015 +0300
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/BlackholeConsumeCPUBench.java	Fri Sep 11 01:16:34 2015 +0300
@@ -24,14 +24,7 @@
  */
 package org.openjdk.jmh.benchmarks;
 
-import org.openjdk.jmh.annotations.Benchmark;
-import org.openjdk.jmh.annotations.BenchmarkMode;
-import org.openjdk.jmh.annotations.Fork;
-import org.openjdk.jmh.annotations.Measurement;
-import org.openjdk.jmh.annotations.Mode;
-import org.openjdk.jmh.annotations.OperationsPerInvocation;
-import org.openjdk.jmh.annotations.OutputTimeUnit;
-import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.annotations.*;
 import org.openjdk.jmh.infra.Blackhole;
 
 import java.util.concurrent.TimeUnit;
@@ -41,113 +34,14 @@
 @Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
 @Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
 @Fork(3)
+@State(Scope.Benchmark)
 public class BlackholeConsumeCPUBench {
 
-    @Benchmark
-    @OperationsPerInvocation(1)
-    public void consume_00000() {
-        Blackhole.consumeCPU(0);
-    }
+    @Param("0")
+    private int delay;
 
     @Benchmark
-    @OperationsPerInvocation(1)
-    public void consume_00001() {
-        Blackhole.consumeCPU(1);
-    }
-
-    @Benchmark
-    @OperationsPerInvocation(2)
-    public void consume_00002() {
-        Blackhole.consumeCPU(2);
-    }
-
-    @Benchmark
-    @OperationsPerInvocation(4)
-    public void consume_00004() {
-        Blackhole.consumeCPU(4);
-    }
-
-    @Benchmark
-    @OperationsPerInvocation(8)
-    public void consume_00008() {
-        Blackhole.consumeCPU(8);
-    }
-
-    @Benchmark
-    @OperationsPerInvocation(16)
-    public void consume_00016() {
-        Blackhole.consumeCPU(16);
-    }
-
-    @Benchmark
-    @OperationsPerInvocation(32)
-    public void consume_00032() {
-        Blackhole.consumeCPU(32);
-    }
-
-    @Benchmark
-    @OperationsPerInvocation(64)
-    public void consume_00064() {
-        Blackhole.consumeCPU(64);
-    }
-
-    @Benchmark
-    @OperationsPerInvocation(128)
-    public void consume_00128() {
-        Blackhole.consumeCPU(128);
-    }
-
-    @Benchmark
-    @OperationsPerInvocation(256)
-    public void consume_00256() {
-        Blackhole.consumeCPU(256);
-    }
-
-    @Benchmark
-    @OperationsPerInvocation(512)
-    public void consume_00512() {
-        Blackhole.consumeCPU(512);
-    }
-
-    @Benchmark
-    @OperationsPerInvocation(1024)
-    public void consume_01024() {
-        Blackhole.consumeCPU(1024);
-    }
-
-    @Benchmark
-    @OperationsPerInvocation(2048)
-    public void consume_02048() {
-        Blackhole.consumeCPU(2048);
-    }
-
-    @Benchmark
-    @OperationsPerInvocation(4096)
-    public void consume_04096() {
-        Blackhole.consumeCPU(4096);
-    }
-
-    @Benchmark
-    @OperationsPerInvocation(8192)
-    public void consume_08192() {
-        Blackhole.consumeCPU(8192);
-    }
-
-    @Benchmark
-    @OperationsPerInvocation(16384)
-    public void consume_16384() {
-        Blackhole.consumeCPU(16384);
-    }
-
-    @Benchmark
-    @OperationsPerInvocation(32768)
-    public void consume_32768() {
-        Blackhole.consumeCPU(32768);
-    }
-
-    @Benchmark
-    @OperationsPerInvocation(65536)
-    public void consume_65536() {
-        Blackhole.consumeCPU(65536);
+    public void consume() {
+        Blackhole.consumeCPU(delay);
     }
 }
--- a/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/BlackholePipelineBench.java	Tue Sep 08 22:32:50 2015 +0300
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/BlackholePipelineBench.java	Fri Sep 11 01:16:34 2015 +0300
@@ -24,16 +24,10 @@
  */
 package org.openjdk.jmh.benchmarks;
 
-import org.openjdk.jmh.annotations.Benchmark;
-import org.openjdk.jmh.annotations.BenchmarkMode;
-import org.openjdk.jmh.annotations.Mode;
-import org.openjdk.jmh.annotations.OperationsPerInvocation;
-import org.openjdk.jmh.annotations.OutputTimeUnit;
-import org.openjdk.jmh.annotations.Scope;
-import org.openjdk.jmh.annotations.Setup;
-import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.*;
 import org.openjdk.jmh.infra.Blackhole;
 
+import java.util.Random;
 import java.util.concurrent.TimeUnit;
 
 @State(Scope.Thread)
@@ -41,73 +35,115 @@
 @OutputTimeUnit(TimeUnit.NANOSECONDS)
 public class BlackholePipelineBench {
 
-    private Integer[] data;
+    @Param("10")
+    private int steps;
+
+    private boolean[] booleans;
+    private byte[] bytes;
+    private short[] shorts;
+    private char[] chars;
+    private int[] ints;
+    private float[] floats;
+    private long[] longs;
+    private double[] doubles;
+    private Object[] objects;
+    private Object[][] arrays;
 
     @Setup
     public void prepare() {
-        data = new Integer[1000];
-        for (int c = 0; c < 1000; c++) {
-            data[c] = new Integer(c);
+        booleans = new boolean[steps];
+        bytes = new byte[steps];
+        shorts = new short[steps];
+        chars = new char[steps];
+        ints = new int[steps];
+        floats = new float[steps];
+        longs = new long[steps];
+        doubles = new double[steps];
+        objects = new Object[steps];
+        arrays = new Object[steps][];
+
+        Random r = new Random(0);
+        for (int c = 0; c < steps; c++) {
+            booleans[c] = r.nextBoolean();
+            bytes[c] = (byte) r.nextInt();
+            shorts[c] = (short) r.nextInt();
+            chars[c] = (char) r.nextInt();
+            ints[c] = r.nextInt();
+            floats[c] = r.nextFloat();
+            longs[c] = r.nextLong();
+            doubles[c] = r.nextDouble();
+            objects[c] = new Object();
+            arrays[c] = new Object[10];
         }
     }
 
     @Benchmark
-    @OperationsPerInvocation(1)
-    public void test_Obj_1(Blackhole bh) {
-        doTestObj(bh, 1);
+    public void test_boolean(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume(booleans[c]);
+        }
     }
 
     @Benchmark
-    @OperationsPerInvocation(10)
-    public void test_Obj_10(Blackhole bh) {
-        doTestObj(bh, 10);
+    public void test_byte(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume(bytes[c]);
+        }
     }
 
     @Benchmark
-    @OperationsPerInvocation(100)
-    public void test_Obj_100(Blackhole bh) {
-        doTestObj(bh, 100);
+    public void test_short(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume(shorts[c]);
+        }
     }
 
     @Benchmark
-    @OperationsPerInvocation(1000)
-    public void test_Obj_1000(Blackhole bh) {
-        doTestObj(bh, 1000);
+    public void test_char(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume(chars[c]);
+        }
     }
 
     @Benchmark
-    @OperationsPerInvocation(1)
-    public void test_Int_1(Blackhole bh) {
-        doTestInt(bh, 1);
+    public void test_int(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume(ints[c]);
+        }
     }
 
     @Benchmark
-    @OperationsPerInvocation(10)
-    public void test_Int_10(Blackhole bh) {
-        doTestInt(bh, 10);
+    public void test_float(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume(floats[c]);
+        }
     }
 
     @Benchmark
-    @OperationsPerInvocation(100)
-    public void test_Int_100(Blackhole bh) {
-        doTestInt(bh, 100);
+    public void test_long(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume(longs[c]);
+        }
     }
 
     @Benchmark
-    @OperationsPerInvocation(1000)
-    public void test_Int_1000(Blackhole bh) {
-        doTestInt(bh, 1000);
-    }
-
-    public void doTestObj(Blackhole bh, int count) {
-        for (int c = 0; c < count; c++) {
-            bh.consume(data[c]);
+    public void test_double(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume(doubles[c]);
         }
     }
 
-    public void doTestInt(Blackhole bh, int count) {
-        for (int c = 0; c < count; c++) {
-            bh.consume(data[c].intValue());
+    @Benchmark
+    public void test_Object(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume(objects[c]);
+        }
+    }
+
+    @Benchmark
+    public void test_Array(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume(arrays[c]);
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/BlackholePipelinePayloadBench.java	Fri Sep 11 01:16:34 2015 +0300
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jmh.benchmarks;
+
+import org.openjdk.jmh.annotations.*;
+import org.openjdk.jmh.infra.Blackhole;
+
+import java.util.concurrent.TimeUnit;
+
+@State(Scope.Thread)
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+public class BlackholePipelinePayloadBench {
+
+    @Param("10")
+    private int steps;
+
+    private boolean[] booleans;
+    private byte[] bytes;
+    private short[] shorts;
+    private char[] chars;
+    private int[] ints;
+    private float[] floats;
+    private long[] longs;
+    private double[] doubles;
+    private Double[] objects;
+    private Double[][] arrays;
+
+    @Setup
+    public void prepare() {
+        booleans = new boolean[steps];
+        bytes = new byte[steps];
+        shorts = new short[steps];
+        chars = new char[steps];
+        ints = new int[steps];
+        floats = new float[steps];
+        longs = new long[steps];
+        doubles = new double[steps];
+        objects = new Double[steps];
+        arrays = new Double[steps][];
+
+        for (int c = 0; c < steps; c++) {
+            booleans[c] = ((c & 1) == 0);
+            bytes[c] = (byte) c;
+            shorts[c] = (short) c;
+            chars[c] = (char) c;
+            ints[c] = c;
+            floats[c] = c;
+            longs[c] = c;
+            doubles[c] = c;
+            objects[c] = (double) c;
+            arrays[c] = new Double[]{Double.valueOf(c)};
+        }
+    }
+
+    @Benchmark
+    public void test_boolean(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume((Math.log(doubles[c]) > 1) ^ booleans[c]);
+        }
+    }
+
+    @Benchmark
+    public void test_byte(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume((byte)Math.log(bytes[c]));
+        }
+    }
+
+    @Benchmark
+    public void test_short(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume((short)Math.log(shorts[c]));
+        }
+    }
+
+    @Benchmark
+    public void test_char(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume((char)Math.log(chars[c]));
+        }
+    }
+
+    @Benchmark
+    public void test_int(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume((int)Math.log(ints[c]));
+        }
+    }
+
+    @Benchmark
+    public void test_float(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume((float)Math.log(floats[c]));
+        }
+    }
+
+    @Benchmark
+    public void test_long(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume((long)Math.log(longs[c]));
+        }
+    }
+
+    @Benchmark
+    public void test_double(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume((double)Math.log(doubles[c]));
+        }
+    }
+
+    @Benchmark
+    public void test_Object(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume((Double) Math.log(objects[c]));
+        }
+    }
+
+    @Benchmark
+    public void test_Array(Blackhole bh) {
+        for (int c = 0; c < steps; c++) {
+            bh.consume(new Double[] {Math.log(arrays[c][0])});
+        }
+    }
+
+}
--- a/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/BlackholeValueBench.java	Tue Sep 08 22:32:50 2015 +0300
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/BlackholeValueBench.java	Fri Sep 11 01:16:34 2015 +0300
@@ -24,13 +24,10 @@
  */
 package org.openjdk.jmh.benchmarks;
 
-import org.openjdk.jmh.annotations.BenchmarkMode;
-import org.openjdk.jmh.annotations.Benchmark;
-import org.openjdk.jmh.annotations.Mode;
-import org.openjdk.jmh.annotations.OutputTimeUnit;
-import org.openjdk.jmh.annotations.Scope;
-import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.*;
+import org.openjdk.jmh.infra.Blackhole;
 
+import java.util.Random;
 import java.util.concurrent.TimeUnit;
 
 @OutputTimeUnit(TimeUnit.NANOSECONDS)
@@ -44,17 +41,21 @@
     // Normally, this is solved with more forks, whereas Blackhole
     // randomizes the value it matches against.
 
-    private boolean x1 = true;
-    private boolean x2 = false;
+    boolean[] array = new boolean[1000];
 
-    @Benchmark
-    public boolean test1() {
-        return x1;
+    @Setup
+    public void setup() {
+        Random random = new Random(0);
+        for (int i = 0; i < array.length; i++) {
+            array[i] = random.nextBoolean();
+        }
     }
 
     @Benchmark
-    public boolean test2() {
-        return x2;
+    public void test(Blackhole bh) {
+        for (boolean b : array) {
+            bh.consume(b);
+        }
     }
 
 }
--- a/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/LevelInvocationBench.java	Tue Sep 08 22:32:50 2015 +0300
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/LevelInvocationBench.java	Fri Sep 11 01:16:34 2015 +0300
@@ -24,18 +24,7 @@
  */
 package org.openjdk.jmh.benchmarks;
 
-import org.openjdk.jmh.annotations.BenchmarkMode;
-import org.openjdk.jmh.annotations.Benchmark;
-import org.openjdk.jmh.annotations.Group;
-import org.openjdk.jmh.annotations.Level;
-import org.openjdk.jmh.annotations.Measurement;
-import org.openjdk.jmh.annotations.Mode;
-import org.openjdk.jmh.annotations.OutputTimeUnit;
-import org.openjdk.jmh.annotations.Scope;
-import org.openjdk.jmh.annotations.Setup;
-import org.openjdk.jmh.annotations.State;
-import org.openjdk.jmh.annotations.TearDown;
-import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.annotations.*;
 
 import java.util.concurrent.TimeUnit;
 
@@ -46,15 +35,6 @@
 public class LevelInvocationBench {
 
     @State(Scope.Benchmark)
-    public static class BenchmarkSetupTeardown {
-        @Setup(Level.Invocation)
-        public void setup() {}
-
-        @TearDown(Level.Invocation)
-        public void tearDown() {}
-    }
-
-    @State(Scope.Benchmark)
     public static class BenchmarkSetup {
         @Setup(Level.Invocation)
         public void setup() {}
@@ -67,15 +47,6 @@
     }
 
     @State(Scope.Thread)
-    public static class ThreadSetupTeardown {
-        @Setup(Level.Invocation)
-        public void setup() {}
-
-        @TearDown(Level.Invocation)
-        public void tearDown() {}
-    }
-
-    @State(Scope.Thread)
     public static class ThreadSetup {
         @Setup(Level.Invocation)
         public void setup() {}
@@ -88,15 +59,6 @@
     }
 
     @State(Scope.Group)
-    public static class GroupSetupTeardown {
-        @Setup(Level.Invocation)
-        public void setup() {}
-
-        @TearDown(Level.Invocation)
-        public void tearDown() {}
-    }
-
-    @State(Scope.Group)
     public static class GroupSetup {
         @Setup(Level.Invocation)
         public void setup() {}
@@ -115,28 +77,26 @@
     }
 
     @Benchmark
-    public void benchmark_setup_teardown(BenchmarkSetupTeardown g) {}
-
-    @Benchmark
     public void benchmark_setup(BenchmarkSetup g) {}
 
     @Benchmark
     public void benchmark_teardown(BenchmarkTeardown g) {}
 
     @Benchmark
-    @Group("T1")
-    public void group_setup_teardown(GroupSetupTeardown g) {}
+    @Group("group_setup")
+    public void group_setup_1(GroupSetup g) {}
 
     @Benchmark
-    @Group("T2")
-    public void group_setup(GroupSetup g) {}
+    @Group("group_setup")
+    public void group_setup_2(GroupSetup g) {}
 
     @Benchmark
-    @Group("T3")
-    public void group_teardown(GroupTeardown g) {}
+    @Group("group_teardown")
+    public void group_teardown_1(GroupTeardown g) {}
 
     @Benchmark
-    public void thread_setup_teardown(ThreadSetupTeardown g) {}
+    @Group("group_teardown")
+    public void group_teardown_2(GroupTeardown g) {}
 
     @Benchmark
     public void thread_setup(ThreadSetup g) {}
--- a/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/LevelIterationBench.java	Tue Sep 08 22:32:50 2015 +0300
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/LevelIterationBench.java	Fri Sep 11 01:16:34 2015 +0300
@@ -24,18 +24,7 @@
  */
 package org.openjdk.jmh.benchmarks;
 
-import org.openjdk.jmh.annotations.Benchmark;
-import org.openjdk.jmh.annotations.BenchmarkMode;
-import org.openjdk.jmh.annotations.Group;
-import org.openjdk.jmh.annotations.Level;
-import org.openjdk.jmh.annotations.Measurement;
-import org.openjdk.jmh.annotations.Mode;
-import org.openjdk.jmh.annotations.OutputTimeUnit;
-import org.openjdk.jmh.annotations.Scope;
-import org.openjdk.jmh.annotations.Setup;
-import org.openjdk.jmh.annotations.State;
-import org.openjdk.jmh.annotations.TearDown;
-import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.annotations.*;
 
 import java.util.concurrent.TimeUnit;
 
@@ -46,15 +35,6 @@
 public class LevelIterationBench {
 
     @State(Scope.Benchmark)
-    public static class BenchmarkSetupTeardown {
-        @Setup(Level.Iteration)
-        public void setup() {}
-
-        @TearDown(Level.Iteration)
-        public void tearDown() {}
-    }
-
-    @State(Scope.Benchmark)
     public static class BenchmarkSetup {
         @Setup(Level.Iteration)
         public void setup() {}
@@ -67,15 +47,6 @@
     }
 
     @State(Scope.Thread)
-    public static class ThreadSetupTeardown {
-        @Setup(Level.Iteration)
-        public void setup() {}
-
-        @TearDown(Level.Iteration)
-        public void tearDown() {}
-    }
-
-    @State(Scope.Thread)
     public static class ThreadSetup {
         @Setup(Level.Iteration)
         public void setup() {}
@@ -88,15 +59,6 @@
     }
 
     @State(Scope.Group)
-    public static class GroupSetupTeardown {
-        @Setup(Level.Iteration)
-        public void setup() {}
-
-        @TearDown(Level.Iteration)
-        public void tearDown() {}
-    }
-
-    @State(Scope.Group)
     public static class GroupSetup {
         @Setup(Level.Iteration)
         public void setup() {}
@@ -115,28 +77,26 @@
     }
 
     @Benchmark
-    public void benchmark_setup_teardown(BenchmarkSetupTeardown g) {}
-
-    @Benchmark
     public void benchmark_setup(BenchmarkSetup g) {}
 
     @Benchmark
     public void benchmark_teardown(BenchmarkTeardown g) {}
 
     @Benchmark
-    @Group("T1")
-    public void group_setup_teardown(GroupSetupTeardown g) {}
+    @Group("group_setup")
+    public void group_setup_1(GroupSetup g) {}
 
     @Benchmark
-    @Group("T2")
-    public void group_setup(GroupSetup g) {}
+    @Group("group_setup")
+    public void group_setup_2(GroupSetup g) {}
 
     @Benchmark
-    @Group("T3")
-    public void group_teardown(GroupTeardown g) {}
+    @Group("group_teardown")
+    public void group_teardown_1(GroupTeardown g) {}
 
     @Benchmark
-    public void thread_setup_teardown(ThreadSetupTeardown g) {}
+    @Group("group_teardown")
+    public void group_teardown_2(GroupTeardown g) {}
 
     @Benchmark
     public void thread_setup(ThreadSetup g) {}
--- a/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/LevelTrialBench.java	Tue Sep 08 22:32:50 2015 +0300
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/LevelTrialBench.java	Fri Sep 11 01:16:34 2015 +0300
@@ -24,18 +24,7 @@
  */
 package org.openjdk.jmh.benchmarks;
 
-import org.openjdk.jmh.annotations.Benchmark;
-import org.openjdk.jmh.annotations.BenchmarkMode;
-import org.openjdk.jmh.annotations.Group;
-import org.openjdk.jmh.annotations.Level;
-import org.openjdk.jmh.annotations.Measurement;
-import org.openjdk.jmh.annotations.Mode;
-import org.openjdk.jmh.annotations.OutputTimeUnit;
-import org.openjdk.jmh.annotations.Scope;
-import org.openjdk.jmh.annotations.Setup;
-import org.openjdk.jmh.annotations.State;
-import org.openjdk.jmh.annotations.TearDown;
-import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.annotations.*;
 
 import java.util.concurrent.TimeUnit;
 
@@ -46,15 +35,6 @@
 public class LevelTrialBench {
 
     @State(Scope.Benchmark)
-    public static class BenchmarkSetupTeardown {
-        @Setup(Level.Trial)
-        public void setup() {}
-
-        @TearDown(Level.Trial)
-        public void tearDown() {}
-    }
-
-    @State(Scope.Benchmark)
     public static class BenchmarkSetup {
         @Setup(Level.Trial)
         public void setup() {}
@@ -67,15 +47,6 @@
     }
 
     @State(Scope.Thread)
-    public static class ThreadSetupTeardown {
-        @Setup(Level.Trial)
-        public void setup() {}
-
-        @TearDown(Level.Trial)
-        public void tearDown() {}
-    }
-
-    @State(Scope.Thread)
     public static class ThreadSetup {
         @Setup(Level.Trial)
         public void setup() {}
@@ -88,15 +59,6 @@
     }
 
     @State(Scope.Group)
-    public static class GroupSetupTeardown {
-        @Setup(Level.Trial)
-        public void setup() {}
-
-        @TearDown(Level.Trial)
-        public void tearDown() {}
-    }
-
-    @State(Scope.Group)
     public static class GroupSetup {
         @Setup(Level.Trial)
         public void setup() {}
@@ -115,28 +77,26 @@
     }
 
     @Benchmark
-    public void benchmark_setup_teardown(BenchmarkSetupTeardown g) {}
-
-    @Benchmark
     public void benchmark_setup(BenchmarkSetup g) {}
 
     @Benchmark
     public void benchmark_teardown(BenchmarkTeardown g) {}
 
     @Benchmark
-    @Group("T1")
-    public void group_setup_teardown(GroupSetupTeardown g) {}
+    @Group("group_setup")
+    public void group_setup_1(GroupSetup g) {}
 
     @Benchmark
-    @Group("T2")
-    public void group_setup(GroupSetup g) {}
+    @Group("group_setup")
+    public void group_setup_2(GroupSetup g) {}
 
     @Benchmark
-    @Group("T3")
-    public void group_teardown(GroupTeardown g) {}
+    @Group("group_teardown")
+    public void group_teardown_1(GroupTeardown g) {}
 
     @Benchmark
-    public void thread_setup_teardown(ThreadSetupTeardown g) {}
+    @Group("group_teardown")
+    public void group_teardown_2(GroupTeardown g) {}
 
     @Benchmark
     public void thread_setup(ThreadSetup g) {}
--- a/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/ScoreStabilityBench.java	Tue Sep 08 22:32:50 2015 +0300
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/ScoreStabilityBench.java	Fri Sep 11 01:16:34 2015 +0300
@@ -24,89 +24,30 @@
  */
 package org.openjdk.jmh.benchmarks;
 
-import org.openjdk.jmh.annotations.Benchmark;
-import org.openjdk.jmh.annotations.BenchmarkMode;
-import org.openjdk.jmh.annotations.Level;
-import org.openjdk.jmh.annotations.Measurement;
-import org.openjdk.jmh.annotations.Mode;
-import org.openjdk.jmh.annotations.Scope;
-import org.openjdk.jmh.annotations.Setup;
-import org.openjdk.jmh.annotations.State;
-import org.openjdk.jmh.annotations.Threads;
-import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.annotations.*;
 import org.openjdk.jmh.infra.Blackhole;
 
 import java.util.concurrent.TimeUnit;
 
 @BenchmarkMode(Mode.SingleShotTime)
+@OutputTimeUnit(TimeUnit.MILLISECONDS)
 @Warmup(iterations = 50)
 @Measurement(iterations = 50)
-@Threads(4)
+@Threads(1)
+@State(Scope.Thread)
 public class ScoreStabilityBench {
 
-    @State(Scope.Thread)
-    public static class Sleep_X_State {
-        @Setup(Level.Iteration)
-        public void sleep() throws InterruptedException {
-            // don't
-        }
-    }
+    @Param("10")
+    private int delay;
 
-    @State(Scope.Thread)
-    public static class Sleep_X1_State {
-        @Setup(Level.Iteration)
-        public void sleep() throws InterruptedException {
-            TimeUnit.MILLISECONDS.sleep(1);
-        }
-    }
-
-    @State(Scope.Thread)
-    public static class Sleep_X10_State {
-        @Setup(Level.Iteration)
-        public void sleep() throws InterruptedException {
-            TimeUnit.MILLISECONDS.sleep(10);
-        }
-    }
-
-    @State(Scope.Thread)
-    public static class Sleep_X100_State {
-        @Setup(Level.Iteration)
-        public void sleep() throws InterruptedException {
-            TimeUnit.MILLISECONDS.sleep(100);
-        }
-    }
-
-    @State(Scope.Thread)
-    public static class Sleep_X500_State {
-        @Setup(Level.Iteration)
-        public void sleep() throws InterruptedException {
-            TimeUnit.MILLISECONDS.sleep(500);
-        }
+    @Setup(Level.Iteration)
+    public void sleep() throws InterruptedException {
+        TimeUnit.MILLISECONDS.sleep(delay);
     }
 
     @Benchmark
-    public void test_X(Sleep_X_State s) {
-        Blackhole.consumeCPU(10000);
-    }
-
-    @Benchmark
-    public void test_X1(Sleep_X1_State s) {
-        Blackhole.consumeCPU(10000);
-    }
-
-    @Benchmark
-    public void test_X10(Sleep_X10_State x) {
-        Blackhole.consumeCPU(10000);
-    }
-
-    @Benchmark
-    public void test_X100(Sleep_X100_State x) {
-        Blackhole.consumeCPU(10000);
-    }
-
-    @Benchmark
-    public void test_X500(Sleep_X500_State x) {
-        Blackhole.consumeCPU(10000);
+    public void test() {
+        Blackhole.consumeCPU(1000000);
     }
 
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/ThermalRundownBench.java	Fri Sep 11 01:16:34 2015 +0300
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jmh.benchmarks;
+
+import org.openjdk.jmh.annotations.*;
+import org.openjdk.jmh.infra.Blackhole;
+
+import java.util.concurrent.TimeUnit;
+
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.MILLISECONDS)
+@State(Scope.Thread)
+public class ThermalRundownBench {
+
+    @Benchmark
+    public void test() {
+        Blackhole.consumeCPU(1000000);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/IterationScoresFormatter.java	Fri Sep 11 01:16:34 2015 +0300
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jmh.validation;
+
+import org.openjdk.jmh.infra.BenchmarkParams;
+import org.openjdk.jmh.infra.IterationParams;
+import org.openjdk.jmh.results.BenchmarkResult;
+import org.openjdk.jmh.results.IterationResult;
+import org.openjdk.jmh.results.Result;
+import org.openjdk.jmh.results.RunResult;
+import org.openjdk.jmh.runner.format.OutputFormat;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Collection;
+
+public class IterationScoresFormatter implements OutputFormat {
+
+    private final PrintWriter pw;
+
+    public IterationScoresFormatter(PrintWriter pw) {
+        this.pw = pw;
+    }
+
+    @Override
+    public void iteration(BenchmarkParams benchParams, IterationParams params, int iteration) {
+
+    }
+
+    @Override
+    public void iterationResult(BenchmarkParams benchParams, IterationParams params, int iteration, IterationResult data) {
+        Result r = data.getPrimaryResult();
+        pw.println(String.format("   %.2f ± %.2f %s", r.getScore(), r.getScoreError(), r.getScoreUnit()));
+    }
+
+    @Override
+    public void startBenchmark(BenchmarkParams benchParams) {
+
+    }
+
+    @Override
+    public void endBenchmark(BenchmarkResult result) {
+
+    }
+
+    @Override
+    public void startRun() {
+
+    }
+
+    @Override
+    public void endRun(Collection<RunResult> result) {
+
+    }
+
+    @Override
+    public void print(String s) {
+
+    }
+
+    @Override
+    public void println(String s) {
+
+    }
+
+    @Override
+    public void flush() {
+
+    }
+
+    @Override
+    public void close() {
+
+    }
+
+    @Override
+    public void verbosePrintln(String s) {
+
+    }
+
+    @Override
+    public void write(int b) {
+
+    }
+
+    @Override
+    public void write(byte[] b) throws IOException {
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/Main.java	Fri Sep 11 01:16:34 2015 +0300
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jmh.validation;
+
+import joptsimple.*;
+import org.openjdk.jmh.runner.CompilerHints;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.*;
+import org.openjdk.jmh.validation.tests.*;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.List;
+
+public class Main {
+
+    public static void main(String[] args) throws RunnerException, CommandLineOptionException, IOException {
+        PrintWriter pw = new PrintWriter(System.out, true);
+
+        pw.println("JMH COre Benchmark Tests");
+        pw.println("----------------------------------------------------------------------------------------------------------");
+        pw.println();
+
+        org.openjdk.jmh.util.Utils.reflow(pw,
+                "These tests assess the current benchmarking environment health, including hardware, OS, JVM, and JMH " +
+                        "itself. While the failure on these tests does not immediately means the problem with environment, " +
+                        "it is instructive to understand and follow up on oddities in these tests.",
+                80, 2);
+        pw.println();
+
+        org.openjdk.jmh.util.Utils.reflow(pw,
+                "If you are sharing this report, please share it in full, including the JVM version, OS flavor and version, " +
+                        "plus some data on used hardware.",
+                80, 2);
+
+        pw.println();
+
+        OptionParser parser = new OptionParser();
+        parser.formatHelpWith(new OptionFormatter());
+
+        OptionSpec<Test> optTests = parser.accepts("t", "Test names.")
+                .withRequiredArg().ofType(Test.class).withValuesSeparatedBy(',').describedAs("string")
+                .defaultsTo(Test.values());
+
+        OptionSpec<Mode> optMode = parser.accepts("m", "Running mode, one of " + Arrays.toString(Mode.values()) + ".")
+                .withRequiredArg().ofType(Mode.class).describedAs("mode")
+                .defaultsTo(Mode.normal);
+
+        parser.accepts("h", "Print help.");
+
+        List<Test> tests;
+        Mode mode;
+        try {
+            OptionSet set = parser.parse(args);
+
+            if (set.has("h")) {
+                parser.printHelpOn(System.out);
+                return;
+            }
+
+            tests = set.valuesOf(optTests);
+            mode = set.valueOf(optMode);
+        } catch (OptionException e) {
+            String message = e.getMessage();
+            Throwable cause = e.getCause();
+            if (cause instanceof ValueConversionException) {
+                message += ". " + cause.getMessage();
+            }
+            throw new CommandLineOptionException(message, e);
+        }
+
+        Options opts = new OptionsBuilder()
+                .detectJvmArgs()
+                .jvmArgsAppend("-Xmx512m", "-Xms512m", "-server")
+                .build();
+
+        switch (mode) {
+            case flash:
+                opts = new OptionsBuilder()
+                        .parent(opts)
+                        .warmupIterations(3)
+                        .warmupTime(TimeValue.milliseconds(10))
+                        .measurementIterations(3)
+                        .measurementTime(TimeValue.milliseconds(10))
+                        .forks(1)
+                        .build();
+                break;
+            case quick:
+                opts = new OptionsBuilder()
+                        .parent(opts)
+                        .warmupIterations(3)
+                        .warmupTime(TimeValue.milliseconds(100))
+                        .measurementIterations(3)
+                        .measurementTime(TimeValue.milliseconds(100))
+                        .forks(3)
+                        .build();
+                break;
+            case normal:
+                opts = new OptionsBuilder()
+                        .parent(opts)
+                        .warmupIterations(5)
+                        .warmupTime(TimeValue.milliseconds(500))
+                        .measurementIterations(5)
+                        .measurementTime(TimeValue.milliseconds(500))
+                        .forks(5)
+                        .build();
+                break;
+            case longer:
+                opts = new OptionsBuilder()
+                        .parent(opts)
+                        .warmupIterations(10)
+                        .warmupTime(TimeValue.seconds(1))
+                        .measurementIterations(10)
+                        .measurementTime(TimeValue.seconds(1))
+                        .forks(10)
+                        .build();
+                break;
+            default:
+                throw new IllegalStateException();
+        }
+
+        for (Test t : tests) {
+            switch (t) {
+                case timing:
+                    new TimingMeasurementsTest().runWith(pw, opts);
+                    break;
+                case stability:
+                    new ScoreStabilityTest().runWith(pw, opts);
+                    break;
+                case thermal:
+                    switch (mode) {
+                        case flash:
+                            new ThermalRundownTest(3).runWith(pw, opts);
+                            break;
+                        case quick:
+                            new ThermalRundownTest(5).runWith(pw, opts);
+                            break;
+                        case normal:
+                            new ThermalRundownTest(18).runWith(pw, opts);
+                            break;
+                        case longer:
+                            new ThermalRundownTest(60).runWith(pw, opts);
+                            break;
+                        default:
+                            throw new IllegalStateException();
+                    }
+                    break;
+                case helpers:
+                    new HelperMethodsTest().runWith(pw, opts);
+                    break;
+                case blackhole_cpu:
+                    new BlackholeConsumeCPUTest().runWith(pw, opts);
+                    break;
+                case blackhole_simple:
+                    new BlackholeSingleTest().runWith(pw, opts);
+                    break;
+                case blackhole_pipelined:
+                    setBlackholeInline(false);
+                    new BlackholePipelinedTest(false, false).runWith(pw, opts);
+                    new BlackholePipelinedTest(true, false).runWith(pw, opts);
+                    setBlackholeInline(true);
+                    new BlackholePipelinedTest(false, true).runWith(pw, opts);
+                    new BlackholePipelinedTest(true, true).runWith(pw, opts);
+                    setBlackholeInline(false);
+                    break;
+                case blackhole_consec:
+                    setBlackholeInline(false);
+                    new BlackholeConsecutiveTest(false).runWith(pw, opts);
+                    setBlackholeInline(true);
+                    new BlackholeConsecutiveTest(true).runWith(pw, opts);
+                    setBlackholeInline(false);
+                    break;
+                default:
+                    throw new IllegalStateException();
+            }
+        }
+    }
+
+    public static enum Test {
+        timing,
+        stability,
+        thermal,
+        helpers,
+        blackhole_cpu,
+        blackhole_simple,
+        blackhole_pipelined,
+        blackhole_consec,
+    }
+
+    public static enum Mode {
+        flash,
+        quick,
+        normal,
+        longer,
+    }
+
+    private static void setBlackholeInline(boolean inline) {
+        System.getProperties().setProperty("jmh.blackhole.forceInline", String.valueOf(inline));
+
+        try {
+            Field f = CompilerHints.class.getDeclaredField("hintsFile");
+            f.setAccessible(true);
+            f.set(null, null);
+        } catch (Exception e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/ValidationTest.java	Fri Sep 11 01:16:34 2015 +0300
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jmh.validation;
+
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+
+import java.io.PrintWriter;
+
+public interface ValidationTest {
+
+    void runWith(PrintWriter pw, Options parent) throws RunnerException;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/tests/BlackholeConsecutiveTest.java	Fri Sep 11 01:16:34 2015 +0300
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jmh.validation.tests;
+
+import org.openjdk.jmh.benchmarks.BlackholeConsecutiveBench;
+import org.openjdk.jmh.results.Result;
+import org.openjdk.jmh.results.RunResult;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+import org.openjdk.jmh.runner.options.VerboseMode;
+import org.openjdk.jmh.validation.ValidationTest;
+
+import java.io.PrintWriter;
+import java.util.Arrays;
+
+public class BlackholeConsecutiveTest implements ValidationTest {
+    private final boolean inlined;
+
+    public BlackholeConsecutiveTest(boolean inlined) {
+        this.inlined = inlined;
+    }
+
+    @Override
+    public void runWith(PrintWriter pw, Options parent) throws RunnerException {
+        pw.println("--------- BLACKHOLE MERGING TEST" + (!inlined ? " (NORMAL)" : " (INLINE HINTS BROKEN)"));
+        pw.println();
+
+        org.openjdk.jmh.util.Utils.reflow(pw,
+                "This test verifies that calling the Blackhole.consume with the same result is not susceptible for " +
+                        "merging. We expect the similar performance across all data types, and the number of consecutive " +
+                        "calls. If there are significant differences, this is indicative of Blackhole failure, and it is " +
+                        "a serious JMH issue.",
+                80, 2);
+        pw.println();
+
+        if (inlined) {
+            org.openjdk.jmh.util.Utils.reflow(pw,
+                    "This particular test mode forces the inline of Blackhole methods, and so demolishes one of the layers " +
+                            "in defence in depth. If this layer is broken, Blackhole should also survive. If it isn't, then " +
+                            "JMH will have to provide more contingencies.",
+                    80, 2);
+            pw.println();
+        }
+
+        String[] types = new String[]  {
+                "boolean", "byte",   "short",
+                "char",    "int",    "float",
+                "long",    "double", "Object",
+                "Array",
+        };
+
+        int[] ss = new int[] {1, 4, 8};
+
+        pw.println("  Scores are nanoseconds per Blackhole call.");
+        pw.println("  Trying " + Arrays.toString(ss) + " consecutive Blackhole calls.");
+        pw.println();
+
+        pw.printf("%12s", "");
+        for (int steps : ss) {
+            pw.printf("%16s", steps);
+        }
+        pw.println();
+
+        for (String type : types) {
+            pw.printf("%12s", type + ": ");
+            for (int steps : ss) {
+                Options opts = new OptionsBuilder()
+                        .parent(parent)
+                        .include(BlackholeConsecutiveBench.class.getCanonicalName() + ".test_" + type + "_" + steps)
+                        .param("steps", String.valueOf(steps))
+                        .verbosity(VerboseMode.SILENT)
+                        .build();
+
+                RunResult result = new Runner(opts).runSingle();
+                Result r = result.getPrimaryResult();
+                pw.printf("%16s", String.format("%.2f ± %.2f", r.getScore() / steps, r.getScoreError() / steps));
+                pw.flush();
+            }
+            pw.println();
+        }
+
+        pw.println();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/tests/BlackholeConsumeCPUTest.java	Fri Sep 11 01:16:34 2015 +0300
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jmh.validation.tests;
+
+import org.openjdk.jmh.benchmarks.BlackholeConsumeCPUBench;
+import org.openjdk.jmh.results.Result;
+import org.openjdk.jmh.results.RunResult;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+import org.openjdk.jmh.runner.options.VerboseMode;
+import org.openjdk.jmh.validation.ValidationTest;
+
+import java.io.PrintWriter;
+
+public class BlackholeConsumeCPUTest implements ValidationTest {
+    @Override
+    public void runWith(PrintWriter pw, Options parent) throws RunnerException {
+        pw.println("--------- BLACKHOLE CONSUME CPU TEST");
+        pw.println();
+
+        org.openjdk.jmh.util.Utils.reflow(pw,
+                "This test assesses the Blackhole.consumeCPU performance, that should be linear to " +
+                        "the number of tokens. The performance can be slightly different on low token " +
+                        "counts. Otherwise, the backoffs with consumeCPU are not reliable. ",
+                80, 2);
+        pw.println();
+
+        pw.println("  Scores are (normalized) nanoseconds per token.");
+        pw.println();
+
+        pw.printf("%20s%n", "#Tokens: ");
+
+        for (int delay : new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+                20, 30, 40, 50, 60, 70, 80, 90, 100, 500, 1000,
+                5000, 10000, 50000, 100000, 500000, 1000000, 5000000, 10000000}) {
+            Options opts = new OptionsBuilder()
+                    .parent(parent)
+                    .include(BlackholeConsumeCPUBench.class.getCanonicalName())
+                    .verbosity(VerboseMode.SILENT)
+                    .param("delay", String.valueOf(delay))
+                    .build();
+
+            RunResult result = new Runner(opts).runSingle();
+            Result r = result.getPrimaryResult();
+
+            pw.printf("%20s", delay + ": ");
+            pw.flush();
+            pw.printf("%.2f ± %.2f ns\n", r.getScore() / delay, r.getScoreError() / delay);
+        }
+
+        pw.println();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/tests/BlackholePipelinedTest.java	Fri Sep 11 01:16:34 2015 +0300
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jmh.validation.tests;
+
+import org.openjdk.jmh.benchmarks.BlackholePipelineBench;
+import org.openjdk.jmh.benchmarks.BlackholePipelinePayloadBench;
+import org.openjdk.jmh.results.Result;
+import org.openjdk.jmh.results.RunResult;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+import org.openjdk.jmh.runner.options.VerboseMode;
+import org.openjdk.jmh.validation.ValidationTest;
+
+import java.io.PrintWriter;
+import java.util.Arrays;
+
+public class BlackholePipelinedTest implements ValidationTest {
+    private final boolean payload;
+    private final boolean inlined;
+
+    public BlackholePipelinedTest(boolean payload, boolean inlined) {
+        this.payload = payload;
+        this.inlined = inlined;
+    }
+
+    @Override
+    public void runWith(PrintWriter pw, Options parent) throws RunnerException {
+        pw.println("--------- BLACKHOLE PIPELINED TEST" + (payload ? " + REAL PAYLOAD" : "") + (!inlined ? " (NORMAL)" : " (INLINE HINTS BROKEN)"));
+        pw.println();
+
+        org.openjdk.jmh.util.Utils.reflow(pw,
+                "This test shows the Blackhole performance in a loop with a given number of iterations. We should normally " +
+                        "see the uniform numbers across most data types and number of iterations. If the numbers are wildly " +
+                        "non-uniform across the number of iteration, this is indicative of Blackhole failure, and may point " +
+                        "to a serious JMH issue. Scores are nanoseconds per loop iteration.",
+                80, 2);
+        pw.println();
+
+        if (payload) {
+            pw.println("  Real payload is being injected into the benchmark.");
+            pw.println();
+        }
+        if (inlined) {
+            org.openjdk.jmh.util.Utils.reflow(pw,
+                    "This particular test mode forces the inline of Blackhole methods, and so demolishes one of the layers " +
+                            "in defence in depth. If this layer is broken, Blackhole should also survive. If it isn't, then " +
+                            "JMH will have to provide more contingencies.",
+                    80, 2);
+            pw.println();
+        }
+        pw.println();
+
+        String[] types = new String[]  {
+                "boolean", "byte",   "short",
+                "char",    "int",    "float",
+                "long",    "double", "Object",
+                "Array",
+        };
+
+        int[] ss = {1, 10, 100, 1000, 10000};
+
+        pw.println("  Scores are nanoseconds per (normalized) benchmark op.");
+        pw.println("  Trying loops with " + Arrays.toString(ss) + " iterations.");
+        pw.println();
+
+        String canonicalName =
+                (payload ? BlackholePipelinePayloadBench.class : BlackholePipelineBench.class).getCanonicalName();
+
+        pw.printf("%12s", "");
+        for (int steps : ss) {
+            pw.printf("%16s", steps);
+        }
+        pw.println();
+
+        for (String type : types) {
+            pw.printf("%12s", type + ": ");
+            for (int steps : ss) {
+
+                Options opts = new OptionsBuilder()
+                        .parent(parent)
+                        .include(canonicalName + ".test_" + type)
+                        .param("steps", String.valueOf(steps))
+                        .verbosity(VerboseMode.SILENT)
+                        .build();
+
+                RunResult result = new Runner(opts).runSingle();
+                Result r = result.getPrimaryResult();
+                pw.printf("%16s", String.format("%.2f ± %.2f", r.getScore() / steps, r.getScoreError() / steps));
+                pw.flush();
+            }
+            pw.println();
+        }
+
+        pw.println();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/tests/BlackholeSingleTest.java	Fri Sep 11 01:16:34 2015 +0300
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jmh.validation.tests;
+
+import org.openjdk.jmh.benchmarks.BlackholeBench;
+import org.openjdk.jmh.results.Result;
+import org.openjdk.jmh.results.RunResult;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+import org.openjdk.jmh.runner.options.VerboseMode;
+import org.openjdk.jmh.validation.ValidationTest;
+
+import java.io.PrintWriter;
+
+public class BlackholeSingleTest implements ValidationTest {
+    @Override
+    public void runWith(PrintWriter pw, Options parent) throws RunnerException {
+        pw.println("--------- BLACKHOLE SINGLE INVOCATION TEST");
+        pw.println();
+
+        org.openjdk.jmh.util.Utils.reflow(pw,
+                "This test shows the Blackhole overheads, when using a single invocation in the method, " +
+                        "whether implicitly via return from @Benchmark, or explicitly via consume(). The performance " +
+                        "should be the same for implicit and explicit cases, and comparable across all data types. ",
+                80, 2);
+        pw.println();
+
+        String[] types = new String[]  {
+                "boolean", "byte",   "short",
+                "char",    "int",    "float",
+                "long",    "double", "Object",
+                "Array",
+        };
+
+        String[] modes = {"implicit", "explicit"};
+
+        pw.println("  Scores are nanoseconds per benchmark op.");
+        pw.println();
+
+        pw.printf("%20s", "");
+        for (String mode : modes) {
+            pw.printf("%20s", mode);
+        }
+        pw.println();
+
+        for (String type : types) {
+            pw.printf("%20s", type + ": ");
+            for (String impl : modes) {
+                Options opts = new OptionsBuilder()
+                        .parent(parent)
+                        .include(BlackholeBench.class.getCanonicalName() + "." + impl + "_" + type)
+                        .verbosity(VerboseMode.SILENT)
+                        .build();
+
+                RunResult result = new Runner(opts).runSingle();
+                Result r = result.getPrimaryResult();
+
+                pw.flush();
+                pw.printf("%20s", String.format("%.2f ± %.2f ns", r.getScore(), r.getScoreError()));
+            }
+            pw.println();
+        }
+        pw.println();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/tests/HelperMethodsTest.java	Fri Sep 11 01:16:34 2015 +0300
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jmh.validation.tests;
+
+import org.openjdk.jmh.annotations.Level;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.benchmarks.EmptyBench;
+import org.openjdk.jmh.results.Result;
+import org.openjdk.jmh.results.RunResult;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+import org.openjdk.jmh.runner.options.VerboseMode;
+import org.openjdk.jmh.validation.ValidationTest;
+
+import java.io.PrintWriter;
+
+public class HelperMethodsTest implements ValidationTest {
+
+    @Override
+    public void runWith(PrintWriter pw, Options parent) throws RunnerException {
+        pw.println("--------- HELPER METHOD TEST");
+        pw.println();
+
+        org.openjdk.jmh.util.Utils.reflow(pw,
+                "These tests show the overheads of using the benchmark methods. Normally, only " +
+                        "Level.Invocation helpers should affect the benchmark performance, since " +
+                        "other helpers execute outside the benchmark path.",
+                80, 2);
+        pw.println();
+
+        {
+            Options opts = new OptionsBuilder()
+                    .parent(parent)
+                    .include(EmptyBench.class.getCanonicalName())
+                    .verbosity(VerboseMode.SILENT)
+                    .build();
+
+            RunResult result = new Runner(opts).runSingle();
+            Result r = result.getPrimaryResult();
+
+            pw.printf("%51s", "running empty benchmark: ");
+            pw.flush();
+            pw.printf("%.2f \u00b1 %.2f ns\n", r.getScore(), r.getScoreError());
+            pw.println();
+        }
+
+        for (Scope scope : Scope.values()) {
+            for (Level level : Level.values()) {
+                for (String helper : new String[]{"Setup", "TearDown"}) {
+                    Options opts = new OptionsBuilder()
+                            .parent(parent)
+                            .include("Level" + level + "Bench" + "." + scope.name().toLowerCase() + "_" + helper.toLowerCase() + "$")
+                            .verbosity(VerboseMode.SILENT)
+                            .build();
+
+                    RunResult result = new Runner(opts).runSingle();
+                    Result r = result.getPrimaryResult();
+
+                    pw.printf("%20s, %16s, %10s: ", "Scope." + scope, "Level." + level, "@" + helper);
+                    pw.flush();
+                    pw.printf("%.2f \u00b1 %.2f ns\n", r.getScore(), r.getScoreError());
+                }
+            }
+            pw.println();
+        }
+
+        pw.println();
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/tests/ScoreStabilityTest.java	Fri Sep 11 01:16:34 2015 +0300
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jmh.validation.tests;
+
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.benchmarks.ScoreStabilityBench;
+import org.openjdk.jmh.results.Result;
+import org.openjdk.jmh.results.RunResult;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+import org.openjdk.jmh.runner.options.VerboseMode;
+import org.openjdk.jmh.validation.ValidationTest;
+
+import java.io.PrintWriter;
+
+public class ScoreStabilityTest implements ValidationTest {
+    @Override
+    public void runWith(PrintWriter pw, Options parent) throws RunnerException {
+        pw.println("--------- SCORE STABILITY TEST");
+        pw.println();
+
+        org.openjdk.jmh.util.Utils.reflow(pw,
+                "This test verifies the performance for a large busy benchmark is the same, regardless " +
+                        "of the benchmark mode, and delay before the iteration. The performance should be " +
+                        "the same across all benchmark modes. If there is a significant difference on different " +
+                        "delay levels, this is usually indicative of power-saving features enabled, making bursty " +
+                        "benchmarks unreliable.",
+                80, 2);
+        pw.println();
+
+        pw.println("  Scores are milliseconds per benchmark operation.");
+        pw.println("  Delays are injected before each iteration, and are measured in milliseconds.");
+        pw.println();
+
+        int[] delays = {0, 1, 10, 100, 1000};
+
+        pw.printf("%20s", "");
+        for (int delay : delays) {
+            pw.printf("%16s", delay);
+        }
+        pw.println();
+
+        for (Mode m : Mode.values()) {
+            if (m == Mode.All) continue;
+
+            pw.printf("%20s", m + ": ");
+            for (int delay : delays) {
+                Options opts = new OptionsBuilder()
+                        .parent(parent)
+                        .include(ScoreStabilityBench.class.getCanonicalName())
+                        .verbosity(VerboseMode.SILENT)
+                        .param("delay", String.valueOf(delay))
+                        .build();
+
+                RunResult result = new Runner(opts).runSingle();
+                Result r = result.getPrimaryResult();
+                pw.printf("%16s", String.format("%.2f \u00b1 %.2f", r.getScore(), r.getScoreError()));
+                pw.flush();
+            }
+            pw.println();
+        }
+
+        pw.println();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/tests/ThermalRundownTest.java	Fri Sep 11 01:16:34 2015 +0300
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jmh.validation.tests;
+
+import org.openjdk.jmh.annotations.Threads;
+import org.openjdk.jmh.benchmarks.ThermalRundownBench;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+import org.openjdk.jmh.runner.options.TimeValue;
+import org.openjdk.jmh.runner.options.VerboseMode;
+import org.openjdk.jmh.validation.IterationScoresFormatter;
+import org.openjdk.jmh.validation.ValidationTest;
+
+import java.io.PrintWriter;
+
+public class ThermalRundownTest implements ValidationTest {
+
+    private int iterations;
+
+    public ThermalRundownTest(int iterations) {
+        this.iterations = iterations;
+    }
+
+    @Override
+    public void runWith(PrintWriter pw, Options parent) throws RunnerException {
+        pw.println("--------- THERMAL RUNDOWN TEST");
+        pw.println();
+
+        org.openjdk.jmh.util.Utils.reflow(pw,
+                "This test tries to heat the machine up, forcing thermal throttling to kick in. If you see the diminishing " +
+                        "performance over time, then your system throttles, and many benchmark experiments are unreliable. ",
+                80, 2);
+        pw.println();
+
+        Options opts = new OptionsBuilder()
+                .parent(parent)
+                .include(ThermalRundownBench.class.getCanonicalName())
+                .warmupIterations(0)
+                .measurementIterations(iterations)
+                .measurementTime(TimeValue.seconds(10))
+                .threads(Threads.MAX)
+                .forks(1)
+                .verbosity(VerboseMode.SILENT)
+                .build();
+
+        new Runner(opts, new IterationScoresFormatter(pw)).runSingle();
+
+        pw.println();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/validation/tests/TimingMeasurementsTest.java	Fri Sep 11 01:16:34 2015 +0300
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jmh.validation.tests;
+
+import org.openjdk.jmh.benchmarks.NanoTimerBench;
+import org.openjdk.jmh.results.Result;
+import org.openjdk.jmh.results.RunResult;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+import org.openjdk.jmh.runner.options.VerboseMode;
+import org.openjdk.jmh.validation.ValidationTest;
+
+import java.io.PrintWriter;
+
+public class TimingMeasurementsTest implements ValidationTest {
+    @Override
+    public void runWith(PrintWriter pw, Options parent) throws RunnerException {
+        pw.println("--------- TIMING MEASUREMENTS TEST");
+        pw.println();
+
+        org.openjdk.jmh.util.Utils.reflow(pw,
+                "This test shows the minimal individual timings possible to measure. " +
+                        "This normally affects only SampleTime and SingleShot benchmark modes. " +
+                        "Throughput/AverageTime tests can do better since they do only a few " +
+                        "timestamps before and after the complete iteration.",
+                80, 2);
+        pw.println();
+
+        {
+            Options opts = new OptionsBuilder()
+                    .parent(parent)
+                    .include(NanoTimerBench.class.getCanonicalName() + ".latency$")
+                    .verbosity(VerboseMode.SILENT)
+                    .build();
+
+            RunResult result = new Runner(opts).runSingle();
+            Result r = result.getPrimaryResult();
+
+            pw.printf("%50s", "System.nanoTime latency: ");
+            pw.flush();
+            pw.printf("%.2f \u00b1 %.2f ns\n", r.getScore(), r.getScoreError());
+        }
+
+        {
+            Options opts = new OptionsBuilder()
+                    .parent(parent)
+                    .include(NanoTimerBench.class.getCanonicalName() + ".granularity$")
+                    .verbosity(VerboseMode.SILENT)
+                    .build();
+
+            RunResult result = new Runner(opts).runSingle();
+            Result r = result.getPrimaryResult();
+
+            pw.printf("%50s", "System.nanoTime granularity: ");
+            pw.flush();
+            pw.printf("%.2f \u00b1 %.2f ns\n", r.getScore(), r.getScoreError());
+        }
+
+        pw.println();
+    }
+}
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/CompilerHints.java	Tue Sep 08 22:32:50 2015 +0300
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/CompilerHints.java	Fri Sep 11 01:16:34 2015 +0300
@@ -41,9 +41,6 @@
     // Zing is only compatible from post 5.10.*.* releases
     static final String JVM_ZING = "Zing";
 
-    // Force blackhole inline, useful for testing.
-    public static final boolean INLINE_BLACKHOLE = Boolean.getBoolean("jmh.blackhole.forceInline");
-
     private static volatile CompilerHints defaultList;
     private static volatile String hintsFile;
 
@@ -65,7 +62,7 @@
                 final Set<String> defaultHints = defaultList().get();
                 List<String> hints = new ArrayList<String>(defaultHints.size() + 2);
                 hints.add("quiet");
-                if (INLINE_BLACKHOLE) {
+                if (Boolean.getBoolean("jmh.blackhole.forceInline")) {
                     hints.add("inline,org/openjdk/jmh/infra/Blackhole.*");
                 } else {
                     hints.add("dontinline,org/openjdk/jmh/infra/Blackhole.*");
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/options/OptionFormatter.java	Tue Sep 08 22:32:50 2015 +0300
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/options/OptionFormatter.java	Fri Sep 11 01:16:34 2015 +0300
@@ -29,6 +29,7 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 import java.util.Map;
 
 public class OptionFormatter implements HelpFormatter {
@@ -94,8 +95,13 @@
         }
 
         line.append(String.format("%-30s", o.toString()));
+        String desc = d.description();
+        List<?> defaults = d.defaultValues();
+        if (defaults != null && !defaults.isEmpty()) {
+            desc += " (default: " + defaults.toString() + ")";
+        }
         boolean first = true;
-        for (String l : rewrap(d.description())) {
+        for (String l : rewrap(desc)) {
             if (first) {
                 first = false;
             } else {
--- a/jmh-core/src/main/java/org/openjdk/jmh/util/Utils.java	Tue Sep 08 22:32:50 2015 +0300
+++ b/jmh-core/src/main/java/org/openjdk/jmh/util/Utils.java	Fri Sep 11 01:16:34 2015 +0300
@@ -235,6 +235,30 @@
         return Charset.defaultCharset();
     }
 
+    public static void reflow(PrintWriter pw, String src, int width, int indent) {
+        StringTokenizer tokenizer = new StringTokenizer(src);
+        int curWidth = indent;
+        indent(pw, indent);
+        while (tokenizer.hasMoreTokens()) {
+            String next = tokenizer.nextToken();
+            pw.print(next);
+            pw.print(" ");
+            curWidth += next.length() + 1;
+            if (curWidth > width) {
+                pw.println();
+                indent(pw, indent);
+                curWidth = 0;
+            }
+        }
+        pw.println();
+    }
+
+    private static void indent(PrintWriter pw, int indent) {
+        for (int i = 0; i < indent; i++) {
+            pw.print(" ");
+        }
+    }
+
     static class BurningTask implements Runnable {
         @Override
         public void run() {