sun.management.ManagementFactoryHelper Java Examples

The following examples show how to use sun.management.ManagementFactoryHelper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NMTHelper.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static String executeDcmd(String cmd, String ... args) {
    DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean();
    Object[] dcmdArgs = {args};
    String[] signature = {String[].class.getName()};

    String cmdString = cmd + " " +
        Arrays.stream(args).collect(Collectors.joining(" "));
    File f = new File("dcmdoutput-" + cmd + "-" + System.currentTimeMillis() + ".txt");
    System.out.println("Output from Dcmd '" + cmdString + "' is being written to file " + f);
    try (FileWriter fw = new FileWriter(f)) {
        fw.write("> " + cmdString + ":");
        String result = (String) dcmd.invoke(cmd, dcmdArgs, signature);
        fw.write(result);
        return result;
    } catch(Exception ex) {
        ex.printStackTrace();
    }
    return null;
}
 
Example #2
Source File: TestHumongousShrinkHeap.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private final void test() {
    System.gc();
    MemoryUsagePrinter.printMemoryUsage("init");

    allocate();
    MemoryUsagePrinter.printMemoryUsage("allocated");
    MemoryUsage muFull = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();

    free();
    MemoryUsagePrinter.printMemoryUsage("free");
    MemoryUsage muFree = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();

    assertLessThan(muFree.getCommitted(), muFull.getCommitted(), String.format(
            "committed free heap size is not less than committed full heap size, heap hasn't been shrunk?%n"
            + "%s = %s%n%s = %s",
            MIN_FREE_RATIO_FLAG_NAME,
            ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MIN_FREE_RATIO_FLAG_NAME).getValue(),
            MAX_FREE_RATIO_FLAG_NAME,
            ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MAX_FREE_RATIO_FLAG_NAME).getValue()
    ));
}
 
Example #3
Source File: TestHumongousShrinkHeap.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private final void test() {
    System.gc();
    MemoryUsagePrinter.printMemoryUsage("init");

    allocate();
    MemoryUsagePrinter.printMemoryUsage("allocated");
    MemoryUsage muFull = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();

    free();
    MemoryUsagePrinter.printMemoryUsage("free");
    MemoryUsage muFree = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();

    assertLessThan(muFree.getCommitted(), muFull.getCommitted(), String.format(
            "committed free heap size is not less than committed full heap size, heap hasn't been shrunk?%n"
            + "%s = %s%n%s = %s",
            MIN_FREE_RATIO_FLAG_NAME,
            ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MIN_FREE_RATIO_FLAG_NAME).getValue(),
            MAX_FREE_RATIO_FLAG_NAME,
            ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MAX_FREE_RATIO_FLAG_NAME).getValue()
    ));
}
 
Example #4
Source File: NMTHelper.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static String executeDcmd(String cmd, String ... args) {
    DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean();
    Object[] dcmdArgs = {args};
    String[] signature = {String[].class.getName()};

    try {
        System.out.print("> " + cmd + " ");
        for (String s : args) {
            System.out.print(s + " ");
        }
        System.out.println(":");
        String result = (String) dcmd.invoke(cmd, dcmdArgs, signature);
        System.out.println(result);
        return result;
    } catch(Exception ex) {
        ex.printStackTrace();
    }
    return null;
}
 
Example #5
Source File: NMTHelper.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static String executeDcmd(String cmd, String ... args) {
    DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean();
    Object[] dcmdArgs = {args};
    String[] signature = {String[].class.getName()};

    String cmdString = cmd + " " +
        Arrays.stream(args).collect(Collectors.joining(" "));
    File f = new File("dcmdoutput-" + cmd + "-" + System.currentTimeMillis() + ".txt");
    System.out.println("Output from Dcmd '" + cmdString + "' is being written to file " + f);
    try (FileWriter fw = new FileWriter(f)) {
        fw.write("> " + cmdString + ":");
        String result = (String) dcmd.invoke(cmd, dcmdArgs, signature);
        fw.write(result);
        return result;
    } catch(Exception ex) {
        ex.printStackTrace();
    }
    return null;
}
 
