< prev index next >

test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java

Print this page




   8 *
   9 * This code is distributed in the hope that it will be useful, but WITHOUT
  10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12 * version 2 for more details (a copy is included in the LICENSE file that
  13 * accompanied this code).
  14 *
  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 TestMaxMinHeapFreeRatioFlags
  26  * @key gc
  27  * @summary Verify that heap size changes according to max and min heap free ratios.
  28  * @library /testlibrary
  29  * @modules java.base/jdk.internal.misc
  30  *          java.management
  31  * @build TestMaxMinHeapFreeRatioFlags
  32  * @run driver/timeout=240 TestMaxMinHeapFreeRatioFlags
  33  */
  34 
  35 import java.util.LinkedList;
  36 import java.util.Arrays;
  37 import java.util.Collections;
  38 import jdk.test.lib.OutputAnalyzer;
  39 import jdk.test.lib.ProcessTools;
  40 import jdk.test.lib.Utils;
  41 import jdk.test.lib.HeapRegionUsageTool;
  42 import jdk.internal.misc.Unsafe;
  43 
  44 public class TestMaxMinHeapFreeRatioFlags {
  45 
  46     public static final long M = 1024 * 1024;
  47     public static final long MAX_HEAP_SIZE = 200 * M;
  48     public static final long HEAP_SIZE = 10 * M;
  49     public static final long MAX_NEW_SIZE = 20 * M;
  50     public static final long NEW_SIZE = 5 * M;
  51 
  52     public static void main(String args[]) throws Exception {
  53         LinkedList<String> options = new LinkedList<>(
  54                 Arrays.asList(Utils.getFilteredTestJavaOpts("-XX:[^ ]*HeapFreeRatio","-XX:\\+ExplicitGCInvokesConcurrent"))
  55         );
  56 
  57         negativeTest(20, false, 10, true, options);
  58         negativeTest(100, true, 0, false, options);
  59         negativeTest(101, false, 50, false, options);
  60         negativeTest(49, true, 102, true, options);
  61         negativeTest(-1, false, 50, false, options);




   8 *
   9 * This code is distributed in the hope that it will be useful, but WITHOUT
  10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12 * version 2 for more details (a copy is included in the LICENSE file that
  13 * accompanied this code).
  14 *
  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 TestMaxMinHeapFreeRatioFlags
  26  * @key gc
  27  * @summary Verify that heap size changes according to max and min heap free ratios.
  28  * @library /test/lib
  29  * @modules java.base/jdk.internal.misc
  30  *          java.management

  31  * @run driver/timeout=240 TestMaxMinHeapFreeRatioFlags
  32  */
  33 
  34 import java.util.LinkedList;
  35 import java.util.Arrays;
  36 import java.util.Collections;
  37 import jdk.test.lib.process.OutputAnalyzer;
  38 import jdk.test.lib.process.ProcessTools;
  39 import jdk.test.lib.Utils;

  40 import jdk.internal.misc.Unsafe;
  41 
  42 public class TestMaxMinHeapFreeRatioFlags {
  43 
  44     public static final long M = 1024 * 1024;
  45     public static final long MAX_HEAP_SIZE = 200 * M;
  46     public static final long HEAP_SIZE = 10 * M;
  47     public static final long MAX_NEW_SIZE = 20 * M;
  48     public static final long NEW_SIZE = 5 * M;
  49 
  50     public static void main(String args[]) throws Exception {
  51         LinkedList<String> options = new LinkedList<>(
  52                 Arrays.asList(Utils.getFilteredTestJavaOpts("-XX:[^ ]*HeapFreeRatio","-XX:\\+ExplicitGCInvokesConcurrent"))
  53         );
  54 
  55         negativeTest(20, false, 10, true, options);
  56         negativeTest(100, true, 0, false, options);
  57         negativeTest(101, false, 50, false, options);
  58         negativeTest(49, true, 102, true, options);
  59         negativeTest(-1, false, 50, false, options);


< prev index next >