Skip to content

Commit 1f6e106

Browse files
committed
8335684: Test ThreadCpuTime.java should pause like ThreadCpuTimeArray.java
Reviewed-by: sspitsyn, cjplummer
1 parent 84c74ad commit 1f6e106

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

test/jdk/java/lang/management/ThreadMXBean/ThreadCpuTime.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -177,6 +177,8 @@ private static void waitUntilThreadBlocked()
177177
}
178178
}
179179
}
180+
// Account for threads using CPU for a few millis after their WAITING state is visible:
181+
goSleep(500);
180182
}
181183

182184
static class MyThread extends Thread {
@@ -228,15 +230,6 @@ public void run() {
228230
" CurrentThreadCpuTime = " + time1 +
229231
" > ThreadCpuTime = " + time2);
230232
}
231-
/*************
232-
* FIXME: Seems that on Solaris-sparc,
233-
* It occasionally returns a different current thread user time > thread user time
234-
if (utime1 > utime2) {
235-
throw new RuntimeException("TEST FAILED: " + getName() +
236-
" CurrentThreadUserTime = " + utime1 +
237-
" > ThreadUserTime = " + utime2);
238-
}
239-
*/
240233
}
241234
}
242235

0 commit comments

Comments
 (0)