< prev index next >

test/hotspot/jtreg/runtime/cds/SpaceUtilizationCheck.java

Print this page

@@ -42,10 +42,11 @@
 import java.util.ArrayList;
 import java.util.Hashtable;
 import java.lang.Integer;
 
 public class SpaceUtilizationCheck {
+    // For the MC/RW/RO regions:
     // [1] Each region must have strictly less than
     //     WhiteBox.metaspaceReserveAlignment() bytes of unused space.
     // [2] There must be no gap between two consecutive regions.
 
     public static void main(String[] args) throws Exception {

@@ -63,29 +64,34 @@
     static void test(String... extra_options) throws Exception {
         CDSOptions opts = new CDSOptions();
         opts.addSuffix(extra_options);
         OutputAnalyzer output = CDSTestUtils.createArchive(opts);
         CDSTestUtils.checkDump(output);
-        Pattern pattern = Pattern.compile("(..) *space: *([0-9]+).* out of *([0-9]+) bytes .* at 0x([0-9a0-f]+)");
+        Pattern pattern = Pattern.compile("(..)  space: *([0-9]+).* out of *([0-9]+) bytes .* at 0x([0-9a0-f]+)");
         WhiteBox wb = WhiteBox.getWhiteBox();
         long reserve_alignment = wb.metaspaceReserveAlignment();
         System.out.println("Metaspace::reserve_alignment() = " + reserve_alignment);
 
+        // Look for output like this. The pattern will only match the first 3 regions, which is what we need to check
+        //
+        // [4.682s][debug][cds] mc  space:     24912 [  0.2% of total] out of     28672 bytes [ 86.9% used] at 0x0000000800000000
+        // [4.682s][debug][cds] rw  space:   4391632 [ 33.7% of total] out of   4395008 bytes [ 99.9% used] at 0x0000000800007000
+        // [4.682s][debug][cds] ro  space:   7570632 [ 58.0% of total] out of   7573504 bytes [100.0% used] at 0x0000000800438000
+        // [4.682s][debug][cds] bm  space:    213528 [  1.6% of total] out of    213528 bytes [100.0% used]
+        // [4.682s][debug][cds] ca0 space:    507904 [  3.9% of total] out of    507904 bytes [100.0% used] at 0x00000000fff00000
+        // [4.682s][debug][cds] oa0 space:    327680 [  2.5% of total] out of    327680 bytes [100.0% used] at 0x00000000ffe00000
+        // [4.682s][debug][cds] total    :  13036288 [100.0% of total] out of  13049856 bytes [ 99.9% used]
+
         long last_region = -1;
         Hashtable<String,String> checked = new Hashtable<>();
         for (String line : output.getStdout().split("\n")) {
             if (line.contains(" space:") && !line.contains("st space:")) {
                 Matcher matcher = pattern.matcher(line);
                 if (matcher.find()) {
                     String name = matcher.group(1);
-                    if (name.equals("bm")) {
-                      // Bitmap space does not have a requested address.
-                      break;
-                    } else {
                       System.out.println("Checking " + name + " in : " + line);
                       checked.put(name, name);
-                    }
                     long used = Long.parseLong(matcher.group(2));
                     long capacity = Long.parseLong(matcher.group(3));
                     long address = Long.parseLong(matcher.group(4), 16);
                     long unused = capacity - used;
                     if (unused < 0) {
< prev index next >