changeset 91:e8e80f26edfb

Sanity test for checking non-allocating performance.
author shade
date Thu, 23 Nov 2017 15:23:31 +0100
parents 14c1bb4faa6e
children d04b4bbbc39f
files src/main/java/org/openjdk/gcbench/GCBench.java src/main/java/org/openjdk/gcbench/sanity/DoNothing.java
diffstat 2 files changed, 54 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/org/openjdk/gcbench/GCBench.java	Thu Nov 23 15:12:49 2017 +0100
+++ b/src/main/java/org/openjdk/gcbench/GCBench.java	Thu Nov 23 15:23:31 2017 +0100
@@ -208,6 +208,18 @@
 
         // alloc family
         {
+            String groupDescr = "This tests no other activity happens except for the test itself. " +
+                    "Runs the active non-allocating test.";
+
+            tests.add(new DimensionalTest(baseOpts, org.openjdk.gcbench.sanity.DoNothing.class,
+                    "sanity", groupDescr,
+                    Dimensions.threads(Sequence.predefined(threads)),
+                    Dimensions.heapSize(Sequence.powersOfTwo_WithMax(HeapSizeManager.MIN_HEAP, HeapSizeManager.MAX_HEAP))
+            ));
+        }
+
+        // alloc family
+        {
             String groupDescr = "Allocates the objects in almost completely empty heap as fast as it can. " +
                     "This tests what allocation pressure can the collector withstand without doing anything else. ";
 
@@ -417,7 +429,7 @@
 
         pw.println("  Matching tests:");
         for (Test test : tests) {
-            if (pattern.matcher(test.label()).find()) {
+            if (test.label().equals("sanity") || pattern.matcher(test.label()).find()) {
                 pw.printf("    %-20s%n", test.label());
                 runTests.add(test);
             }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/org/openjdk/gcbench/sanity/DoNothing.java	Thu Nov 23 15:23:31 2017 +0100
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2017, Red Hat Inc. 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.gcbench.sanity;
+
+import org.openjdk.jmh.annotations.*;
+
+import java.util.concurrent.TimeUnit;
+
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@State(Scope.Benchmark)
+public class DoNothing {
+
+    @Benchmark
+    public void test() {
+        // Deliberately empty
+    }
+
+}