< prev index next >

test/hotspot/jtreg/gc/logging/TestPrintReferences.java

Print this page
rev 49684 : imported patch 8201487-do-not-rebalance-with-serial-processing

@@ -52,34 +52,40 @@
   static final String phase2 = "Phase2";
   static final String phase3 = "Phase3";
   static final String gcLogTimeRegex = ".* GC\\([0-9]+\\) ";
 
   public static void main(String[] args) throws Exception {
+    test(true);
+    test(false);
+  }
+
+  static String indent(int count) {
+    return " {" + count + "}";
+  }
+
+  public static void test(boolean parallelRefProcEnabled) throws Exception {
     ProcessBuilder pb_enabled = ProcessTools.createJavaProcessBuilder("-Xlog:gc+phases+ref=debug",
                                                                       "-XX:+UseG1GC",
                                                                       "-Xmx32M",
                                                                       // Explicit thread setting is required to avoid using only 1 thread
+                                                                      "-XX:" + (parallelRefProcEnabled ? "+" : "-") + "ParallelRefProcEnabled",
                                                                       "-XX:ParallelGCThreads=2",
                                                                       GCTest.class.getName());
     OutputAnalyzer output = new OutputAnalyzer(pb_enabled.start());
 
-    checkLogFormat(output);
+    checkLogFormat(output, parallelRefProcEnabled);
     checkLogValue(output);
 
     output.shouldHaveExitValue(0);
   }
 
-  static String indent(int count) {
-    return " {" + count + "}";
-  }
-
   // Find the first Reference Processing log and check its format.
-  public static void checkLogFormat(OutputAnalyzer output) {
+  public static void checkLogFormat(OutputAnalyzer output, boolean parallelRefProcEnabled) {
     String countRegex = "[0-9]+";
     String timeRegex = doubleRegex + "ms";
     String totalRegex = gcLogTimeRegex + indent(4) + referenceProcessing + ": " + timeRegex + "\n";
-    String balanceRegex = gcLogTimeRegex + indent(8) + "Balance queues: " + timeRegex + "\n";
+    String balanceRegex = parallelRefProcEnabled ? gcLogTimeRegex + indent(8) + "Balance queues: " + timeRegex + "\n" : "";
     String softRefRegex = gcLogTimeRegex + indent(6) + softReference + ": " + timeRegex + "\n";
     String weakRefRegex = gcLogTimeRegex + indent(6) + weakReference + ": " + timeRegex + "\n";
     String finalRefRegex = gcLogTimeRegex + indent(6) + finalReference + ": " + timeRegex + "\n";
     String phantomRefRegex = gcLogTimeRegex + indent(6) + phantomReference + ": " + timeRegex + "\n";
     String refDetailRegex = gcLogTimeRegex + indent(8) + phase2 + ": " + timeRegex + "\n" +
< prev index next >