# HG changeset patch # User simonis # Date 1531329807 -7200 # Wed Jul 11 19:23:27 2018 +0200 # Node ID ed82ed15c8fce4c4b961be9a2386b04198f5a2d1 # Parent 69b438908512d3dfef5852c6a843a5778333a309 8207067: [test] prevent timeouts in serviceability/tmtools/jstat/{GcTest02,GcCauseTest02}.java diff --git a/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest02.java b/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest02.java --- a/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest02.java +++ b/test/hotspot/jtreg/serviceability/tmtools/jstat/GcCauseTest02.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,13 +32,32 @@ * @modules java.base/jdk.internal.misc * @library /test/lib * @library ../share - * @run main/othervm -XX:+UsePerfData -XX:MaxNewSize=4m -XX:MaxHeapSize=128M -XX:MaxMetaspaceSize=128M GcCauseTest02 + * @build sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + -XX:+UsePerfData -XX:MaxNewSize=4m -XX:MaxHeapSize=128M -XX:MaxMetaspaceSize=128M GcCauseTest02 */ import utils.*; +import sun.hotspot.WhiteBox; public class GcCauseTest02 { public static void main(String[] args) throws Exception { + // This test produces more than 90_000 classes until it eats up ~70% of the 128M meta space. + // The loading of each of these classes triggers a full dependency check for ALL nmethods + // in debug/fastdebug builds because 'VerifyDependencies' is 'true' there. This slows down the + // test from about 3 sec. in the opt to about 88 sec. in the fastdebug build on x86_64 and from + // about 4 sec. to about 560 sec. on ppc64. + // Because this test is not about dependency checking, it makes sense to switch of + // 'VerifyDependencies' if it is run inside a debug/fastdebug VM and decrease the execution time + // down to about 6 sec. on both x86_64 and ppc64. + WhiteBox wb = WhiteBox.getWhiteBox(); + if (!wb.isConstantVMFlag("VerifyDependencies")) { + // "VerifyDependencies" is a "development" flag (i.e. it is constant in a product build) so + // '!wb.isConstantVMFlag("VerifyDependencies")' means that we run inside a debug/fastdebug VM. + wb.setBooleanVMFlag("VerifyDependencies", false); + } new GarbageProducerTest(new JstatGcCauseTool(ProcessHandle.current().pid())).run(); } } diff --git a/test/hotspot/jtreg/serviceability/tmtools/jstat/GcTest02.java b/test/hotspot/jtreg/serviceability/tmtools/jstat/GcTest02.java --- a/test/hotspot/jtreg/serviceability/tmtools/jstat/GcTest02.java +++ b/test/hotspot/jtreg/serviceability/tmtools/jstat/GcTest02.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,13 +32,32 @@ * @modules java.base/jdk.internal.misc * @library /test/lib * @library ../share - * @run main/othervm -XX:+UsePerfData -XX:MaxNewSize=4m -XX:MaxHeapSize=128M -XX:MaxMetaspaceSize=128M GcTest02 + * @build sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + -XX:+UsePerfData -XX:MaxNewSize=4m -XX:MaxHeapSize=128M -XX:MaxMetaspaceSize=128M GcTest02 */ import utils.*; +import sun.hotspot.WhiteBox; public class GcTest02 { public static void main(String[] args) throws Exception { + WhiteBox wb = WhiteBox.getWhiteBox(); + // This test produces more than 90_000 classes until it eats up ~70% of the 128M meta space. + // The loading of each of these classes triggers a full dependency check for ALL nmethods + // in debug/fastdebug builds because 'VerifyDependencies' is 'true' there. This slows down the + // test from about 3 sec. in the opt to about 88 sec. in the fastdebug build on x86_64 and from + // about 4 sec. to about 560 sec. on ppc64. + // Because this test is not about dependency checking, it makes sense to switch of + // 'VerifyDependencies' if it is run inside a debug/fastdebug VM and decrease the execution time + // down to about 6 sec. on both x86_64 and ppc64. + if (!wb.isConstantVMFlag("VerifyDependencies")) { + // "VerifyDependencies" is a "development" flag (i.e. it is constant in a product build) so + // '!wb.isConstantVMFlag("VerifyDependencies")' means that we run inside a debug/fastdebug VM. + wb.setBooleanVMFlag("VerifyDependencies", false); + } new GarbageProducerTest(new JstatGcTool(ProcessHandle.current().pid())).run(); } }