22 */
23
24 package gc.metaspace;
25
26 import java.util.List;
27 import java.lang.management.*;
28
29 import jdk.test.lib.Platform;
30 import static jdk.test.lib.Asserts.*;
31 import gc.testlibrary.PerfCounters;
32
33 /* @test TestPerfCountersAndMemoryPools
34 * @bug 8023476
35 * @library /test/lib /
36 * @requires vm.gc.Serial
37 * @summary Tests that a MemoryPoolMXBeans and PerfCounters for metaspace
38 * report the same data.
39 * @modules java.base/jdk.internal.misc
40 * java.management
41 * jdk.internal.jvmstat/sun.jvmstat.monitor
42 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedClassPointers -XX:+UseSerialGC -XX:+UsePerfData -Xint gc.metaspace.TestPerfCountersAndMemoryPools
43 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -XX:+UseSerialGC -XX:+UsePerfData -Xint gc.metaspace.TestPerfCountersAndMemoryPools
44 */
45 public class TestPerfCountersAndMemoryPools {
46 public static void main(String[] args) throws Exception {
47 checkMemoryUsage("Metaspace", "sun.gc.metaspace");
48
49 if (InputArguments.contains("-XX:+UseCompressedClassPointers") && Platform.is64bit()) {
50 checkMemoryUsage("Compressed Class Space", "sun.gc.compressedclassspace");
51 }
52 }
53
54 private static MemoryPoolMXBean getMemoryPool(String memoryPoolName) {
55 List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
56 for (MemoryPoolMXBean pool : pools) {
57 if (pool.getName().equals(memoryPoolName)) {
58 return pool;
59 }
60 }
61
62 throw new RuntimeException("Excpted to find a memory pool with name " +
63 memoryPoolName);
|
22 */
23
24 package gc.metaspace;
25
26 import java.util.List;
27 import java.lang.management.*;
28
29 import jdk.test.lib.Platform;
30 import static jdk.test.lib.Asserts.*;
31 import gc.testlibrary.PerfCounters;
32
33 /* @test TestPerfCountersAndMemoryPools
34 * @bug 8023476
35 * @library /test/lib /
36 * @requires vm.gc.Serial
37 * @summary Tests that a MemoryPoolMXBeans and PerfCounters for metaspace
38 * report the same data.
39 * @modules java.base/jdk.internal.misc
40 * java.management
41 * jdk.internal.jvmstat/sun.jvmstat.monitor
42 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:+UseSerialGC -XX:+UsePerfData -Xint gc.metaspace.TestPerfCountersAndMemoryPools
43 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseSerialGC -XX:+UsePerfData -Xint gc.metaspace.TestPerfCountersAndMemoryPools
44 */
45 public class TestPerfCountersAndMemoryPools {
46 public static void main(String[] args) throws Exception {
47 checkMemoryUsage("Metaspace", "sun.gc.metaspace");
48
49 if (InputArguments.contains("-XX:+UseCompressedClassPointers") && Platform.is64bit()) {
50 checkMemoryUsage("Compressed Class Space", "sun.gc.compressedclassspace");
51 }
52 }
53
54 private static MemoryPoolMXBean getMemoryPool(String memoryPoolName) {
55 List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
56 for (MemoryPoolMXBean pool : pools) {
57 if (pool.getName().equals(memoryPoolName)) {
58 return pool;
59 }
60 }
61
62 throw new RuntimeException("Excpted to find a memory pool with name " +
63 memoryPoolName);
|