< prev index next >

test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java

Print this page
rev 11832 : 8078896: Add @modules as needed to the jdk_svc tests
Reviewed-by: alanb, mchung
   1 /*
   2  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   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  * The -XX:MarkSweepAlwaysCompactCount=1 argument below makes sure serial gc
  26  * compacts the heap at every full gc so that the usage is correctly updated.
  27  */
  28 
  29 /*
  30  * @test
  31  * @bug     4892507
  32  * @summary Basic Test for MemoryPool.resetPeakUsage()
  33  * @author  Mandy Chung
  34  *
  35  * @library /lib/testlibrary/

  36  * @build jdk.testlibrary.* ResetPeakMemoryUsage MemoryUtil RunUtil
  37  * @run main ResetPeakMemoryUsage
  38  */
  39 
  40 import java.lang.management.*;
  41 import java.util.*;
  42 
  43 public class ResetPeakMemoryUsage {
  44     private static MemoryMXBean mbean = ManagementFactory.getMemoryMXBean();
  45     // make public so that it can't be optimized away easily
  46     public static Object[] obj;
  47 
  48     /**
  49      * Run the test multiple times with different GC versions.
  50      * First with default command line specified by the framework.
  51      * Then with all GC versions specified by the test.
  52      */
  53     public static void main(String a[]) throws Throwable {
  54         final String main = "ResetPeakMemoryUsage$TestMain";
  55         final String ms = "-Xms256m";


   1 /*
   2  * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   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  * The -XX:MarkSweepAlwaysCompactCount=1 argument below makes sure serial gc
  26  * compacts the heap at every full gc so that the usage is correctly updated.
  27  */
  28 
  29 /*
  30  * @test
  31  * @bug     4892507
  32  * @summary Basic Test for MemoryPool.resetPeakUsage()
  33  * @author  Mandy Chung
  34  *
  35  * @library /lib/testlibrary/
  36  * @modules java.management
  37  * @build jdk.testlibrary.* ResetPeakMemoryUsage MemoryUtil RunUtil
  38  * @run main ResetPeakMemoryUsage
  39  */
  40 
  41 import java.lang.management.*;
  42 import java.util.*;
  43 
  44 public class ResetPeakMemoryUsage {
  45     private static MemoryMXBean mbean = ManagementFactory.getMemoryMXBean();
  46     // make public so that it can't be optimized away easily
  47     public static Object[] obj;
  48 
  49     /**
  50      * Run the test multiple times with different GC versions.
  51      * First with default command line specified by the framework.
  52      * Then with all GC versions specified by the test.
  53      */
  54     public static void main(String a[]) throws Throwable {
  55         final String main = "ResetPeakMemoryUsage$TestMain";
  56         final String ms = "-Xms256m";


< prev index next >