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 /*
25 * @test
26 * @bug 4530538
27 * @summary Basic unit test of memory management testing:
28 * 1) setUsageThreshold() and getUsageThreshold()
29 * 2) test low memory detection on the old generation.
30 * @author Mandy Chung
31 *
32 * @requires vm.gc == "null"
33 * @requires vm.opt.ExplicitGCInvokesConcurrent != "true"
34 * @requires vm.opt.DisableExplicitGC != "true"
35 * @library /lib/testlibrary/ /test/lib
36 *
37 * @build jdk.testlibrary.* LowMemoryTest MemoryUtil RunUtil
38 * @build sun.hotspot.WhiteBox
39 * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
40 * @run main/othervm/timeout=600 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. LowMemoryTest
41 */
42
43 import java.lang.management.*;
44 import java.util.*;
45 import java.util.concurrent.Phaser;
46 import javax.management.*;
47 import javax.management.openmbean.CompositeData;
48 import jdk.test.lib.JDKToolFinder;
49 import jdk.test.lib.process.ProcessTools;
50 import jdk.testlibrary.Utils;
51
52 import sun.hotspot.code.Compiler;
53
54 public class LowMemoryTest {
55 private static final MemoryMXBean mm = ManagementFactory.getMemoryMXBean();
56 private static final List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
57 private static final Phaser phaser = new Phaser(2);
58 private static MemoryPoolMXBean mpool = null;
59 private static boolean trace = false;
60 private static boolean testFailed = false;
61 private static final int NUM_TRIGGERS = 5;
62 private static final int NUM_CHUNKS = 2;
63 private static final int YOUNG_GEN_SIZE = 8 * 1024 * 1024;
64 private static long chunkSize;
65 private static final String classMain = "LowMemoryTest$TestMain";
66
67 /**
68 * Run the test multiple times with different GC versions.
69 * First with default command line specified by the framework.
70 * Then with GC versions specified by the test.
|
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 /*
25 * @test
26 * @bug 4530538
27 * @summary Basic unit test of memory management testing:
28 * 1) setUsageThreshold() and getUsageThreshold()
29 * 2) test low memory detection on the old generation.
30 * @author Mandy Chung
31 *
32 * @requires vm.gc == "null"
33 * @requires vm.opt.ExplicitGCInvokesConcurrent != "true"
34 * @requires vm.opt.DisableExplicitGC != "true"
35 * @library /test/lib
36 *
37 * @build LowMemoryTest MemoryUtil RunUtil
38 * @build sun.hotspot.WhiteBox
39 * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
40 * @run main/othervm/timeout=600 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. LowMemoryTest
41 */
42
43 import java.lang.management.*;
44 import java.util.*;
45 import java.util.concurrent.Phaser;
46 import javax.management.*;
47 import javax.management.openmbean.CompositeData;
48 import jdk.test.lib.JDKToolFinder;
49 import jdk.test.lib.process.ProcessTools;
50 import jdk.test.lib.Utils;
51
52 import sun.hotspot.code.Compiler;
53
54 public class LowMemoryTest {
55 private static final MemoryMXBean mm = ManagementFactory.getMemoryMXBean();
56 private static final List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
57 private static final Phaser phaser = new Phaser(2);
58 private static MemoryPoolMXBean mpool = null;
59 private static boolean trace = false;
60 private static boolean testFailed = false;
61 private static final int NUM_TRIGGERS = 5;
62 private static final int NUM_CHUNKS = 2;
63 private static final int YOUNG_GEN_SIZE = 8 * 1024 * 1024;
64 private static long chunkSize;
65 private static final String classMain = "LowMemoryTest$TestMain";
66
67 /**
68 * Run the test multiple times with different GC versions.
69 * First with default command line specified by the framework.
70 * Then with GC versions specified by the test.
|