Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/resourcehogs/serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java
41153 views
1
/*
2
* Copyright (c) 2018, 2020, 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
/**
25
* @test
26
* @bug 8175312
27
* @summary Test clhsdb 'g1regiondetails' and 'scanoops' commands for G1GC
28
* @requires vm.gc.G1
29
* @requires vm.hasSA & (vm.bits == "64" & os.maxMemory > 8g)
30
* @library /test/lib /test/hotspot/jtreg/serviceability/sa
31
* @run main/othervm/timeout=2400 ClhsdbRegionDetailsScanOopsForG1
32
*/
33
34
import java.util.HashMap;
35
import java.util.List;
36
import java.util.ArrayList;
37
import java.util.Map;
38
import jdk.test.lib.apps.LingeredApp;
39
import jtreg.SkippedException;
40
41
public class ClhsdbRegionDetailsScanOopsForG1 {
42
43
public static void main(String[] args) throws Exception {
44
System.out.println("Starting ClhsdbRegionDetailsScanOopsForG1 test");
45
46
LingeredAppWithLargeStringArray theApp = null;
47
try {
48
ClhsdbLauncher test = new ClhsdbLauncher();
49
50
theApp = new LingeredAppWithLargeStringArray();
51
LingeredApp.startApp(theApp,
52
"-XX:+UseG1GC",
53
"-Xmx8g",
54
"-XX:G1HeapRegionSize=2m");
55
System.out.println("Started LingeredAppWithLargeStringArray with pid " + theApp.getPid());
56
57
List<String> cmds = List.of("g1regiondetails");
58
Map<String, List<String>> expStrMap = new HashMap<>();
59
Map<String, List<String>> unExpStrMap = new HashMap<>();
60
61
// Test that the various types of regions are listed with the
62
// 'g1regiondetails' command
63
expStrMap.put("g1regiondetails", List.of(
64
"Region",
65
"Eden",
66
"Survivor",
67
"StartsHumongous",
68
"ContinuesHumongous",
69
"Free"));
70
unExpStrMap.put("g1regiondetails", List.of("Unknown Region Type"));
71
String regionDetailsOutput = test.run(theApp.getPid(), cmds,
72
expStrMap, unExpStrMap);
73
// Test the output of 'scanoops' -- get the start and end addresses
74
// from the StartsHumongous region. Ensure that it contains an
75
// array of Strings.
76
String[] snippets = regionDetailsOutput.split(":StartsHumongous");
77
snippets = snippets[0].split("Region: ");
78
String[] words = snippets[snippets.length - 1].split(",");
79
// words[0] and words[1] represent the start and end addresses
80
String cmd = "scanoops " + words[0] + " " + words[1];
81
expStrMap = new HashMap<>();
82
expStrMap.put(cmd, List.of("\\[Ljava/lang/String"));
83
test.run(theApp.getPid(), List.of(cmd), expStrMap, null);
84
} catch (SkippedException e) {
85
throw e;
86
} catch (Exception ex) {
87
throw new RuntimeException("Test ERROR " + ex, ex);
88
} finally {
89
LingeredApp.stopApp(theApp);
90
}
91
System.out.println("Test PASSED");
92
}
93
}
94
95