8204163: Also detect concurrent GCs in MetaspaceBaseGC.java
authorstefank
Tue, 05 Jun 2018 15:56:12 +0200
changeset 50404 5193c6b98cc7
parent 50403 4602de5feb24
child 50405 449cbde4c40c
8204163: Also detect concurrent GCs in MetaspaceBaseGC.java Reviewed-by: eosterlund, pliden
test/hotspot/jtreg/vmTestbase/metaspace/gc/HighWaterMarkTest.java
test/hotspot/jtreg/vmTestbase/metaspace/gc/MetaspaceBaseGC.java
--- a/test/hotspot/jtreg/vmTestbase/metaspace/gc/HighWaterMarkTest.java	Tue Jun 05 15:56:09 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/gc/HighWaterMarkTest.java	Tue Jun 05 15:56:12 2018 +0200
@@ -187,30 +187,22 @@
         }
         System.out.println("% GC has been invoked: " + gcCount + " times");
 
-        if (VMRuntimeEnvUtils.isVMOptionEnabled("UseG1GC") &&
-              VMRuntimeEnvUtils.isVMOptionEnabled("ClassUnloadingWithConcurrentMark")) {
-            System.out.println("% isG1ClassUnloading: true");
-            if (gcCount != 0) {
-                throw new Fault ("G1 should unload classes, full GC is not expected");
-            }
+        if (maxMetaspaceFreeRatio <= 1) {
+            // min/max = 0/1  boundary value
+            // GC should happen very often
+            checkGCCount(gcCount, 20, -1);
+        } else if (minMetaspaceFreeRatio >= 99) {
+            // min/max = 99/100  boundary value
+            // GC should happen very rare
+            checkGCCount(gcCount, -1, 2);
+        } else if (minMetaspaceFreeRatio >= 10  && maxMetaspaceFreeRatio <= 20) {
+            // GC should happen quite often
+            checkGCCount(gcCount, 3, 30);
+        } else if (minMetaspaceFreeRatio >= 70  && maxMetaspaceFreeRatio <= 80) {
+            // GC should happen quite often
+            checkGCCount(gcCount, 1, 3);
         } else {
-            if (maxMetaspaceFreeRatio <= 1) {
-                // min/max = 0/1  boundary value
-                // GC should happen very often
-                checkGCCount(gcCount, 20, -1);
-            } else if (minMetaspaceFreeRatio >= 99) {
-                // min/max = 99/100  boundary value
-                // GC should happen very rare
-                checkGCCount(gcCount, -1, 2);
-            } else if (minMetaspaceFreeRatio >= 10  && maxMetaspaceFreeRatio <= 20) {
-                // GC should happen quite often
-                checkGCCount(gcCount, 3, 30);
-            } else if (minMetaspaceFreeRatio >= 70  && maxMetaspaceFreeRatio <= 80) {
-                // GC should happen quite often
-                checkGCCount(gcCount, 1, 3);
-            } else {
-                // hard to estimate
-            }
+            // hard to estimate
         }
 
     }
--- a/test/hotspot/jtreg/vmTestbase/metaspace/gc/MetaspaceBaseGC.java	Tue Jun 05 15:56:09 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/gc/MetaspaceBaseGC.java	Tue Jun 05 15:56:12 2018 +0200
@@ -180,14 +180,13 @@
 
     /**
      * Reads gc.log file and counts GC induced by metaspace.
-     * Note: this method doesn't work for ConcMarkSweep...
      * @return how many times GC induced by metaspace has occurred.
      */
     protected int getMetaspaceGCCount() {
         int count = 0;
         try {
             for (String line: readGCLog()) {
-                if (line.indexOf("Pause Full") > 0 && line.indexOf("Meta") > 0) {
+                if (line.indexOf("Metadata GC ") > 0) {
                     count++;
                 }
             }