Example #6
Source File: DcmdUtil.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static String executeDcmd(String cmd, String ... args) {
    DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean();
    Object[] dcmdArgs = {args};
    String[] signature = {String[].class.getName()};

    try {
        System.out.print("> " + cmd + " ");
        for (String s : args) {
            System.out.print(s + " ");
        }
        System.out.println(":");
        String result = (String) dcmd.invoke(transform(cmd), dcmdArgs, signature);
        System.out.println(result);
        return result;
    } catch(Exception ex) {
        ex.printStackTrace();
    }
    return null;
}
 
Example #7
Source File: CompilerWhiteBoxTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Template method for testing. Prints tested method's info before
 * {@linkplain #test()} and after {@linkplain #test()} or on thrown
 * exception.
 *
 * @throws RuntimeException if method {@linkplain #test()} throws any
 *                          exception
 * @see #test()
 */
protected final void runTest() {
    if (ManagementFactoryHelper.getCompilationMXBean() == null) {
        System.err.println(
                "Warning: test is not applicable in interpreted mode");
        return;
    }
    System.out.println("at test's start:");
    printInfo();
    try {
        test();
    } catch (Exception e) {
        System.out.printf("on exception '%s':", e.getMessage());
        printInfo();
        e.printStackTrace();
        if (e instanceof RuntimeException) {
            throw (RuntimeException) e;
        }
        throw new RuntimeException(e);
    }
    System.out.println("at test's end:");
    printInfo();
}
 
Example #8
Source File: NMTHelper.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private static String executeDcmd(String cmd, String ... args) {
    DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean();
    Object[] dcmdArgs = {args};
    String[] signature = {String[].class.getName()};

    String cmdString = cmd + " " +
        Arrays.stream(args).collect(Collectors.joining(" "));
    File f = new File("dcmdoutput-" + cmd + "-" + System.currentTimeMillis() + ".txt");
    System.out.println("Output from Dcmd '" + cmdString + "' is being written to file " + f);
    try (FileWriter fw = new FileWriter(f)) {
        fw.write("> " + cmdString + ":");
        String result = (String) dcmd.invoke(cmd, dcmdArgs, signature);
        fw.write(result);
        return result;
    } catch(Exception ex) {
        ex.printStackTrace();
    }
    return null;
}
 
Example #9
Source File: DcmdUtil.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static String executeDcmd(String cmd, String ... args) {
    DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean();
    Object[] dcmdArgs = {args};
    String[] signature = {String[].class.getName()};

    try {
        System.out.print("> " + cmd + " ");
        for (String s : args) {
            System.out.print(s + " ");
        }
        System.out.println(":");
        String result = (String) dcmd.invoke(transform(cmd), dcmdArgs, signature);
        System.out.println(result);
        return result;
    } catch(Exception ex) {
        ex.printStackTrace();
    }
    return null;
}
 
Example #10
Source File: NMTHelper.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static String executeDcmd(String cmd, String ... args) {
    DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean();
    Object[] dcmdArgs = {args};
    String[] signature = {String[].class.getName()};

    String cmdString = cmd + " " +
        Arrays.stream(args).collect(Collectors.joining(" "));
    File f = new File("dcmdoutput-" + cmd + "-" + System.currentTimeMillis() + ".txt");
    System.out.println("Output from Dcmd '" + cmdString + "' is being written to file " + f);
    try (FileWriter fw = new FileWriter(f)) {
        fw.write("> " + cmdString + ":");
        String result = (String) dcmd.invoke(cmd, dcmdArgs, signature);
        fw.write(result);
        return result;
    } catch(Exception ex) {
        ex.printStackTrace();
    }
    return null;
}
 
Example #11
Source File: NMTHelper.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static String executeDcmd(String cmd, String ... args) {
    DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean();
    Object[] dcmdArgs = {args};
    String[] signature = {String[].class.getName()};

    String cmdString = cmd + " " +
        Arrays.stream(args).collect(Collectors.joining(" "));
    File f = new File("dcmdoutput-" + cmd + "-" + System.currentTimeMillis() + ".txt");
    System.out.println("Output from Dcmd '" + cmdString + "' is being written to file " + f);
    try (FileWriter fw = new FileWriter(f)) {
        fw.write("> " + cmdString + ":");
        String result = (String) dcmd.invoke(cmd, dcmdArgs, signature);
        fw.write(result);
        return result;
    } catch(Exception ex) {
        ex.printStackTrace();
    }
    return null;
}
 
Example #12
Source File: NMTHelper.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static String executeDcmd(String cmd, String ... args) {
    DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean();
    Object[] dcmdArgs = {args};
    String[] signature = {String[].class.getName()};

    String cmdString = cmd + " " +
        Arrays.stream(args).collect(Collectors.joining(" "));
    File f = new File("dcmdoutput-" + cmd + "-" + System.currentTimeMillis() + ".txt");
    System.out.println("Output from Dcmd '" + cmdString + "' is being written to file " + f);
    try (FileWriter fw = new FileWriter(f)) {
        fw.write("> " + cmdString + ":");
        String result = (String) dcmd.invoke(cmd, dcmdArgs, signature);
        fw.write(result);
        return result;
    } catch(Exception ex) {
        ex.printStackTrace();
    }
    return null;
}
 
Example #13
Source File: TestSummarizeRSetStatsTools.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static boolean testingG1GC() {
    HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();

    VMOption option = diagnostic.getVMOption("UseG1GC");
    if (option.getValue().equals("false")) {
      System.out.println("Skipping this test. It is only a G1 test.");
      return false;
    }
    return true;
}
 
Example #14
Source File: TestG1HeapRegionSize.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
  HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();

  VMOption option = diagnostic.getVMOption("UseG1GC");
  if (option.getValue().equals("false")) {
    System.out.println("Skipping this test. It is only a G1 test.");
    return;
  }

  String expectedValue = getExpectedValue(args);
  option = diagnostic.getVMOption("G1HeapRegionSize");
  if (!expectedValue.equals(option.getValue())) {
    throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue());
  }
}
 
