Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/gc/g1/TestRemsetLoggingThreads.java
40942 views
1
/*
2
* Copyright (c) 2013, 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
package gc.g1;
25
26
/*
27
* @test TestRemsetLoggingThreads
28
* @requires vm.gc.G1
29
* @bug 8025441 8145534
30
* @library /test/lib
31
* @modules java.base/jdk.internal.misc
32
* java.management/sun.management
33
* @summary Ensure that various values of worker threads/concurrent
34
* refinement threads do not crash the VM.
35
* @run driver gc.g1.TestRemsetLoggingThreads
36
*/
37
38
import java.util.regex.Matcher;
39
import java.util.regex.Pattern;
40
41
import jdk.test.lib.process.OutputAnalyzer;
42
import jdk.test.lib.process.ProcessTools;
43
44
public class TestRemsetLoggingThreads {
45
46
private static void runTest(int refinementThreads, int workerThreads) throws Exception {
47
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
48
"-XX:+UnlockDiagnosticVMOptions",
49
"-Xlog:gc+remset+exit=trace",
50
"-XX:G1ConcRefinementThreads=" + refinementThreads,
51
"-XX:ParallelGCThreads=" + workerThreads,
52
"-version");
53
54
OutputAnalyzer output = new OutputAnalyzer(pb.start());
55
56
String pattern = "Concurrent refinement threads times \\(s\\)$";
57
Matcher m = Pattern.compile(pattern, Pattern.MULTILINE).matcher(output.getStdout());
58
59
if (!m.find()) {
60
throw new Exception("Could not find correct output for concurrent RS threads times in stdout," +
61
" should match the pattern \"" + pattern + "\", but stdout is \n" + output.getStdout());
62
}
63
output.shouldHaveExitValue(0);
64
}
65
66
public static void main(String[] args) throws Exception {
67
// different valid combinations of number of refinement and gc worker threads
68
runTest(1, 1);
69
runTest(1, 5);
70
runTest(5, 1);
71
runTest(10, 10);
72
runTest(1, 2);
73
runTest(4, 3);
74
}
75
}
76
77