8221480: jcmd VM.metaspace shall print limits in basic mode
authorstuefe
Tue, 26 Mar 2019 16:26:33 +0100
changeset 54341 0b47455de59b
parent 54340 2221f042556d
child 54342 07212a29787a
8221480: jcmd VM.metaspace shall print limits in basic mode Reviewed-by: adinn, rehn
src/hotspot/share/memory/metaspace.cpp
test/hotspot/jtreg/runtime/Metaspace/PrintMetaspaceDcmd.java
--- a/src/hotspot/share/memory/metaspace.cpp	Fri Mar 29 08:42:32 2019 -0700
+++ b/src/hotspot/share/memory/metaspace.cpp	Tue Mar 26 16:26:33 2019 +0100
@@ -534,6 +534,23 @@
   }
 }
 
+static void print_basic_switches(outputStream* out, size_t scale) {
+  out->print("MaxMetaspaceSize: ");
+  if (MaxMetaspaceSize >= (max_uintx) - (2 * os::vm_page_size())) {
+    // aka "very big". Default is max_uintx, but due to rounding in arg parsing the real
+    // value is smaller.
+    out->print("unlimited");
+  } else {
+    print_human_readable_size(out, MaxMetaspaceSize, scale);
+  }
+  out->cr();
+  if (Metaspace::using_class_space()) {
+    out->print("CompressedClassSpaceSize: ");
+    print_human_readable_size(out, CompressedClassSpaceSize, scale);
+  }
+  out->cr();
+}
+
 // This will print out a basic metaspace usage report but
 // unlike print_report() is guaranteed not to lock or to walk the CLDG.
 void MetaspaceUtils::print_basic_report(outputStream* out, size_t scale) {
@@ -614,6 +631,12 @@
                               Metaspace::chunk_manager_metadata()->free_chunks_total_bytes(), scale);
     out->cr();
   }
+
+  out->cr();
+
+  // Print basic settings
+  print_basic_switches(out, scale);
+
   out->cr();
 
 }
@@ -805,19 +828,11 @@
   // Print some interesting settings
   out->cr();
   out->cr();
-  out->print("MaxMetaspaceSize: ");
-  print_human_readable_size(out, MaxMetaspaceSize, scale);
+  print_basic_switches(out, scale);
+
   out->cr();
   out->print("InitialBootClassLoaderMetaspaceSize: ");
   print_human_readable_size(out, InitialBootClassLoaderMetaspaceSize, scale);
-  out->cr();
-
-  out->print("UseCompressedClassPointers: %s", UseCompressedClassPointers ? "true" : "false");
-  out->cr();
-  if (Metaspace::using_class_space()) {
-    out->print("CompressedClassSpaceSize: ");
-    print_human_readable_size(out, CompressedClassSpaceSize, scale);
-  }
 
   out->cr();
   out->cr();
--- a/test/hotspot/jtreg/runtime/Metaspace/PrintMetaspaceDcmd.java	Fri Mar 29 08:42:32 2019 -0700
+++ b/test/hotspot/jtreg/runtime/Metaspace/PrintMetaspaceDcmd.java	Tue Mar 26 16:26:33 2019 +0100
@@ -67,7 +67,7 @@
         }
         output.shouldContain("Virtual space:");
         output.shouldContain("Chunk freelists:");
-
+        output.shouldMatch("MaxMetaspaceSize:.*201.00.*MB");
 
         pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.metaspace"});
         output = new OutputAnalyzer(pb.start());