Example #15
Source File: TestShrinkDefragmentedHeap.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private String prepareMessageCommittedIsNotLess() {
    return String.format(
            "committed free heap size is not less than committed full heap size, heap hasn't been shrunk?%n"
            + "%s = %s%n%s = %s",
            MIN_FREE_RATIO_FLAG_NAME,
            ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MIN_FREE_RATIO_FLAG_NAME).getValue(),
            MAX_FREE_RATIO_FLAG_NAME,
            ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MAX_FREE_RATIO_FLAG_NAME).getValue()
    );
}
 
Example #16
Source File: TestSummarizeRSetStatsTools.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static boolean testingG1GC() {
    HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();

    VMOption option = diagnostic.getVMOption("UseG1GC");
    if (option.getValue().equals("false")) {
      System.out.println("Skipping this test. It is only a G1 test.");
      return false;
    }
    return true;
}
 
Example #17
Source File: Utils.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns value of VM option.
 *
 * @param name option's name
 * @return value of option or {@code null}, if option doesn't exist
 * @throws NullPointerException if name is null
 */
public static String getVMOption(String name) {
    String result;
    HotSpotDiagnosticMXBean diagnostic
            = ManagementFactoryHelper.getDiagnosticMXBean();
    result = diagnostic.getVMOption(name).getValue();
    return result;
}
 
Example #18
Source File: CompilerWhiteBoxTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns value of VM option.
 *
 * @param name option's name
 * @return value of option or {@code null}, if option doesn't exist
 * @throws NullPointerException if name is null
 */
