< prev index next >

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

Print this page


  47 
  48 public class SpaceUtilizationCheck {
  49     // [1] Each region must have strictly less than
  50     //     WhiteBox.metaspaceReserveAlignment() bytes of unused space.
  51     // [2] There must be no gap between two consecutive regions.
  52 
  53     public static void main(String[] args) throws Exception {
  54         // (1) Default VM arguments
  55         test();
  56 
  57         // (2) Use the now deprecated VM arguments. They should have no effect.
  58         test("-XX:SharedReadWriteSize=128M",
  59              "-XX:SharedReadOnlySize=128M",
  60              "-XX:SharedMiscDataSize=128M",
  61              "-XX:SharedMiscCodeSize=128M");
  62     }
  63 
  64     static void test(String... extra_options) throws Exception {
  65         OutputAnalyzer output = CDSTestUtils.createArchive(extra_options);
  66         CDSTestUtils.checkDump(output);
  67         Pattern pattern = Pattern.compile("^(..) space: *([0-9]+).* out of *([0-9]+) bytes .* at 0x([0-9a0-f]+)");
  68         WhiteBox wb = WhiteBox.getWhiteBox();
  69         long reserve_alignment = wb.metaspaceReserveAlignment();
  70         System.out.println("Metaspace::reserve_alignment() = " + reserve_alignment);
  71 
  72         long last_region = -1;
  73         Hashtable<String,String> checked = new Hashtable<>();
  74         for (String line : output.getStdout().split("\n")) {
  75             if (line.contains(" space:") && !line.contains("st space:")) {
  76                 Matcher matcher = pattern.matcher(line);
  77                 if (matcher.find()) {
  78                     String name = matcher.group(1);
  79                     if (name.equals("s0") || name.equals("s1")) {
  80                       // String regions are listed at the end and they may not be fully occupied.
  81                       break;
  82                     } else {
  83                       System.out.println("Checking " + name + " in : " + line);
  84                       checked.put(name, name);
  85                     }
  86                     long used = Long.parseLong(matcher.group(2));
  87                     long capacity = Long.parseLong(matcher.group(3));




  47 
  48 public class SpaceUtilizationCheck {
  49     // [1] Each region must have strictly less than
  50     //     WhiteBox.metaspaceReserveAlignment() bytes of unused space.
  51     // [2] There must be no gap between two consecutive regions.
  52 
  53     public static void main(String[] args) throws Exception {
  54         // (1) Default VM arguments
  55         test();
  56 
  57         // (2) Use the now deprecated VM arguments. They should have no effect.
  58         test("-XX:SharedReadWriteSize=128M",
  59              "-XX:SharedReadOnlySize=128M",
  60              "-XX:SharedMiscDataSize=128M",
  61              "-XX:SharedMiscCodeSize=128M");
  62     }
  63 
  64     static void test(String... extra_options) throws Exception {
  65         OutputAnalyzer output = CDSTestUtils.createArchive(extra_options);
  66         CDSTestUtils.checkDump(output);
  67         Pattern pattern = Pattern.compile("^(..) *space: *([0-9]+).* out of *([0-9]+) bytes .* at 0x([0-9a0-f]+)");
  68         WhiteBox wb = WhiteBox.getWhiteBox();
  69         long reserve_alignment = wb.metaspaceReserveAlignment();
  70         System.out.println("Metaspace::reserve_alignment() = " + reserve_alignment);
  71 
  72         long last_region = -1;
  73         Hashtable<String,String> checked = new Hashtable<>();
  74         for (String line : output.getStdout().split("\n")) {
  75             if (line.contains(" space:") && !line.contains("st space:")) {
  76                 Matcher matcher = pattern.matcher(line);
  77                 if (matcher.find()) {
  78                     String name = matcher.group(1);
  79                     if (name.equals("s0") || name.equals("s1")) {
  80                       // String regions are listed at the end and they may not be fully occupied.
  81                       break;
  82                     } else {
  83                       System.out.println("Checking " + name + " in : " + line);
  84                       checked.put(name, name);
  85                     }
  86                     long used = Long.parseLong(matcher.group(2));
  87                     long capacity = Long.parseLong(matcher.group(3));


< prev index next >