test/gc/g1/TestGCLogMessages.java
Print this page
rev 5920 : 8035406: Improve data structure for Code Cache remembered sets
Summary: Change the code cache remembered sets data structure from a GrowableArray to a chunked list of nmethods. This makes the data structure more amenable to parallelization, and decreases freeing time.
Reviewed-by:
rev 5921 : 8027295: Free CSet takes ~50% of young pause time
Summary: Improve fast card cache iteration and avoid taking locks when freeing the collection set.
Reviewed-by:
rev 5922 : 8035398: Add card redirty time in "Other" time in G1
Summary: Show the time taken by card redirtying during GC in a new "Redirty Cards" line.
Reviewed-by:
rev 5923 : 8035654: Add times for evacuation failure handling in "Other" time
Summary: Detailed breakdown of time spent in the evacuation failure handling phases to make the "Other" time roughly correspond to the sum of its parts.
Reviewed-by:
*** 33,42 ****
--- 33,47 ----
import com.oracle.java.testlibrary.ProcessTools;
import com.oracle.java.testlibrary.OutputAnalyzer;
public class TestGCLogMessages {
public static void main(String[] args) throws Exception {
+ testNormalLogs();
+ testWithToSpaceExhaustionLogs();
+ }
+
+ private static void testNormalLogs() throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
"-Xmx10M",
GCTest.class.getName());
*** 72,83 ****
--- 77,123 ----
output.shouldContain("[Redirty Cards");
output.shouldContain("[Code Root Purge");
output.shouldContain("[Young Free CSet");
output.shouldContain("[Non-Young Free CSet");
+
+ // also check evacuation failure messages once
+ output.shouldNotContain("[Evacuation Failure");
+ output.shouldNotContain("[Recalculate Used");
+ output.shouldNotContain("[Remove Self Forwards");
+ output.shouldNotContain("[Restore RemSet");
output.shouldHaveExitValue(0);
+ }
+
+ private static void testWithToSpaceExhaustionLogs() throws Exception {
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
+ "-Xmx10M",
+ "-Xmn5M",
+ "-XX:+PrintGCDetails",
+ GCTestWithToSpaceExhaustion.class.getName());
+ OutputAnalyzer output = new OutputAnalyzer(pb.start());
+ output.shouldContain("[Evacuation Failure");
+ output.shouldNotContain("[Recalculate Used");
+ output.shouldNotContain("[Remove Self Forwards");
+ output.shouldNotContain("[Restore RemSet");
+ output.shouldHaveExitValue(0);
+
+ pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
+ "-Xmx10M",
+ "-Xmn5M",
+ "-XX:+PrintGCDetails",
+ "-XX:+UnlockExperimentalVMOptions",
+ "-XX:G1LogLevel=finest",
+ GCTestWithToSpaceExhaustion.class.getName());
+
+ output = new OutputAnalyzer(pb.start());
+ output.shouldContain("[Evacuation Failure");
+ output.shouldContain("[Recalculate Used");
+ output.shouldContain("[Remove Self Forwards");
+ output.shouldContain("[Restore RemSet");
+ output.shouldHaveExitValue(0);
}
static class GCTest {
private static byte[] garbage;
public static void main(String [] args) {
*** 86,92 ****
--- 126,147 ----
for (int i = 0; i < 1024; i++) {
garbage = new byte[128 * 1024];
}
System.out.println("Done");
}
+ }
+
+ static class GCTestWithToSpaceExhaustion {
+ private static byte[] garbage;
+ private static byte[] largeObject;
+ public static void main(String [] args) {
+ largeObject = new byte[5*1024*1024];
+ System.out.println("Creating garbage");
+ // create 128MB of garbage. This should result in at least one GC,
+ // some of them with to-space exhaustion.
+ for (int i = 0; i < 1024; i++) {
+ garbage = new byte[128 * 1024];
+ }
+ System.out.println("Done");
+ }
}
}