author | lana |
Thu, 12 May 2016 15:15:02 +0000 | |
changeset 37915 | be4ff50b6cb6 |
parent 37298 | 8df0cc9da41e |
child 40631 | ed82623d7831 |
permissions | -rw-r--r-- |
37166
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
1 |
/* |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
4 |
* |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
8 |
* |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
13 |
* accompanied this code). |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
14 |
* |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
18 |
* |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
21 |
* questions. |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
22 |
*/ |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
23 |
|
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
24 |
/* |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
25 |
* @test TestShrinkHeapInSteps |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
26 |
* @key gc |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
27 |
* @summary Verify that -XX:-ShrinkHeapInSteps works properly. |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
28 |
* @library /testlibrary |
37298
8df0cc9da41e
8154028: Several hotspot tests need to be updated after 8153737 (Unsupported Module)
amurillo
parents:
37166
diff
changeset
|
29 |
* @modules java.base/jdk.internal.misc |
37166
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
30 |
* java.management |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
31 |
* @build TestMaxMinHeapFreeRatioFlags TestShrinkHeapInSteps |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
32 |
* @run driver/timeout=240 TestShrinkHeapInSteps |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
33 |
*/ |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
34 |
|
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
35 |
import java.util.LinkedList; |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
36 |
import java.util.Arrays; |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
37 |
import java.util.Collections; |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
38 |
import jdk.test.lib.Utils; |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
39 |
|
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
40 |
public class TestShrinkHeapInSteps { |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
41 |
public static void main(String args[]) throws Exception { |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
42 |
LinkedList<String> options = new LinkedList<>( |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
43 |
Arrays.asList(Utils.getFilteredTestJavaOpts("-XX:[^ ]*HeapFreeRatio","-XX:\\+ExplicitGCInvokesConcurrent")) |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
44 |
); |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
45 |
|
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
46 |
// Leverage the existing TestMaxMinHeapFreeRatioFlags test, but pass |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
47 |
// "false" for the shrinkHeapInSteps argument. This will cause it to |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
48 |
// run with -XX:-ShrinkHeapInSteps, and only do 1 full GC instead of 10. |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
49 |
TestMaxMinHeapFreeRatioFlags.positiveTest(10, false, 90, false, false, options); |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
50 |
TestMaxMinHeapFreeRatioFlags.positiveTest(10, true, 80, false, false, options); |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
51 |
TestMaxMinHeapFreeRatioFlags.positiveTest(20, false, 70, true, false, options); |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
52 |
TestMaxMinHeapFreeRatioFlags.positiveTest(25, true, 65, true, false, options); |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
53 |
TestMaxMinHeapFreeRatioFlags.positiveTest(40, false, 50, false, false, options); |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
54 |
} |
8a5f1594e692
8146436: Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)
cjplummer
parents:
diff
changeset
|
55 |
} |