8145092: Use Unified Logging for the GC logging
authordavid
Wed, 18 Nov 2015 14:51:10 +0100
changeset 35246 05ced3076fd8
parent 35245 155af84b5cb5
child 35247 44d72c2ca39b
8145092: Use Unified Logging for the GC logging Summary: JEP-271 Reviewed-by: sjohanss, brutisso
jdk/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java
jdk/test/com/sun/management/HotSpotDiagnosticMXBean/GetVMOption.java
jdk/test/com/sun/management/HotSpotDiagnosticMXBean/SetVMOption.java
jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java
jdk/test/java/lang/management/MemoryMXBean/RunUtil.java
jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh
jdk/test/java/text/Format/DecimalFormat/FormatMicroBenchmark.java
jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java
jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java
jdk/test/sun/tools/jps/JpsHelper.java
--- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java	Wed Dec 09 11:02:54 2015 +0000
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java	Wed Nov 18 14:51:10 2015 +0100
@@ -62,7 +62,7 @@
             ProcessBuilder pb = ProcessTools.
                 createJavaProcessBuilder(
                     "-XX:+UseConcMarkSweepGC",  // this will cause UseParNewGC to be FLAG_SET_ERGO
-                    "-XX:+PrintGCDetails",
+                    "-XX:+UseCodeAging",
                     "-XX:+UseCerealGC",         // Should be ignored.
                     "-XX:Flags=" + flagsFile.getAbsolutePath(),
                     "-cp", System.getProperty("test.class.path"),
@@ -97,7 +97,7 @@
             // Not set, so should be default
             checkOrigin("ManagementServer", Origin.DEFAULT);
             // Set on the command line
-            checkOrigin("PrintGCDetails", Origin.VM_CREATION);
+            checkOrigin("UseCodeAging", Origin.VM_CREATION);
             // Set in _JAVA_OPTIONS
             checkOrigin("TraceExceptions", Origin.ENVIRON_VAR);
             // Set in JAVA_TOOL_OPTIONS
--- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/GetVMOption.java	Wed Dec 09 11:02:54 2015 +0000
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/GetVMOption.java	Wed Nov 18 14:51:10 2015 +0100
@@ -28,7 +28,7 @@
  * @author  Mandy Chung
  *
  * @modules jdk.management
- * @run main/othervm -XX:+PrintGCDetails GetVMOption
+ * @run main/othervm -XX:+HeapDumpOnOutOfMemoryError GetVMOption
  */
 
 import com.sun.management.HotSpotDiagnosticMXBean;
@@ -38,7 +38,7 @@
 import javax.management.MBeanServer;
 
 public class GetVMOption {
-    private static final String PRINT_GC_DETAILS = "PrintGCDetails";
+    private static final String HEAP_DUMP_ON_OOM = "HeapDumpOnOutOfMemoryError";
     private static final String EXPECTED_VALUE = "true";
     private static final String BAD_OPTION = "BadOption";
     private static final String HOTSPOT_DIAGNOSTIC_MXBEAN_NAME =
@@ -58,7 +58,7 @@
     }
 
     private static void checkVMOption(HotSpotDiagnosticMXBean mbean) {
-        VMOption option = mbean.getVMOption(PRINT_GC_DETAILS);
+        VMOption option = mbean.getVMOption(HEAP_DUMP_ON_OOM);
         if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
             throw new RuntimeException("Unexpected value: " +
                 option.getValue() + " expected: " + EXPECTED_VALUE);
--- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/SetVMOption.java	Wed Dec 09 11:02:54 2015 +0000
+++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/SetVMOption.java	Wed Nov 18 14:51:10 2015 +0100
@@ -30,7 +30,7 @@
  * @author  Jaroslav Bachorik
  *
  * @modules jdk.management
- * @run main/othervm -XX:+PrintGCDetails SetVMOption
+ * @run main/othervm -XX:+HeapDumpOnOutOfMemoryError SetVMOption
  */
 
 import java.lang.management.ManagementFactory;
@@ -40,7 +40,7 @@
 import com.sun.management.VMOption.Origin;
 
 public class SetVMOption {
-    private static final String PRINT_GC_DETAILS = "PrintGCDetails";
+    private static final String HEAP_DUMP_ON_OOM = "HeapDumpOnOutOfMemoryError";
     private static final String EXPECTED_VALUE = "true";
     private static final String BAD_VALUE = "yes";
     private static final String NEW_VALUE = "false";
@@ -51,7 +51,7 @@
         mbean =
             ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
 
-        VMOption option = findPrintGCDetailsOption();
+        VMOption option = findHeapDumpOnOomOption();
         if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
             throw new RuntimeException("Unexpected value: " +
                 option.getValue() + " expected: " + EXPECTED_VALUE);
@@ -61,14 +61,14 @@
                 option.getOrigin() + " expected: VM_CREATION");
         }
         if (!option.isWriteable()) {
-            throw new RuntimeException("Expected " + PRINT_GC_DETAILS +
+            throw new RuntimeException("Expected " + HEAP_DUMP_ON_OOM +
                 " to be writeable");
         }
 
         // set VM option to a new value
-        mbean.setVMOption(PRINT_GC_DETAILS, NEW_VALUE);
+        mbean.setVMOption(HEAP_DUMP_ON_OOM, NEW_VALUE);
 
-        option = findPrintGCDetailsOption();
+        option = findHeapDumpOnOomOption();
         if (!option.getValue().equalsIgnoreCase(NEW_VALUE)) {
             throw new RuntimeException("Unexpected value: " +
                 option.getValue() + " expected: " + NEW_VALUE);
@@ -77,7 +77,7 @@
             throw new RuntimeException("Unexpected origin: " +
                 option.getOrigin() + " expected: MANAGEMENT");
         }
-        VMOption o = mbean.getVMOption(PRINT_GC_DETAILS);
+        VMOption o = mbean.getVMOption(HEAP_DUMP_ON_OOM);
         if (!option.getValue().equals(o.getValue())) {
             throw new RuntimeException("Unmatched value: " +
                 option.getValue() + " expected: " + o.getValue());
@@ -123,17 +123,17 @@
         }
     }
 
-    public static VMOption findPrintGCDetailsOption() {
+    public static VMOption findHeapDumpOnOomOption() {
         List<VMOption> options = mbean.getDiagnosticOptions();
         VMOption gcDetails = null;
         for (VMOption o : options) {
-            if (o.getName().equals(PRINT_GC_DETAILS)) {
+            if (o.getName().equals(HEAP_DUMP_ON_OOM)) {
                  gcDetails = o;
                  break;
             }
         }
         if (gcDetails == null) {
-            throw new RuntimeException("VM option " + PRINT_GC_DETAILS +
+            throw new RuntimeException("VM option " + HEAP_DUMP_ON_OOM +
                 " not found");
         }
         return gcDetails;
--- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Wed Dec 09 11:02:54 2015 +0000
+++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Wed Nov 18 14:51:10 2015 +0100
@@ -100,7 +100,7 @@
         opts.addAll(Arrays.asList(Utils.getTestJavaOpts()));
         opts.add("-cp");
         opts.add(System.getProperty("test.class.path", "test.class.path"));
-        opts.add("-XX:+PrintGCDetails");
+        opts.add("-Xlog:gc*=debug");
         opts.addAll(Arrays.asList(testOpts));
         opts.add(classMain);
 
--- a/jdk/test/java/lang/management/MemoryMXBean/RunUtil.java	Wed Dec 09 11:02:54 2015 +0000
+++ b/jdk/test/java/lang/management/MemoryMXBean/RunUtil.java	Wed Nov 18 14:51:10 2015 +0100
@@ -66,7 +66,7 @@
         opts.addAll(Arrays.asList(Utils.getTestJavaOpts()));
         opts.add("-cp");
         opts.add(System.getProperty("test.class.path", "test.class.path"));
-        opts.add("-XX:+PrintGCDetails");
+        opts.add("-Xlog:gc*=debug");
 
         if (clearGcOpts) {
             opts = Utils.removeGcOpts(opts);
--- a/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh	Wed Dec 09 11:02:54 2015 +0000
+++ b/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh	Wed Nov 18 14:51:10 2015 +0100
@@ -48,8 +48,8 @@
 
 runOne InputArgument 
 
-runOne -XX:+UseFastJNIAccessors -XX:+PrintGCDetails InputArgument -XX:+PrintGCDetails
-runOne -XX:+UseFastJNIAccessors -XX:+PrintGCDetails InputArgument -XX:+UseFastJNIAccessors
+runOne -XX:+UseFastJNIAccessors -Xlog:gc*=debug InputArgument
+runOne -XX:+UseFastJNIAccessors -Xlog:gc*=debug InputArgument -XX:+UseFastJNIAccessors
 runOne "-Dprops=one two three" InputArgument "-Dprops=one two three"
 
 exit 0
--- a/jdk/test/java/text/Format/DecimalFormat/FormatMicroBenchmark.java	Wed Dec 09 11:02:54 2015 +0000
+++ b/jdk/test/java/text/Format/DecimalFormat/FormatMicroBenchmark.java	Wed Nov 18 14:51:10 2015 +0100
@@ -51,7 +51,7 @@
  *    getting reliable numbers. Otherwise GC activity may corrupt results.
  *    As of jdk80b48 using "-Xms500m -Xmx500m -XX:NewSize=400m" covers
  *    all cases.
- *  - Optionally using "-XX:+printGC" option provides information that
+ *  - Optionally using "-Xlog:gc" option provides information that
  *    helps checking any GC activity while benches are run.
  *
  * Vm Options:
@@ -60,7 +60,7 @@
  *     non fast-path case:  -Xms500m -Xmx500m -XX:NewSize=400m
  *    or use worst case (non fast-path above) with both types of algorithm.
  *
- *  - use -XX:+PrintGC to verify memory consumption of the benchmarks.
+ *  - use -Xlog:gc to verify memory consumption of the benchmarks.
  *    (See "Checking Memory Consumption" below).
  *
  * Description:
@@ -166,7 +166,7 @@
  *  but  is   not enough,  since  any   unexpected  incremental  GC  may  lower
  *  artificially the estimation of the memory consumption.
  *
- *  Options to  set are -Xms, -Xmx,  -XX:NewSize, plus -XX:+PrintGC to evaluate
+ *  Options to  set are -Xms, -Xmx,  -XX:NewSize, plus -Xlog:gc to evaluate
  *  correctly  the  values of  these options. When  running "-verbose", varying
  *  numbers reported for memory consumption may  indicate bad choices for these
  *  options.
@@ -217,7 +217,7 @@
             "   getting reliable numbers. Otherwise GC activity may corrupt results.\n" +
             "   As of jdk80b48 using \"-Xms500m -Xmx500m -XX:NewSize=400m\" covers \n" +
             "   all cases.\n" +
-            " - Optionally using \"-XX:+printGC\" option provides information that \n" +
+            " - Optionally using \"-Xlog:gc\" option provides information that \n" +
             "   helps checking any GC activity while benches are run.\n\n" +
             "Look at the heading comments and description in source code for " +
             "detailed information.\n");
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java	Wed Dec 09 11:02:54 2015 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java	Wed Nov 18 14:51:10 2015 +0100
@@ -38,8 +38,7 @@
  * <pre>
  * {@code
  * JDKToolLauncher jmap = JDKToolLauncher.create("jmap")
- *                                       .addVMArg("-XX:+PrintGC");
- *                                       .addVMArg("-XX:+PrintGCDetails")
+ *                                       .addVMArg("-Xlog:gc*=debug")
  *                                       .addToolArg("-heap")
  *                                       .addToolArg(pid);
  * ProcessBuilder pb = new ProcessBuilder(jmap.getCommand());
--- a/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java	Wed Dec 09 11:02:54 2015 +0000
+++ b/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java	Wed Nov 18 14:51:10 2015 +0100
@@ -60,30 +60,30 @@
     }
 
     private static void testFlagPlus() throws Exception {
-        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "+PrintGC");
+        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "+HeapDumpOnOutOfMemoryError");
         output.shouldHaveExitValue(0);
-        output = JInfoHelper.jinfo("-flag", "PrintGC");
+        output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError");
         output.shouldHaveExitValue(0);
-        output.shouldContain("+PrintGC");
-        verifyIsEnabled("PrintGC");
+        output.shouldContain("+HeapDumpOnOutOfMemoryError");
+        verifyIsEnabled("HeapDumpOnOutOfMemoryError");
     }
 
     private static void testFlagMinus() throws Exception {
-        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "-PrintGC");
+        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "-HeapDumpOnOutOfMemoryError");
         output.shouldHaveExitValue(0);
-        output = JInfoHelper.jinfo("-flag", "PrintGC");
+        output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError");
         output.shouldHaveExitValue(0);
-        output.shouldContain("-PrintGC");
-        verifyIsDisabled("PrintGC");
+        output.shouldContain("-HeapDumpOnOutOfMemoryError");
+        verifyIsDisabled("HeapDumpOnOutOfMemoryError");
     }
 
     private static void testFlagEqual() throws Exception {
-        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "PrintGC=1");
+        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError=1");
         output.shouldHaveExitValue(0);
-        output = JInfoHelper.jinfo("-flag", "PrintGC");
+        output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError");
         output.shouldHaveExitValue(0);
-        output.shouldContain("+PrintGC");
-        verifyIsEnabled("PrintGC");
+        output.shouldContain("+HeapDumpOnOutOfMemoryError");
+        verifyIsEnabled("HeapDumpOnOutOfMemoryError");
     }
 
     private static void testInvalidFlag() throws Exception {
--- a/jdk/test/sun/tools/jps/JpsHelper.java	Wed Dec 09 11:02:54 2015 +0000
+++ b/jdk/test/sun/tools/jps/JpsHelper.java	Wed Nov 18 14:51:10 2015 +0100
@@ -98,7 +98,7 @@
      * -XX:+UsePerfData is required for running the tests on embedded platforms.
      */
     public static final String[] VM_ARGS = {
-        "-XX:+UsePerfData", "-Xmx512m", "-XX:+PrintGCDetails",
+        "-XX:+UsePerfData", "-Xmx512m", "-Xlog:gc",
         "-Dmultiline.prop=value1\nvalue2\r\nvalue3"
     };
     /**