< prev index next >
test/serviceability/tmtools/jstat/GcTest02.java
Print this page
*** 26,39 ****
* @test
* @summary Test checks output displayed with jstat -gc.
* Test scenario:
* tests forces debuggee application eat ~70% of heap and runs jstat.
* jstat should show that ~70% of heap is utilized (OC/OU ~= 70%).
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @library ../share
! * @run main/othervm -XX:+UsePerfData -Xmx128M -XX:MaxMetaspaceSize=128M GcTest02
*/
public class GcTest02 {
private final static float targetMemoryUsagePercent = 0.7f;
--- 26,40 ----
* @test
* @summary Test checks output displayed with jstat -gc.
* Test scenario:
* tests forces debuggee application eat ~70% of heap and runs jstat.
* jstat should show that ~70% of heap is utilized (OC/OU ~= 70%).
+ * @requires vm.opt.ExplicitGCInvokesConcurrent != true
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @library ../share
! * @run main/othervm -XX:+UsePerfData -XX:InitialHeapSize=128M -XX:MaxHeapSize=128M -XX:MaxMetaspaceSize=128M GcTest02
*/
public class GcTest02 {
private final static float targetMemoryUsagePercent = 0.7f;
*** 45,58 ****
// Run once and get the results asserting that they are reasonable
JstatGcResults measurement1 = jstatGcTool.measure();
measurement1.assertConsistency();
! GcProvoker gcProvoker = GcProvoker.createGcProvoker();
// Eat metaspace and heap then run the tool again and get the results asserting that they are reasonable
! gcProvoker.eatMetaspaceAndHeap(targetMemoryUsagePercent);
JstatGcResults measurement2 = jstatGcTool.measure();
measurement2.assertConsistency();
// Assert that space has been utilized acordingly
JstatResults.assertSpaceUtilization(measurement2, targetMemoryUsagePercent);
--- 46,61 ----
// Run once and get the results asserting that they are reasonable
JstatGcResults measurement1 = jstatGcTool.measure();
measurement1.assertConsistency();
! GcProvoker gcProvoker = new GcProvoker();
// Eat metaspace and heap then run the tool again and get the results asserting that they are reasonable
! gcProvoker.allocateAvailableMetaspaceAndHeap(targetMemoryUsagePercent);
! // Collect garbage. Also updates VM statistics
! System.gc();
JstatGcResults measurement2 = jstatGcTool.measure();
measurement2.assertConsistency();
// Assert that space has been utilized acordingly
JstatResults.assertSpaceUtilization(measurement2, targetMemoryUsagePercent);
< prev index next >