changeset 179:3894e4876293

Extend Blackhole pipeline bench.
author shade
date Tue, 10 Sep 2013 16:07:07 +0400
parents e06625e4b5cb
children 192f2396e6db
files jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/BlackholePipelineBench.java
diffstat 1 files changed, 39 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/BlackholePipelineBench.java	Tue Sep 10 15:58:42 2013 +0400
+++ b/jmh-core-benchmarks/src/main/java/org/openjdk/jmh/benchmarks/BlackholePipelineBench.java	Tue Sep 10 16:07:07 2013 +0400
@@ -54,29 +54,59 @@
 
     @GenerateMicroBenchmark
     @OperationsPerInvocation(1)
-    public void test_1(BlackHole bh) {
-        doTest(bh, 1);
+    public void test_Obj_1(BlackHole bh) {
+        doTestObj(bh, 1);
     }
 
     @GenerateMicroBenchmark
     @OperationsPerInvocation(10)
-    public void test_10(BlackHole bh) {
-        doTest(bh, 10);
+    public void test_Obj_10(BlackHole bh) {
+        doTestObj(bh, 10);
     }
 
     @GenerateMicroBenchmark
     @OperationsPerInvocation(100)
-    public void test_100(BlackHole bh) {
-        doTest(bh, 100);
+    public void test_Obj_100(BlackHole bh) {
+        doTestObj(bh, 100);
     }
 
     @GenerateMicroBenchmark
     @OperationsPerInvocation(1000)
-    public void test_1000(BlackHole bh) {
-        doTest(bh, 1000);
+    public void test_Obj_1000(BlackHole bh) {
+        doTestObj(bh, 1000);
     }
 
-    public void doTest(BlackHole bh, int count) {
+    @GenerateMicroBenchmark
+    @OperationsPerInvocation(1)
+    public void test_Int_1(BlackHole bh) {
+        doTestInt(bh, 1);
+    }
+
+    @GenerateMicroBenchmark
+    @OperationsPerInvocation(10)
+    public void test_Int_10(BlackHole bh) {
+        doTestInt(bh, 10);
+    }
+
+    @GenerateMicroBenchmark
+    @OperationsPerInvocation(100)
+    public void test_Int_100(BlackHole bh) {
+        doTestInt(bh, 100);
+    }
+
+    @GenerateMicroBenchmark
+    @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 doTestInt(BlackHole bh, int count) {
         for (int c = 0; c < count; c++) {
             bh.consume(data[c].intValue());
         }