< prev index next >

test/hotspot/jtreg/gc/g1/TestPeriodicCollection.java

Print this page




  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 package gc.g1;
  25 
  26 /**
  27  * @test TestPeriodicCollection
  28  * @requires vm.gc.G1
  29  * @requires vm.compMode != "Xcomp"
  30  * @summary Verify that heap shrinks when the application is idle.
  31  * @library /test/lib /
  32  * @modules java.base/jdk.internal.misc
  33  * @modules java.management/sun.management
  34  * @run main/othervm -XX:MaxNewSize=32M -XX:InitialHeapSize=48M -Xmx128M -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=25 -XX:+UseG1GC -XX:G1PeriodicGCInterval=3000 -XX:+G1PeriodicGCInvokesConcurrent -Xlog:gc,gc+periodic=debug,gc+ergo+heap=debug gc.g1.TestPeriodicCollection
  35  * @run main/othervm -XX:MaxNewSize=32M -XX:InitialHeapSize=48M -Xmx128M -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=25 -XX:+UseG1GC -XX:G1PeriodicGCInterval=3000 -XX:-G1PeriodicGCInvokesConcurrent -Xlog:gc,gc+periodic=debug,gc+ergo+heap=debug gc.g1.TestPeriodicCollection
  36  */
  37 
  38 import com.sun.management.HotSpotDiagnosticMXBean;
  39 
  40 import gc.testlibrary.Helpers;
  41 
  42 import java.lang.management.GarbageCollectorMXBean;
  43 import java.lang.management.ManagementFactory;
  44 import java.lang.management.MemoryUsage;
  45 import java.text.NumberFormat;
  46 import static jdk.test.lib.Asserts.*;
  47 
  48 public class TestPeriodicCollection {
  49 
  50     public static final String MIN_FREE_RATIO_FLAG_NAME = "MinHeapFreeRatio";
  51     public static final String MAX_FREE_RATIO_FLAG_NAME = "MaxHeapFreeRatio";
  52 
  53     private static final int IDLE_TIME = 7 * 1000;
  54 
  55     private static boolean gcOccurred() {




  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 package gc.g1;
  25 
  26 /**
  27  * @test TestPeriodicCollection
  28  * @requires vm.gc.G1
  29  * @requires vm.compMode != "Xcomp"
  30  * @summary Verify that heap shrinks when the application is idle.
  31  * @library /test/lib /
  32  * @modules java.base/jdk.internal.misc
  33  * @modules java.management/sun.management
  34  * @run main/othervm -XX:MaxNewSize=32M -XX:InitialHeapSize=48M -Xmx128M -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=25 -XX:+UseG1GC -XX:G1PeriodicGCInterval=3000 -XX:+G1PeriodicGCInvokesConcurrent -Xlog:gc*,gc+periodic=debug,gc+ergo+heap=debug gc.g1.TestPeriodicCollection
  35  * @run main/othervm -XX:MaxNewSize=32M -XX:InitialHeapSize=48M -Xmx128M -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=25 -XX:+UseG1GC -XX:G1PeriodicGCInterval=3000 -XX:-G1PeriodicGCInvokesConcurrent -Xlog:gc*,gc+periodic=debug,gc+ergo+heap=debug gc.g1.TestPeriodicCollection
  36  */
  37 
  38 import com.sun.management.HotSpotDiagnosticMXBean;
  39 
  40 import gc.testlibrary.Helpers;
  41 
  42 import java.lang.management.GarbageCollectorMXBean;
  43 import java.lang.management.ManagementFactory;
  44 import java.lang.management.MemoryUsage;
  45 import java.text.NumberFormat;
  46 import static jdk.test.lib.Asserts.*;
  47 
  48 public class TestPeriodicCollection {
  49 
  50     public static final String MIN_FREE_RATIO_FLAG_NAME = "MinHeapFreeRatio";
  51     public static final String MAX_FREE_RATIO_FLAG_NAME = "MaxHeapFreeRatio";
  52 
  53     private static final int IDLE_TIME = 7 * 1000;
  54 
  55     private static boolean gcOccurred() {


< prev index next >