test/lib/jdk/test/lib/jfr/GCHelper.java
changeset 54956 43340a79840d
parent 50113 caf115bb98ad
child 59053 ba6c248cae19
--- a/test/lib/jdk/test/lib/jfr/GCHelper.java	Tue May 21 10:34:57 2019 +0200
+++ b/test/lib/jdk/test/lib/jfr/GCHelper.java	Tue May 21 10:36:23 2019 +0200
@@ -80,6 +80,7 @@
     public static final String pauseLevelEvent = "GCPhasePauseLevel";
 
     private static final List<String> g1HeapRegionTypes;
+    private static final List<String> shenandoahHeapRegionStates;
     private static PrintStream defaultErrorLog = null;
 
     public static int getGcId(RecordedEvent event) {
@@ -207,6 +208,21 @@
                                                          };
 
         g1HeapRegionTypes = Collections.unmodifiableList(Arrays.asList(g1HeapRegionTypeLiterals));
+
+        String[] shenandoahHeapRegionStateLiterals = new String[] {
+                                                                    "Empty Uncommitted",
+                                                                    "Empty Committed",
+                                                                    "Regular",
+                                                                    "Humongous Start",
+                                                                    "Humongous Continuation",
+                                                                    "Humongous Start, Pinned",
+                                                                    "Collection Set",
+                                                                    "Pinned",
+                                                                    "Collection Set, Pinned",
+                                                                    "Trash"
+        };
+
+        shenandoahHeapRegionStates = Collections.unmodifiableList(Arrays.asList(shenandoahHeapRegionStateLiterals));
     }
 
     /**
@@ -443,6 +459,13 @@
         return g1HeapRegionTypes.contains(type);
     }
 
+    public static boolean assertIsValidShenandoahHeapRegionState(final String state) {
+        if (!shenandoahHeapRegionStates.contains(state)) {
+            throw new AssertionError("Unknown state '" + state + "', valid heap region states are " + shenandoahHeapRegionStates);
+        }
+        return true;
+    }
+
     /**
      * Helper function to align heap size up.
      *