< prev index next >

test/jdk/jdk/jfr/event/runtime/TestJavaBlockedEvent.java

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


  23  * questions.
  24  */
  25 
  26 package jdk.jfr.event.runtime;
  27 
  28 import static jdk.test.lib.Asserts.assertFalse;
  29 import static jdk.test.lib.Asserts.assertTrue;
  30 
  31 import java.time.Duration;
  32 import java.util.List;
  33 import java.util.concurrent.CountDownLatch;
  34 
  35 import jdk.jfr.Recording;
  36 import jdk.jfr.consumer.RecordedEvent;
  37 import jdk.test.lib.jfr.EventNames;
  38 import jdk.test.lib.jfr.Events;
  39 import jdk.test.lib.management.ThreadMXBeanTool;
  40 import jdk.test.lib.thread.TestThread;
  41 import jdk.test.lib.thread.XRun;
  42 
  43 /*
  44  * @test
  45  * @key jfr

  46  * @library /test/lib
  47  *
  48  * @run main/othervm jdk.jfr.event.runtime.TestJavaBlockedEvent
  49  */
  50 public class TestJavaBlockedEvent {
  51     private static final String EVENT_NAME = EventNames.JavaMonitorEnter;
  52     private static final long THRESHOLD_MILLIS = 1;
  53 
  54     static class Lock {
  55     }
  56 
  57     public static void main(String[] args) throws Throwable {
  58         Recording recording = new Recording();
  59 
  60         recording.enable(EVENT_NAME).withThreshold(Duration.ofMillis(THRESHOLD_MILLIS));
  61         recording.start();
  62         final Lock lock = new Lock();
  63         final CountDownLatch blockerInLock = new CountDownLatch(1);
  64         final CountDownLatch blockingFinished = new CountDownLatch(1);
  65         final CountDownLatch blockedFinished = new CountDownLatch(1);




  23  * questions.
  24  */
  25 
  26 package jdk.jfr.event.runtime;
  27 
  28 import static jdk.test.lib.Asserts.assertFalse;
  29 import static jdk.test.lib.Asserts.assertTrue;
  30 
  31 import java.time.Duration;
  32 import java.util.List;
  33 import java.util.concurrent.CountDownLatch;
  34 
  35 import jdk.jfr.Recording;
  36 import jdk.jfr.consumer.RecordedEvent;
  37 import jdk.test.lib.jfr.EventNames;
  38 import jdk.test.lib.jfr.Events;
  39 import jdk.test.lib.management.ThreadMXBeanTool;
  40 import jdk.test.lib.thread.TestThread;
  41 import jdk.test.lib.thread.XRun;
  42 
  43 /**
  44  * @test
  45  * @key jfr
  46  * @requires vm.hasJFR
  47  * @library /test/lib
  48  *
  49  * @run main/othervm jdk.jfr.event.runtime.TestJavaBlockedEvent
  50  */
  51 public class TestJavaBlockedEvent {
  52     private static final String EVENT_NAME = EventNames.JavaMonitorEnter;
  53     private static final long THRESHOLD_MILLIS = 1;
  54 
  55     static class Lock {
  56     }
  57 
  58     public static void main(String[] args) throws Throwable {
  59         Recording recording = new Recording();
  60 
  61         recording.enable(EVENT_NAME).withThreshold(Duration.ofMillis(THRESHOLD_MILLIS));
  62         recording.start();
  63         final Lock lock = new Lock();
  64         final CountDownLatch blockerInLock = new CountDownLatch(1);
  65         final CountDownLatch blockingFinished = new CountDownLatch(1);
  66         final CountDownLatch blockedFinished = new CountDownLatch(1);


< prev index next >