< prev index next >

test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameCount/framecnt01/framecnt01.java

Print this page

 62         // Test GetFrameCount on virtual live thread
 63         Thread vThread = Thread.ofVirtual().name("VirtualThread-Live").start(() -> {
 64            checkFrames(Thread.currentThread(), false, 10);
 65         });
 66         vThread.join();
 67 
 68         // Test GetFrameCount on virtual frozen thread
 69         Thread vThread1 = Thread.ofVirtual().name("VirtualThread-Frozen").start(() -> {
 70             vThread1Started = true;
 71             LockSupport.park();
 72         });
 73         while (!vThread1Started) {
 74             Thread.sleep(1);
 75         }
 76         // Let vthread1 to park
 77         while(vThread1.getState() != Thread.State.WAITING) {
 78             Thread.sleep(1);
 79         }
 80 
 81         // this is too fragile, implementation can change at any time.
 82         checkFrames(vThread1, false, 14);
 83         LockSupport.unpark(vThread1);
 84         vThread1.join();
 85 
 86         // Test GetFrameCount on live platform thread
 87         Thread pThread = Thread.ofPlatform().name("PlatformThread-Live").start(() -> {
 88             checkFrames(Thread.currentThread(), false, 6);
 89         });
 90         pThread.join();
 91 
 92         // Test GetFrameCount on parked platform thread
 93         Thread pThread1 = Thread.ofPlatform().name("PlatformThread-Parked").start(() -> {
 94                 pThread1Started = true;
 95                 LockSupport.park();
 96         });
 97         while (!pThread1Started) {
 98             Thread.sleep(1);
 99         }
100 
101         while(pThread1.getState() != Thread.State.WAITING) {
102             Thread.sleep(1);

 62         // Test GetFrameCount on virtual live thread
 63         Thread vThread = Thread.ofVirtual().name("VirtualThread-Live").start(() -> {
 64            checkFrames(Thread.currentThread(), false, 10);
 65         });
 66         vThread.join();
 67 
 68         // Test GetFrameCount on virtual frozen thread
 69         Thread vThread1 = Thread.ofVirtual().name("VirtualThread-Frozen").start(() -> {
 70             vThread1Started = true;
 71             LockSupport.park();
 72         });
 73         while (!vThread1Started) {
 74             Thread.sleep(1);
 75         }
 76         // Let vthread1 to park
 77         while(vThread1.getState() != Thread.State.WAITING) {
 78             Thread.sleep(1);
 79         }
 80 
 81         // this is too fragile, implementation can change at any time.
 82         checkFrames(vThread1, false, 13);
 83         LockSupport.unpark(vThread1);
 84         vThread1.join();
 85 
 86         // Test GetFrameCount on live platform thread
 87         Thread pThread = Thread.ofPlatform().name("PlatformThread-Live").start(() -> {
 88             checkFrames(Thread.currentThread(), false, 6);
 89         });
 90         pThread.join();
 91 
 92         // Test GetFrameCount on parked platform thread
 93         Thread pThread1 = Thread.ofPlatform().name("PlatformThread-Parked").start(() -> {
 94                 pThread1Started = true;
 95                 LockSupport.park();
 96         });
 97         while (!pThread1Started) {
 98             Thread.sleep(1);
 99         }
100 
101         while(pThread1.getState() != Thread.State.WAITING) {
102             Thread.sleep(1);
< prev index next >