< prev index next >

test/serviceability/tmtools/jstat/GcTest01.java

Print this page
rev 12309 : Rev 01


  33  *          collection time increase.
  34  * @modules java.base/jdk.internal.misc
  35  * @library /test/lib
  36  * @library ../share
  37  * @requires vm.opt.ExplicitGCInvokesConcurrent != true
  38  * @run main/othervm -XX:+UsePerfData -Xmx128M GcTest01
  39  */
  40 import utils.*;
  41 
  42 public class GcTest01 {
  43 
  44     public static void main(String[] args) throws Exception {
  45 
  46         // We will be running "jstat -gc" tool
  47         JstatGcTool jstatGcTool = new JstatGcTool(ProcessHandle.current().getPid());
  48 
  49         // Run once and get the  results asserting that they are reasonable
  50         JstatGcResults measurement1 = jstatGcTool.measure();
  51         measurement1.assertConsistency();
  52 
  53         GcProvoker gcProvoker = GcProvoker.createGcProvoker();
  54 
  55         // Provoke GC then run the tool again and get the results
  56         // asserting that they are reasonable
  57         gcProvoker.provokeGc();
  58         JstatGcResults measurement2 = jstatGcTool.measure();
  59         measurement2.assertConsistency();
  60 
  61         // Assert the increase in GC events and time between the measurements
  62         JstatResults.assertGCEventsIncreased(measurement1, measurement2);
  63         JstatResults.assertGCTimeIncreased(measurement1, measurement2);
  64 
  65         // Provoke GC again and get the results
  66         // asserting that they are reasonable
  67         gcProvoker.provokeGc();
  68         JstatGcResults measurement3 = jstatGcTool.measure();
  69         measurement3.assertConsistency();
  70 
  71         // Assert the increase in GC events and time between the measurements
  72         JstatResults.assertGCEventsIncreased(measurement2, measurement3);
  73         JstatResults.assertGCTimeIncreased(measurement2, measurement3);


  33  *          collection time increase.
  34  * @modules java.base/jdk.internal.misc
  35  * @library /test/lib
  36  * @library ../share
  37  * @requires vm.opt.ExplicitGCInvokesConcurrent != true
  38  * @run main/othervm -XX:+UsePerfData -Xmx128M GcTest01
  39  */
  40 import utils.*;
  41 
  42 public class GcTest01 {
  43 
  44     public static void main(String[] args) throws Exception {
  45 
  46         // We will be running "jstat -gc" tool
  47         JstatGcTool jstatGcTool = new JstatGcTool(ProcessHandle.current().getPid());
  48 
  49         // Run once and get the  results asserting that they are reasonable
  50         JstatGcResults measurement1 = jstatGcTool.measure();
  51         measurement1.assertConsistency();
  52 
  53         GcProvoker gcProvoker = new GcProvoker();
  54 
  55         // Provoke GC then run the tool again and get the results
  56         // asserting that they are reasonable
  57         gcProvoker.provokeGc();
  58         JstatGcResults measurement2 = jstatGcTool.measure();
  59         measurement2.assertConsistency();
  60 
  61         // Assert the increase in GC events and time between the measurements
  62         JstatResults.assertGCEventsIncreased(measurement1, measurement2);
  63         JstatResults.assertGCTimeIncreased(measurement1, measurement2);
  64 
  65         // Provoke GC again and get the results
  66         // asserting that they are reasonable
  67         gcProvoker.provokeGc();
  68         JstatGcResults measurement3 = jstatGcTool.measure();
  69         measurement3.assertConsistency();
  70 
  71         // Assert the increase in GC events and time between the measurements
  72         JstatResults.assertGCEventsIncreased(measurement2, measurement3);
  73         JstatResults.assertGCTimeIncreased(measurement2, measurement3);
< prev index next >