8344143: Test jdk/java/lang/Thread/virtual/stress/GetStackTraceALotWhenPinned.java timed out on macosx-x64
Reviewed-by: pchilanomate
This commit is contained in:
parent
d4cd27e875
commit
48223f7b9c
@ -28,7 +28,7 @@
|
||||
* @requires vm.debug != true
|
||||
* @modules jdk.management
|
||||
* @library /test/lib
|
||||
* @run main/othervm GetStackTraceALotWhenBlocking 500000
|
||||
* @run main/othervm/timeout=300 GetStackTraceALotWhenBlocking 100000
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -68,16 +68,24 @@ public class GetStackTraceALotWhenBlocking {
|
||||
|
||||
var thread1 = Thread.ofVirtual().start(task);
|
||||
var thread2 = Thread.ofVirtual().start(task);
|
||||
long lastTime = System.nanoTime();
|
||||
try {
|
||||
for (int i = 1; i <= iterations; i++) {
|
||||
if ((i % 10_000) == 0) {
|
||||
System.out.format("%s => %d of %d%n", Instant.now(), i, iterations);
|
||||
}
|
||||
|
||||
thread1.getStackTrace();
|
||||
pause();
|
||||
thread2.getStackTrace();
|
||||
pause();
|
||||
|
||||
long currentTime = System.nanoTime();
|
||||
if (i == iterations || ((currentTime - lastTime) > 1_000_000_000L)) {
|
||||
System.out.format("%s => %d of %d%n", Instant.now(), i, iterations);
|
||||
lastTime = currentTime;
|
||||
}
|
||||
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
// fail quickly if interrupted by jtreg
|
||||
throw new RuntimeException("interrupted");
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
done.set(true);
|
||||
|
@ -28,7 +28,7 @@
|
||||
* @requires vm.debug != true
|
||||
* @modules jdk.management
|
||||
* @library /test/lib
|
||||
* @run main/othervm --enable-native-access=ALL-UNNAMED GetStackTraceALotWhenPinned 500000
|
||||
* @run main/othervm/timeout=300 --enable-native-access=ALL-UNNAMED GetStackTraceALotWhenPinned 100000
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -36,7 +36,7 @@
|
||||
* @requires vm.debug == true
|
||||
* @modules jdk.management
|
||||
* @library /test/lib
|
||||
* @run main/othervm/timeout=300 --enable-native-access=ALL-UNNAMED GetStackTraceALotWhenPinned 200000
|
||||
* @run main/othervm/timeout=300 --enable-native-access=ALL-UNNAMED GetStackTraceALotWhenPinned 50000
|
||||
*/
|
||||
|
||||
import java.time.Instant;
|
||||
@ -78,7 +78,7 @@ public class GetStackTraceALotWhenPinned {
|
||||
}
|
||||
});
|
||||
|
||||
long lastTimestamp = System.currentTimeMillis();
|
||||
long lastTime = System.nanoTime();
|
||||
for (int i = 1; i <= iterations; i++) {
|
||||
// wait for virtual thread to arrive
|
||||
barrier.await();
|
||||
@ -86,10 +86,15 @@ public class GetStackTraceALotWhenPinned {
|
||||
thread.getStackTrace();
|
||||
LockSupport.unpark(thread);
|
||||
|
||||
long currentTime = System.currentTimeMillis();
|
||||
if (i == iterations || ((currentTime - lastTimestamp) > 500)) {
|
||||
long currentTime = System.nanoTime();
|
||||
if (i == iterations || ((currentTime - lastTime) > 1_000_000_000L)) {
|
||||
System.out.format("%s => %d of %d%n", Instant.now(), i, iterations);
|
||||
lastTimestamp = currentTime;
|
||||
lastTime = currentTime;
|
||||
}
|
||||
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
// fail quickly if interrupted by jtreg
|
||||
throw new RuntimeException("interrupted");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user