mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 03:24:38 +02:00
7117303: VM uses non-monotonic time source and complains that it is non-monotonic
Replaces calls to os::javaTimeMillis(), which does not (and cannot) guarantee monotonicity, in GC code to an equivalent expression that uses os::javaTimeNanos(). os::javaTimeNanos is guaranteed monotonically non-decreasing if the underlying platform provides a monotonic time source. Changes in OS files are to make use of the newly defined constants in globalDefinitions.hpp. Reviewed-by: dholmes, ysr
This commit is contained in:
parent
2768349b41
commit
870bea622a
10 changed files with 57 additions and 57 deletions
|
@ -413,10 +413,13 @@ class Generation: public CHeapObj {
|
|||
// Time (in ms) when we were last collected or now if a collection is
|
||||
// in progress.
|
||||
virtual jlong time_of_last_gc(jlong now) {
|
||||
// XXX See note in genCollectedHeap::millis_since_last_gc()
|
||||
// Both _time_of_last_gc and now are set using a time source
|
||||
// that guarantees monotonically non-decreasing values provided
|
||||
// the underlying platform provides such a source. So we still
|
||||
// have to guard against non-monotonicity.
|
||||
NOT_PRODUCT(
|
||||
if (now < _time_of_last_gc) {
|
||||
warning("time warp: %d to %d", _time_of_last_gc, now);
|
||||
warning("time warp: "INT64_FORMAT" to "INT64_FORMAT, _time_of_last_gc, now);
|
||||
}
|
||||
)
|
||||
return _time_of_last_gc;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue