RFR: 6864866: add a flag to use result of gethrtime() directly in os::getTimeNanos()
Staffan Larsen
staffan.larsen at oracle.com
Tue Apr 22 08:19:25 UTC 2014
This is a follow-up to the review thread for JDK-8040140: "System.nanoTime() is slow and non-monotonic on OS X”. It was proposed in that thread to split out the addition of an experimental flag to remove the safety checks to a different review.
On Solaris and OS X we take extra precautions to make sure that System.nanoTime() does not move backwards since we are not confident that the OS level calls provide this guarantee in all circumstances. The extra code we run does take time and can interfere with timing measurements. Thus the addition of an experimental flag to circumvent the extra code. This flag is intended for people who know what they are doing and have some degree of trust in their OS/hardware combination that we cannot provide in the general case. The flag does allow someone to create an unstable system where time can move backwards and cause all kinds of havoc, which is why the flag is not enabled by default.
review: http://cr.openjdk.java.net/~sla/6864866/webrev.00/
bug: https://bugs.openjdk.java.net/browse/JDK-6864866
Thanks,
/Staffan
More information about the hotspot-runtime-dev
mailing list