protected static String getVMOption(String name) {
    Objects.requireNonNull(name);
    HotSpotDiagnosticMXBean diagnostic
            = ManagementFactoryHelper.getDiagnosticMXBean();
    VMOption tmp;
    try {
        tmp = diagnostic.getVMOption(name);
    } catch (IllegalArgumentException e) {
        tmp = null;
    }
    return (tmp == null ? null : tmp.getValue());
}
 
Example #19
Source File: TestSummarizeRSetStatsTools.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static boolean testingG1GC() {
    HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();

    VMOption option = diagnostic.getVMOption("UseG1GC");
    if (option.getValue().equals("false")) {
      System.out.println("Skipping this test. It is only a G1 test.");
      return false;
    }
    return true;
}
 
Example #20
Source File: RedefineMethodInBacktraceApp.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void doMethodInBacktraceTestB() throws Exception {
    // Start a thread which blocks in method
    Thread t = new Thread(RedefineMethodInBacktraceTargetB::methodToRedefine);
    t.setDaemon(true);
    t.start();

    // Wait here until the new thread is in the method we want to redefine
    called.await();

    // Now redefine the class while the method is still on the stack of the new thread
    doRedefine(RedefineMethodInBacktraceTargetB.class);

    // Do thread dumps in two different ways (to exercise different code paths)
    // while the old class is still on the stack

    ThreadInfo[] tis = ManagementFactory.getThreadMXBean().dumpAllThreads(false, false);
    for(ThreadInfo ti : tis) {
        System.out.println(ti);
    }

    String[] threadPrintArgs = {};
    Object[] dcmdArgs = {threadPrintArgs};
    String[] signature = {String[].class.getName()};
    DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean();
    System.out.println(dcmd.invoke("threadPrint", dcmdArgs, signature));

    // release the thread
    stop.countDown();
}
 
Example #21
Source File: TestG1HeapRegionSize.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
  HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();

  String expectedValue = getExpectedValue(args);
  VMOption option = diagnostic.getVMOption("G1HeapRegionSize");
  if (!expectedValue.equals(option.getValue())) {
    throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue());
  }
}
 
Example #22
Source File: DiagnosticCommandImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static synchronized DiagnosticCommandMBean getDiagnosticCommandMBean() {
    VMManagement jvm = ManagementFactoryHelper.getVMManagement();

    // Remote Diagnostic Commands may not be supported
    if (diagCommandMBean == null && jvm.isRemoteDiagnosticCommandsSupported()) {
        diagCommandMBean = new DiagnosticCommandImpl(jvm);
    }
    return diagCommandMBean;
}
 
Example #23
Source File: TestG1HeapRegionSize.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
  HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();

  String expectedValue = getExpectedValue(args);
  VMOption option = diagnostic.getVMOption("UseG1GC");
  if (option.getValue().equals("false")) {
    System.out.println("Skipping this test. It is only a G1 test.");
    return;
  }

  option = diagnostic.getVMOption("G1HeapRegionSize");
  if (!expectedValue.equals(option.getValue())) {
    throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue());
  }
}
 
Example #24
Source File: TestShrinkDefragmentedHeap.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private String prepareMessageCommittedIsNotLess() {
    return String.format(
            "committed free heap size is not less than committed full heap size, heap hasn't been shrunk?%n"
            + "%s = %s%n%s = %s",
            MIN_FREE_RATIO_FLAG_NAME,
            ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MIN_FREE_RATIO_FLAG_NAME).getValue(),
            MAX_FREE_RATIO_FLAG_NAME,
            ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MAX_FREE_RATIO_FLAG_NAME).getValue()
    );
}
 
