Skip to content

Commit 8b42387

Browse files
author
David Holmes
committed
8227563: jvmti/scenarios/contention/TC05/tc05t001 fails due to "ERROR: tc05t001.cpp, 278: (waitedThreadCpuTime - waitThreadCpuTime) < (EXPECTED_ACCURACY * 1000000)"
Reviewed-by: amenkov, cjplummer, sspitsyn
1 parent d2db14b commit 8b42387

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/TestDescription.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2019, 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
@@ -43,7 +43,7 @@
4343
* /test/lib
4444
* @run driver jdk.test.lib.FileInstaller . .
4545
* @run main/othervm/native
46-
* -agentlib:tc05t001=-waittime=5
46+
* -agentlib:tc05t001=verbose,waittime=5
4747
* nsk.jvmti.scenarios.contention.TC05.tc05t001
4848
*/
4949

test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2004, 2019, 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
@@ -39,7 +39,11 @@ static const jlong EXPECTED_TIMEOUT = 1;
3939
*/
4040
static const jlong EXPECTED_TIMEOUT_ACCURACY_NS = 300000;
4141

42-
static const jlong EXPECTED_ACCURACY = 10;
42+
#if (defined(WIN32) || defined(_WIN32))
43+
static const jlong EXPECTED_ACCURACY = 16; // 16ms is longest clock update interval
44+
#else
45+
static const jlong EXPECTED_ACCURACY = 10; // high frequency clock updates expected
46+
#endif
4347

4448
/* scaffold objects */
4549
static jlong timeout = 0;
@@ -264,7 +268,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
264268
jlong_to_string(waitedTime - waitTime, buffer));
265269
if (!(NSK_VERIFY((waitedTime - waitTime) >= (EXPECTED_TIMEOUT * 1000000) - EXPECTED_TIMEOUT_ACCURACY_NS))) {
266270
#if (defined(WIN32) || defined(_WIN32))
267-
/* Do not fail on Windows as spurious wakeups are expected. The JDK-6313903 was closed as "Won't Fix". */
271+
/* Do not fail on Windows as early returns are expected and wait() treats them as spurious wakeups. */
268272
#else
269273
nsk_jvmti_setFailStatus();
270274
#endif

0 commit comments

Comments
 (0)