mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-12 22:50:08 +00:00
8145534: TestRemsetLogging.java takes a long time
Improve the test and test settings to decrease the time it takes. Reviewed-by: brutisso, jmasa, dfazunen
This commit is contained in:
parent
34b95824b7
commit
7806389bef
@ -23,11 +23,14 @@
|
||||
|
||||
/*
|
||||
* @test TestRemsetLogging.java
|
||||
* @bug 8013895 8129977
|
||||
* @library /testlibrary
|
||||
* @requires vm.gc=="G1" | vm.gc =="null"
|
||||
* @bug 8013895 8129977 8145534
|
||||
* @library /testlibrary /test/lib
|
||||
* @modules java.base/sun.misc
|
||||
* java.management/sun.management
|
||||
* @build TestRemsetLoggingTools TestRemsetLogging
|
||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||
* @summary Verify output of -Xlog:gc+remset*=trace
|
||||
* @run main TestRemsetLogging
|
||||
*
|
||||
@ -39,10 +42,6 @@ public class TestRemsetLogging {
|
||||
public static void main(String[] args) throws Exception {
|
||||
String result;
|
||||
|
||||
if (!TestRemsetLoggingTools.testingG1GC()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// no remembered set summary output
|
||||
result = TestRemsetLoggingTools.runTest(null, 0);
|
||||
TestRemsetLoggingTools.expectRSetSummaries(result, 0, 0);
|
||||
|
||||
@ -23,29 +23,23 @@
|
||||
|
||||
/*
|
||||
* @test TestRemsetLoggingPerRegion.java
|
||||
* @bug 8014078 8129977
|
||||
* @library /testlibrary
|
||||
* @requires vm.gc=="G1" | vm.gc =="null"
|
||||
* @bug 8014078 8129977 8145534
|
||||
* @library /testlibrary /test/lib
|
||||
* @modules java.base/sun.misc
|
||||
* java.management/sun.management
|
||||
* @build TestRemsetLoggingTools TestRemsetLoggingPerRegion
|
||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||
* @summary Verify output of -Xlog:gc+remset*=trace in regards to per-region type output
|
||||
* @run main TestRemsetLoggingPerRegion
|
||||
*/
|
||||
|
||||
import jdk.test.lib.*;
|
||||
import java.lang.Thread;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class TestRemsetLoggingPerRegion {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String result;
|
||||
|
||||
if (!TestRemsetLoggingTools.testingG1GC()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// single remembered set summary output at the end
|
||||
result = TestRemsetLoggingTools.runTest(new String[] { "-Xlog:gc+remset*=trace" }, 0);
|
||||
TestRemsetLoggingTools.expectPerRegionRSetSummaries(result, 1, 0);
|
||||
|
||||
@ -23,13 +23,14 @@
|
||||
|
||||
/*
|
||||
* @test TestRemsetLoggingThreads
|
||||
* @bug 8025441
|
||||
* @summary Ensure that various values of worker threads/concurrent
|
||||
* refinement threads do not crash the VM.
|
||||
* @requires vm.gc=="G1" | vm.gc=="null"
|
||||
* @bug 8025441 8145534
|
||||
* @key gc
|
||||
* @library /testlibrary
|
||||
* @modules java.base/sun.misc
|
||||
* java.management/sun.management
|
||||
* @summary Ensure that various values of worker threads/concurrent
|
||||
* refinement threads do not crash the VM.
|
||||
*/
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
@ -65,9 +66,6 @@ public class TestRemsetLoggingThreads {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
if (!TestRemsetLoggingTools.testingG1GC()) {
|
||||
return;
|
||||
}
|
||||
// different valid combinations of number of refinement and gc worker threads
|
||||
runTest(1, 1);
|
||||
runTest(1, 5);
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
|
||||
import com.sun.management.HotSpotDiagnosticMXBean;
|
||||
import com.sun.management.VMOption;
|
||||
import sun.hotspot.WhiteBox;
|
||||
|
||||
import jdk.test.lib.*;
|
||||
import java.lang.management.ManagementFactory;
|
||||
@ -34,61 +35,34 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
class VerifySummaryOutput {
|
||||
// 4M size, both are directly allocated into the old gen
|
||||
static Object[] largeObject1 = new Object[1024 * 1024];
|
||||
static Object[] largeObject2 = new Object[1024 * 1024];
|
||||
|
||||
static int[] temp;
|
||||
|
||||
public static void main(String[] args) {
|
||||
// create some cross-references between these objects
|
||||
for (int i = 0; i < largeObject1.length; i++) {
|
||||
largeObject1[i] = largeObject2;
|
||||
}
|
||||
|
||||
for (int i = 0; i < largeObject2.length; i++) {
|
||||
largeObject2[i] = largeObject1;
|
||||
}
|
||||
|
||||
int numGCs = Integer.parseInt(args[0]);
|
||||
|
||||
if (numGCs > 0) {
|
||||
// try to force a minor collection: the young gen is 4M, the
|
||||
// amount of data allocated below is roughly that (4*1024*1024 +
|
||||
// some header data)
|
||||
for (int i = 0; i < 1024 ; i++) {
|
||||
temp = new int[1024];
|
||||
}
|
||||
}
|
||||
|
||||
// Perform the requested amount of GCs.
|
||||
WhiteBox wb = WhiteBox.getWhiteBox();
|
||||
for (int i = 0; i < numGCs - 1; i++) {
|
||||
System.gc();
|
||||
wb.youngGC();
|
||||
}
|
||||
if (numGCs > 0) {
|
||||
wb.fullGC();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class TestRemsetLoggingTools {
|
||||
|
||||
// the VM is currently run using G1GC, i.e. trying to test G1 functionality.
|
||||
public static boolean testingG1GC() {
|
||||
HotSpotDiagnosticMXBean diagnostic =
|
||||
ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
|
||||
|
||||
VMOption option = diagnostic.getVMOption("UseG1GC");
|
||||
if (option.getValue().equals("false")) {
|
||||
System.out.println("Skipping this test. It is only a G1 test.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static String runTest(String[] additionalArgs, int numGCs) throws Exception {
|
||||
ArrayList<String> finalargs = new ArrayList<String>();
|
||||
String[] defaultArgs = new String[] {
|
||||
"-Xbootclasspath/a:.",
|
||||
"-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI",
|
||||
"-cp", System.getProperty("java.class.path"),
|
||||
"-XX:+UseG1GC",
|
||||
"-Xmn4m",
|
||||
"-Xint", // -Xint makes the test run faster
|
||||
"-Xms20m",
|
||||
"-Xmx20m",
|
||||
"-XX:ParallelGCThreads=1",
|
||||
"-XX:InitiatingHeapOccupancyPercent=100", // we don't want the additional GCs due to initial marking
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:G1HeapRegionSize=1M",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user