Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/jdk/jfr/event/compiler/TestCodeCacheConfig.java
41710 views
1
/*
2
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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
package jdk.jfr.event.compiler;
25
26
import java.util.List;
27
28
import jdk.jfr.Recording;
29
import jdk.jfr.consumer.RecordedEvent;
30
import jdk.test.lib.Asserts;
31
import jdk.test.lib.jfr.EventNames;
32
import jdk.test.lib.jfr.Events;
33
import sun.hotspot.WhiteBox;
34
35
/**
36
* @test TestCodeCacheConfig
37
* @key jfr
38
* @requires vm.hasJFR
39
* @library /test/lib
40
* @build sun.hotspot.WhiteBox
41
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
42
* @run main/othervm -Xbootclasspath/a:.
43
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
44
* -XX:+SegmentedCodeCache jdk.jfr.event.compiler.TestCodeCacheConfig
45
* @run main/othervm -Xbootclasspath/a:.
46
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
47
* -XX:-SegmentedCodeCache jdk.jfr.event.compiler.TestCodeCacheConfig
48
* @summary check "Code Cache Configuration" jfr event
49
*/
50
public class TestCodeCacheConfig {
51
private final static String EVENT_NAME = EventNames.CodeCacheConfiguration;
52
53
private static final long CodeCacheExpectedSize = WhiteBox.getWhiteBox().getUintxVMFlag("ReservedCodeCacheSize");
54
55
public static void main(String[] args) throws Exception {
56
Recording recording = new Recording();
57
recording.enable(EVENT_NAME);
58
recording.start();
59
recording.stop();
60
61
List<RecordedEvent> events = Events.fromRecording(recording);
62
Events.hasEvents(events);
63
RecordedEvent event = events.get(0);
64
long initialSize = (long) event.getValue("initialSize");
65
long reservedSize = (long) event.getValue("reservedSize");
66
long nonNMethodSize = (long) event.getValue("nonNMethodSize");
67
long profiledSize = (long) event.getValue("profiledSize");
68
long nonProfiledSize = (long) event.getValue("nonProfiledSize");
69
long expansionSize = (long) event.getValue("expansionSize");
70
long minBlockLength = (long) event.getValue("minBlockLength");
71
long startAddress = (long) event.getValue("startAddress");
72
long reservedTopAddress = (long) event.getValue("reservedTopAddress");
73
74
Asserts.assertGT(initialSize, 1024L,
75
"initialSize less than 1024 byte, got " + initialSize);
76
77
Asserts.assertEQ(reservedSize, CodeCacheExpectedSize,
78
String.format("Unexpected reservedSize value. Expected %d but " + "got %d", CodeCacheExpectedSize, reservedSize));
79
80
Asserts.assertLTE(nonNMethodSize, CodeCacheExpectedSize,
81
String.format("Unexpected nonNMethodSize value. Expected <= %d but " + "got %d", CodeCacheExpectedSize, nonNMethodSize));
82
83
Asserts.assertLTE(profiledSize, CodeCacheExpectedSize,
84
String.format("Unexpected profiledSize value. Expected <= %d but " + "got %d", CodeCacheExpectedSize, profiledSize));
85
86
Asserts.assertLTE(nonProfiledSize, CodeCacheExpectedSize,
87
String.format("Unexpected nonProfiledSize value. Expected <= %d but " + "got %d", CodeCacheExpectedSize, nonProfiledSize));
88
89
Asserts.assertGTE(expansionSize, 1024L,
90
"expansionSize less than 1024 " + "bytes, got " + expansionSize);
91
92
Asserts.assertGTE(minBlockLength, 1L,
93
"minBlockLength less than 1 byte, got " + minBlockLength);
94
95
Asserts.assertNE(startAddress, 0L,
96
"startAddress null");
97
98
Asserts.assertNE(reservedTopAddress, 0L,
99
"codeCacheReservedTopAddr null");
100
}
101
}
102
103