< prev index next >

test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventConcurrentCMS.java

Print this page
rev 51054 : imported patch 9000013-aixDisableJFR-requires.patch


  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.jfr.event.gc.heapsummary;
  27 
  28 import java.time.Duration;
  29 import java.util.List;
  30 
  31 import jdk.jfr.Recording;
  32 import jdk.jfr.consumer.RecordedEvent;
  33 import jdk.test.lib.Asserts;
  34 import jdk.test.lib.jfr.EventNames;
  35 import jdk.test.lib.jfr.Events;
  36 import jdk.test.lib.jfr.GCHelper;
  37 
  38 /*
  39  * @test
  40  * @key jfr

  41  * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null) & !vm.graal.enabled
  42  *           & vm.opt.ExplicitGCInvokesConcurrent != false
  43  * @library /test/lib /test/jdk
  44  * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -XX:+UseConcMarkSweepGC -XX:+ExplicitGCInvokesConcurrent jdk.jfr.event.gc.heapsummary.TestHeapSummaryEventConcurrentCMS
  45  */
  46 public class TestHeapSummaryEventConcurrentCMS {
  47 
  48     public static void main(String[] args) throws Exception {
  49         Recording recording = new Recording();
  50         recording.enable(EventNames.GarbageCollection).withThreshold(Duration.ofMillis(0));
  51         recording.enable(EventNames.GCHeapSummary).withThreshold(Duration.ofMillis(0));
  52 
  53         recording.start();
  54         // Need several GCs to ensure at least one heap summary event from concurrent CMS
  55         GCHelper.callSystemGc(6, true);
  56         recording.stop();
  57 
  58         // Remove first and last GCs which can be incomplete
  59         List<RecordedEvent> events = GCHelper.removeFirstAndLastGC(Events.fromRecording(recording));
  60         Asserts.assertFalse(events.isEmpty(), "No events found");




  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.jfr.event.gc.heapsummary;
  27 
  28 import java.time.Duration;
  29 import java.util.List;
  30 
  31 import jdk.jfr.Recording;
  32 import jdk.jfr.consumer.RecordedEvent;
  33 import jdk.test.lib.Asserts;
  34 import jdk.test.lib.jfr.EventNames;
  35 import jdk.test.lib.jfr.Events;
  36 import jdk.test.lib.jfr.GCHelper;
  37 
  38 /**
  39  * @test
  40  * @key jfr
  41  * @requires vm.hasJFR
  42  * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null) & !vm.graal.enabled
  43  *           & vm.opt.ExplicitGCInvokesConcurrent != false
  44  * @library /test/lib /test/jdk
  45  * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -XX:+UseConcMarkSweepGC -XX:+ExplicitGCInvokesConcurrent jdk.jfr.event.gc.heapsummary.TestHeapSummaryEventConcurrentCMS
  46  */
  47 public class TestHeapSummaryEventConcurrentCMS {
  48 
  49     public static void main(String[] args) throws Exception {
  50         Recording recording = new Recording();
  51         recording.enable(EventNames.GarbageCollection).withThreshold(Duration.ofMillis(0));
  52         recording.enable(EventNames.GCHeapSummary).withThreshold(Duration.ofMillis(0));
  53 
  54         recording.start();
  55         // Need several GCs to ensure at least one heap summary event from concurrent CMS
  56         GCHelper.callSystemGc(6, true);
  57         recording.stop();
  58 
  59         // Remove first and last GCs which can be incomplete
  60         List<RecordedEvent> events = GCHelper.removeFirstAndLastGC(Events.fromRecording(recording));
  61         Asserts.assertFalse(events.isEmpty(), "No events found");


< prev index next >