author | sjohanss |
Mon, 22 Aug 2016 16:48:04 +0200 | |
changeset 40657 | a61a7a7966f2 |
parent 40631 | ed82623d7831 |
child 43467 | f91da24c6bca |
permissions | -rw-r--r-- |
19322
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
1 |
/* |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
37297
diff
changeset
|
2 |
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. |
19322
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
4 |
* |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
8 |
* |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
13 |
* accompanied this code). |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
14 |
* |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
18 |
* |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
21 |
* questions. |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
22 |
*/ |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
23 |
|
40657
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
24 |
import java.lang.management.GarbageCollectorMXBean; |
19322
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
25 |
import java.util.List; |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
26 |
import java.util.ArrayList; |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
27 |
|
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
37297
diff
changeset
|
28 |
import jdk.test.lib.ByteCodeLoader; |
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
37297
diff
changeset
|
29 |
import jdk.test.lib.InMemoryJavaCompiler; |
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
37297
diff
changeset
|
30 |
import jdk.test.lib.Platform; |
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
37297
diff
changeset
|
31 |
|
40657
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
32 |
import sun.management.ManagementFactoryHelper; |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
33 |
|
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
29678
diff
changeset
|
34 |
import static jdk.test.lib.Asserts.*; |
19322
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
35 |
|
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
36 |
/* @test TestMetaspacePerfCounters |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
37 |
* @bug 8014659 |
27692
11c231c781dc
8062537: [TESTBUG] Conflicting GC combinations in hotspot tests
eistepan
parents:
20001
diff
changeset
|
38 |
* @requires vm.gc=="null" |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
37297
diff
changeset
|
39 |
* @library /test/lib |
19322
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
40 |
* @summary Tests that performance counters for metaspace and compressed class |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
41 |
* space exists and works. |
36851 | 42 |
* @modules java.base/jdk.internal.misc |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
27692
diff
changeset
|
43 |
* java.compiler |
40657
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
44 |
* java.management/sun.management |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
27692
diff
changeset
|
45 |
* jdk.jvmstat/sun.jvmstat.monitor |
19979
ebe1dbb6e1aa
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
19322
diff
changeset
|
46 |
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedClassPointers -XX:+UsePerfData -XX:+UseSerialGC TestMetaspacePerfCounters |
ebe1dbb6e1aa
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
19322
diff
changeset
|
47 |
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedClassPointers -XX:+UsePerfData -XX:+UseParallelGC -XX:+UseParallelOldGC TestMetaspacePerfCounters |
ebe1dbb6e1aa
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
19322
diff
changeset
|
48 |
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedClassPointers -XX:+UsePerfData -XX:+UseG1GC TestMetaspacePerfCounters |
19322
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
49 |
* |
19979
ebe1dbb6e1aa
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
19322
diff
changeset
|
50 |
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -XX:+UsePerfData -XX:+UseSerialGC TestMetaspacePerfCounters |
ebe1dbb6e1aa
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
19322
diff
changeset
|
51 |
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -XX:+UsePerfData -XX:+UseParallelGC -XX:+UseParallelOldGC TestMetaspacePerfCounters |
ebe1dbb6e1aa
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
19322
diff
changeset
|
52 |
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -XX:+UsePerfData -XX:+UseG1GC TestMetaspacePerfCounters |
19322
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
53 |
*/ |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
54 |
public class TestMetaspacePerfCounters { |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
55 |
public static Class fooClass = null; |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
56 |
private static final String[] counterNames = {"minCapacity", "maxCapacity", "capacity", "used"}; |
40657
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
57 |
private static final List<GarbageCollectorMXBean> gcBeans = ManagementFactoryHelper.getGarbageCollectorMXBeans(); |
19322
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
58 |
|
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
59 |
public static void main(String[] args) throws Exception { |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
60 |
String metaspace = "sun.gc.metaspace"; |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
61 |
String ccs = "sun.gc.compressedclassspace"; |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
62 |
|
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
63 |
checkPerfCounters(metaspace); |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
64 |
|
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
65 |
if (isUsingCompressedClassPointers()) { |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
66 |
checkPerfCounters(ccs); |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
67 |
checkUsedIncreasesWhenLoadingClass(ccs); |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
68 |
} else { |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
69 |
checkEmptyPerfCounters(ccs); |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
70 |
checkUsedIncreasesWhenLoadingClass(metaspace); |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
71 |
} |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
72 |
} |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
73 |
|
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
74 |
private static void checkPerfCounters(String ns) throws Exception { |
40657
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
75 |
long gcCountBefore; |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
76 |
long gcCountAfter; |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
77 |
long minCapacity; |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
78 |
long maxCapacity; |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
79 |
long capacity; |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
80 |
long used; |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
81 |
|
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
82 |
// The perf counter values are updated during GC and to be able to |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
83 |
// do the assertions below we need to ensure that the values are from |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
84 |
// the same GC cycle. |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
85 |
do { |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
86 |
gcCountBefore = currentGCCount(); |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
87 |
|
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
88 |
minCapacity = getMinCapacity(ns); |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
89 |
maxCapacity = getMaxCapacity(ns); |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
90 |
capacity = getCapacity(ns); |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
91 |
used = getUsed(ns); |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
92 |
|
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
93 |
gcCountAfter = currentGCCount(); |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
94 |
assertGTE(gcCountAfter, gcCountBefore); |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
95 |
} while(gcCountAfter > gcCountBefore); |
20001
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
96 |
|
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
97 |
assertGTE(minCapacity, 0L); |
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
98 |
assertGTE(used, minCapacity); |
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
99 |
assertGTE(capacity, used); |
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
100 |
assertGTE(maxCapacity, capacity); |
19322
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
101 |
} |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
102 |
|
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
103 |
private static void checkEmptyPerfCounters(String ns) throws Exception { |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
104 |
for (PerfCounter counter : countersInNamespace(ns)) { |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
105 |
String msg = "Expected " + counter.getName() + " to equal 0"; |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
106 |
assertEQ(counter.longValue(), 0L, msg); |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
107 |
} |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
108 |
} |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
109 |
|
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
110 |
private static void checkUsedIncreasesWhenLoadingClass(String ns) throws Exception { |
37244
9b8f2dc281ad
8151460: Metaspace counters can have inconsistent values
sjohanss
parents:
30604
diff
changeset
|
111 |
// Need to ensure that used is up to date and that all unreachable |
9b8f2dc281ad
8151460: Metaspace counters can have inconsistent values
sjohanss
parents:
30604
diff
changeset
|
112 |
// classes are unloaded before doing this check. |
9b8f2dc281ad
8151460: Metaspace counters can have inconsistent values
sjohanss
parents:
30604
diff
changeset
|
113 |
System.gc(); |
20001
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
114 |
long before = getUsed(ns); |
19322
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
115 |
fooClass = compileAndLoad("Foo", "public class Foo { }"); |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
116 |
System.gc(); |
20001
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
117 |
long after = getUsed(ns); |
19322
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
118 |
|
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
119 |
assertGT(after, before); |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
120 |
} |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
121 |
|
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
122 |
private static List<PerfCounter> countersInNamespace(String ns) throws Exception { |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
123 |
List<PerfCounter> counters = new ArrayList<>(); |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
124 |
for (String name : counterNames) { |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
125 |
counters.add(PerfCounters.findByName(ns + "." + name)); |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
126 |
} |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
127 |
return counters; |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
128 |
} |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
129 |
|
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
130 |
private static Class<?> compileAndLoad(String name, String source) throws Exception { |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
131 |
byte[] byteCode = InMemoryJavaCompiler.compile(name, source); |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
132 |
return ByteCodeLoader.load(name, byteCode); |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
133 |
} |
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
134 |
|
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
135 |
private static boolean isUsingCompressedClassPointers() { |
19979
ebe1dbb6e1aa
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
19322
diff
changeset
|
136 |
return Platform.is64bit() && InputArguments.contains("-XX:+UseCompressedClassPointers"); |
19322
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
137 |
} |
20001
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
138 |
|
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
139 |
private static long getMinCapacity(String ns) throws Exception { |
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
140 |
return PerfCounters.findByName(ns + ".minCapacity").longValue(); |
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
141 |
} |
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
142 |
|
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
143 |
private static long getCapacity(String ns) throws Exception { |
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
144 |
return PerfCounters.findByName(ns + ".capacity").longValue(); |
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
145 |
} |
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
146 |
|
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
147 |
private static long getMaxCapacity(String ns) throws Exception { |
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
148 |
return PerfCounters.findByName(ns + ".maxCapacity").longValue(); |
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
149 |
} |
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
150 |
|
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
151 |
private static long getUsed(String ns) throws Exception { |
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
152 |
return PerfCounters.findByName(ns + ".used").longValue(); |
7446501f55bc
8024718: Metaspace performance counters and memory pools should report the same data
ehelin
parents:
19979
diff
changeset
|
153 |
} |
40657
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
154 |
|
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
155 |
private static long currentGCCount() { |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
156 |
long gcCount = 0; |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
157 |
for (GarbageCollectorMXBean bean : gcBeans) { |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
158 |
gcCount += bean.getCollectionCount(); |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
159 |
} |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
160 |
return gcCount; |
a61a7a7966f2
8163413: gc/metaspace/TestMetaspacePerfCounters failure
sjohanss
parents:
40631
diff
changeset
|
161 |
} |
19322
e35f9ed4f081
8014659: NPG: performance counters for compressed klass space
ehelin
parents:
diff
changeset
|
162 |
} |