< prev index next >

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

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


  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 import java.util.concurrent.locks.LockSupport;
  35 
  36 import jdk.jfr.Recording;
  37 import jdk.jfr.consumer.RecordedEvent;
  38 import jdk.test.lib.jfr.EventNames;
  39 import jdk.test.lib.jfr.Events;
  40 import jdk.test.lib.management.ThreadMXBeanTool;
  41 import jdk.test.lib.thread.TestThread;
  42 
  43 
  44 /*
  45  * @test
  46  * @key jfr

  47  * @library /test/lib
  48  *
  49  * @run main/othervm jdk.jfr.event.runtime.TestThreadParkEvent
  50  */
  51 
  52 public class TestThreadParkEvent {
  53     private static final String EVENT_NAME = EventNames.ThreadPark;
  54     private static final long THRESHOLD_MILLIS = 1;
  55 
  56     static class Blocker {
  57     }
  58 
  59     public static void main(String[] args) throws Throwable {
  60         final CountDownLatch stop = new CountDownLatch(1);
  61         final Blocker blocker = new Blocker();
  62         TestThread parkThread = new TestThread(new Runnable() {
  63             public void run() {
  64                 while (stop.getCount() > 0) {
  65                     LockSupport.park(blocker);
  66                 }




  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 import java.util.concurrent.locks.LockSupport;
  35 
  36 import jdk.jfr.Recording;
  37 import jdk.jfr.consumer.RecordedEvent;
  38 import jdk.test.lib.jfr.EventNames;
  39 import jdk.test.lib.jfr.Events;
  40 import jdk.test.lib.management.ThreadMXBeanTool;
  41 import jdk.test.lib.thread.TestThread;
  42 
  43 
  44 /**
  45  * @test
  46  * @key jfr
  47  * @requires vm.hasJFR
  48  * @library /test/lib
  49  *
  50  * @run main/othervm jdk.jfr.event.runtime.TestThreadParkEvent
  51  */
  52 
  53 public class TestThreadParkEvent {
  54     private static final String EVENT_NAME = EventNames.ThreadPark;
  55     private static final long THRESHOLD_MILLIS = 1;
  56 
  57     static class Blocker {
  58     }
  59 
  60     public static void main(String[] args) throws Throwable {
  61         final CountDownLatch stop = new CountDownLatch(1);
  62         final Blocker blocker = new Blocker();
  63         TestThread parkThread = new TestThread(new Runnable() {
  64             public void run() {
  65                 while (stop.getCount() > 0) {
  66                     LockSupport.park(blocker);
  67                 }


< prev index next >