4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import jdk.test.lib.Asserts;
25 import java.lang.management.MemoryPoolMXBean;
26 import java.util.HashMap;
27 import java.util.Map;
28 import sun.hotspot.code.BlobType;
29
30 /*
31 * @test GetUsageTest
32 * @library /testlibrary /test/lib
33 * @modules java.base/jdk.internal.misc
34 * java.management
35 * @build GetUsageTest
36 * @run main ClassFileInstaller sun.hotspot.WhiteBox
37 * sun.hotspot.WhiteBox$WhiteBoxPermission
38 * @run main/othervm -Xbootclasspath/a:. -XX:CompileCommand=compileonly,null::*
39 * -XX:-UseCodeCacheFlushing -XX:-MethodFlushing -XX:+SegmentedCodeCache
40 * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI GetUsageTest
41 * @summary testing of getUsage() for segmented code cache
42 */
43 public class GetUsageTest {
44
45 private final BlobType btype;
46 private final int allocateSize;
47
48 public GetUsageTest(BlobType btype, int allocSize) {
49 this.btype = btype;
50 this.allocateSize = allocSize;
51 }
52
53 public static void main(String[] args) throws Exception {
54 for (BlobType btype : BlobType.getAvailable()) {
55 for (int allocSize = 10; allocSize < 100000; allocSize *= 10) {
56 new GetUsageTest(btype, allocSize).runTest();
57 }
58 }
59 }
60
61 protected final Map<MemoryPoolMXBean, Long> getBeanUsages() {
62 Map<MemoryPoolMXBean, Long> beanUsages = new HashMap<>();
|
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test GetUsageTest
26 * @summary testing of getUsage() for segmented code cache
27 * @modules java.base/jdk.internal.misc
28 * java.management
29 * @library /testlibrary /test/lib /
30 *
31 * @build compiler.codecache.jmx.GetUsageTest
32 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
33 * sun.hotspot.WhiteBox$WhiteBoxPermission
34 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
35 * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
36 * -XX:-UseCodeCacheFlushing -XX:-MethodFlushing
37 * -XX:+SegmentedCodeCache
38 * compiler.codecache.jmx.GetUsageTest
39 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
40 * -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
41 * -XX:-UseCodeCacheFlushing -XX:-MethodFlushing
42 * -XX:-SegmentedCodeCache
43 * compiler.codecache.jmx.GetUsageTest
44 */
45
46 package compiler.codecache.jmx;
47
48 import jdk.test.lib.Asserts;
49 import sun.hotspot.code.BlobType;
50
51 import java.lang.management.MemoryPoolMXBean;
52 import java.util.HashMap;
53 import java.util.Map;
54
55 public class GetUsageTest {
56
57 private final BlobType btype;
58 private final int allocateSize;
59
60 public GetUsageTest(BlobType btype, int allocSize) {
61 this.btype = btype;
62 this.allocateSize = allocSize;
63 }
64
65 public static void main(String[] args) throws Exception {
66 for (BlobType btype : BlobType.getAvailable()) {
67 for (int allocSize = 10; allocSize < 100000; allocSize *= 10) {
68 new GetUsageTest(btype, allocSize).runTest();
69 }
70 }
71 }
72
73 protected final Map<MemoryPoolMXBean, Long> getBeanUsages() {
74 Map<MemoryPoolMXBean, Long> beanUsages = new HashMap<>();
|