Example #25
Source File: TestGreyReclaimedHumongousObjects.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();

    System.out.println("Max memory= " + MAX_MEMORY + " bytes");

    int obj_size = 0;
    long seconds_to_run = 0;
    if (args.length != 2) {
        throw new RuntimeException("Object size argument must be supplied");
    } else {
        obj_size = Integer.parseInt(args[0]);
        seconds_to_run = Integer.parseInt(args[1]);
    }
    System.out.println("Objects size= " + obj_size + " bytes");
    System.out.println("Seconds to run=" + seconds_to_run);

    int region_size =
        Integer.parseInt(diagnostic.getVMOption("G1HeapRegionSize").getValue());
    if (obj_size < (region_size / 2)) {
        throw new RuntimeException("Object size " + obj_size +
                                   " is not humongous with region size " + region_size);
    }

    ExecutorService executor =
        Executors.newFixedThreadPool(THREAD_COUNT, new NamedThreadFactory());
    System.out.println("Starting " + THREAD_COUNT + " threads");

    for (int i = 0; i < THREAD_COUNT; i++) {
        executor.execute(new Runner(obj_size));
    }

    Thread.sleep(seconds_to_run * 1000);
    executor.shutdownNow();

    if (!executor.awaitTermination(10, TimeUnit.SECONDS)) {
        System.err.println("Thread pool did not terminate after 10 seconds after shutdown");
    }
}
 
Example #26
Source File: TestShrinkDefragmentedHeap.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private String prepareMessageCommittedIsNotLess() {
    return String.format(
            "committed free heap size is not less than committed full heap size, heap hasn't been shrunk?%n"
            + "%s = %s%n%s = %s",
            MIN_FREE_RATIO_FLAG_NAME,
            ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MIN_FREE_RATIO_FLAG_NAME).getValue(),
            MAX_FREE_RATIO_FLAG_NAME,
            ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MAX_FREE_RATIO_FLAG_NAME).getValue()
    );
}
 
Example #27
Source File: TestUseCompressedOopsErgoTools.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private static long getCompressedClassSpaceSize() {
  HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();

  VMOption option = diagnostic.getVMOption("CompressedClassSpaceSize");
  return Long.parseLong(option.getValue());
}
 
Example #28
Source File: CompileTheWorld.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Entry point. Compiles classes in {@code args}, or all classes in
 * boot-classpath if args is empty
 *
 * @param args paths to jar/zip, dir contains classes, or to .lst file
 *             contains list of classes to compile
 */
public static void main(String[] args) {
    String logfile = Utils.LOG_FILE;
    PrintStream os = null;
    if (logfile != null) {
        try {
            os = new PrintStream(Files.newOutputStream(Paths.get(logfile)));
        } catch (IOException io) {
        }
    }
    if (os != null) {
        System.setOut(os);
    }

    try {
        try {
            if (ManagementFactoryHelper.getCompilationMXBean() == null) {
                throw new RuntimeException(
                        "CTW can not work in interpreted mode");
            }
        } catch (java.lang.NoClassDefFoundError e) {
            // compact1, compact2 support
        }
        String[] paths = args;
        boolean skipRtJar = false;
        if (args.length == 0) {
            paths = getDefaultPaths();
            skipRtJar = true;
        }
        ExecutorService executor = createExecutor();
        long start = System.currentTimeMillis();
        try {
            String path;
            for (int i = 0, n = paths.length; i < n
                    && !PathHandler.isFinished(); ++i) {
                path = paths[i];
                if (skipRtJar && i > 0 && isRtJar(path)) {
                    // rt.jar is not first, so skip it
                    continue;
                }
                PathHandler.create(path, executor).process();
            }
        } finally {
            await(executor);
        }
        System.out.printf("Done (%d classes, %d methods, %d ms)%n",
                Compiler.getClassCount(),
                Compiler.getMethodCount(),
                System.currentTimeMillis() - start);
    } finally {
        if (os != null) {
            os.close();
        }
    }
}
 
Example #29
Source File: HotSpotThreadImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public HotSpotThreadImpl(VMManagement vm) {
    super(ManagementFactoryHelper.getVMManagement());
}
 
Example #30
Source File: TestUseCompressedOopsErgoTools.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private static long getCompressedClassSpaceSize() {
  HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();

  VMOption option = diagnostic.getVMOption("CompressedClassSpaceSize");
  return Long.parseLong(option.getValue());
}