8305506: Add support for fractional values of SafepointTimeoutDelay

Reviewed-by: mdoerr, dholmes
This commit is contained in:
Wojciech Kudla 2023-07-20 05:10:39 +00:00 committed by David Holmes
parent dfe764e3f8
commit 37c756a7be
3 changed files with 18 additions and 11 deletions

View File

@ -1292,9 +1292,10 @@ const int ObjectAlignmentInBytes = 8;
"(0 means none)") \
range(0, max_jint) \
\
product(intx, SafepointTimeoutDelay, 10000, \
"Delay in milliseconds for option SafepointTimeout") \
range(0, max_intx LP64_ONLY(/MICROUNITS)) \
product(double, SafepointTimeoutDelay, 10000, \
"Delay in milliseconds for option SafepointTimeout; " \
"supports sub-millisecond resolution with fractional values.") \
range(0, max_jlongDouble LP64_ONLY(/MICROUNITS)) \
\
product(bool, UseSystemMemoryBarrier, false, \
"Try to enable system memory barrier if supported by OS") \

View File

@ -379,7 +379,7 @@ void SafepointSynchronize::begin() {
if (SafepointTimeout) {
// Set the limit time, so that it can be compared to see if this has taken
// too long to complete.
safepoint_limit_time = SafepointTracing::start_of_safepoint() + (jlong)SafepointTimeoutDelay * (NANOUNITS / MILLIUNITS);
safepoint_limit_time = SafepointTracing::start_of_safepoint() + (jlong)(SafepointTimeoutDelay * NANOSECS_PER_MILLISEC);
timeout_error_printed = false;
}
@ -819,7 +819,7 @@ void SafepointSynchronize::print_safepoint_timeout() {
os::naked_sleep(3000);
}
}
fatal("Safepoint sync time longer than " INTX_FORMAT "ms detected when executing %s.",
fatal("Safepoint sync time longer than %.6f ms detected when executing %s.",
SafepointTimeoutDelay, VMThread::vm_operation()->name());
}
}

View File

@ -35,18 +35,24 @@ import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
public class DoubleFlagWithIntegerValue {
public static void testDoubleFlagWithValue(String value) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:SweeperThreshold=" + value, "-version");
public static void testDoubleFlagWithValue(String flag, String value) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flag + "=" + value, "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldNotContain("Improperly specified VM option");
output.shouldHaveExitValue(0);
}
public static void main(String[] args) throws Exception {
// Test double format
testDoubleFlagWithValue("10.0");
// Test double format for -XX:SweeperThreshold
testDoubleFlagWithValue("-XX:SweeperThreshold", "10.0");
// Test integer format
testDoubleFlagWithValue("10");
// Test integer format -XX:SweeperThreshold
testDoubleFlagWithValue("-XX:SweeperThreshold", "10");
// Test double format for -XX:SafepointTimeoutDelay
testDoubleFlagWithValue("-XX:SafepointTimeoutDelay", "5.0");
// Test integer format -XX:SafepointTimeoutDelay
testDoubleFlagWithValue("-XX:SafepointTimeoutDelay", "5");
}
}