author | tschatzl |
Mon, 29 Sep 2014 09:59:23 +0200 | |
changeset 26933 | 2929c88db04e |
parent 18993 | 58423218a3f6 |
child 29678 | dd2f3932c21e |
permissions | -rw-r--r-- |
17395
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
1 |
/* |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
4 |
* |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
8 |
* |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
13 |
* accompanied this code). |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
14 |
* |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
18 |
* |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
21 |
* questions. |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
22 |
*/ |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
23 |
|
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
24 |
/** |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
25 |
* @test TestPrintRegionRememberedSetInfo |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
26 |
* @key gc |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
27 |
* @bug 8014240 |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
28 |
* @summary Test output of G1PrintRegionRememberedSetInfo |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
29 |
* @library /testlibrary |
18993
58423218a3f6
8020123: Test gc/g1/TestPrintRegionRememberedSetInfo.java fails with "test result: Error. No action after @build"
tschatzl
parents:
17395
diff
changeset
|
30 |
* @run main TestPrintRegionRememberedSetInfo |
17395
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
31 |
* @author thomas.schatzl@oracle.com |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
32 |
*/ |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
33 |
|
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
34 |
import com.oracle.java.testlibrary.*; |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
35 |
import java.lang.Thread; |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
36 |
import java.util.ArrayList; |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
37 |
import java.util.Arrays; |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
38 |
|
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
39 |
class RunAndWaitForMarking { |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
40 |
public static void main(String[] args) { |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
41 |
System.gc(); |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
42 |
try { |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
43 |
Thread.sleep(200); |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
44 |
} catch (InterruptedException e) { |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
45 |
} |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
46 |
} |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
47 |
} |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
48 |
|
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
49 |
public class TestPrintRegionRememberedSetInfo { |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
50 |
|
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
51 |
public static String runTest(String arg) throws Exception { |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
52 |
ArrayList<String> finalargs = new ArrayList<String>(); |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
53 |
String[] defaultArgs = new String[] { |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
54 |
"-XX:+UseG1GC", |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
55 |
"-Xmx10m", |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
56 |
"-XX:+ExplicitGCInvokesConcurrent", |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
57 |
"-XX:+UnlockDiagnosticVMOptions", |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
58 |
"-XX:+G1PrintRegionLivenessInfo", |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
59 |
"-XX:G1HeapRegionSize=1M", |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
60 |
"-XX:InitiatingHeapOccupancyPercent=0", |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
61 |
}; |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
62 |
|
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
63 |
finalargs.addAll(Arrays.asList(defaultArgs)); |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
64 |
finalargs.add(arg); |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
65 |
|
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
66 |
finalargs.add(RunAndWaitForMarking.class.getName()); |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
67 |
|
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
68 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
69 |
finalargs.toArray(new String[0])); |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
70 |
OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
71 |
output.shouldHaveExitValue(0); |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
72 |
|
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
73 |
String result = output.getStdout(); |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
74 |
return result; |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
75 |
} |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
76 |
|
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
77 |
public static void main(String[] args) throws Exception { |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
78 |
String result; |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
79 |
|
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
80 |
result = runTest("-XX:+G1PrintRegionLivenessInfo"); |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
81 |
// check that we got region statistics output |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
82 |
if (result.indexOf("PHASE") == -1) { |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
83 |
throw new RuntimeException("Unexpected output from -XX:+PrintRegionLivenessInfo found."); |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
84 |
} |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
85 |
|
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
86 |
result = runTest("-XX:-G1PrintRegionLivenessInfo"); |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
87 |
if (result.indexOf("remset") != -1) { |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
88 |
throw new RuntimeException("Should find remembered set information in output."); |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
89 |
} |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
90 |
} |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
91 |
} |
2cd3ef1be718
8014240: G1: Add remembered set size information to output of G1PrintRegionLivenessInfo
tschatzl
parents:
diff
changeset
|
92 |