Print this page
rev 2869 : 7117303: VM uses non-monotonic time source and complains that it is non-monotonic
Summary: Replaces calls to os::javaTimeMillis(), which does not guarantee montonicity, in GC code to os::javaTimeNanos() with a suitable conversion factor. os::javaTimeNanos() mostly guarantees montonicity depending on the underlying OS implementation and, as a result, a better alternative. Changes in OS files are to make use of the newly defined constants in globalDefinitions.hpp.
Reviewed-by:

Split Close
Expand all
Collapse all
          --- old/src/share/vm/memory/generation.hpp
          +++ new/src/share/vm/memory/generation.hpp
↓ open down ↓ 408 lines elided ↑ open up ↑
 409  409    // Some generations may need to be "fixed-up" after some allocation
 410  410    // activity to make them parsable again. The default is to do nothing.
 411  411    virtual void ensure_parsability() {};
 412  412  
 413  413    // Time (in ms) when we were last collected or now if a collection is
 414  414    // in progress.
 415  415    virtual jlong time_of_last_gc(jlong now) {
 416  416      // XXX See note in genCollectedHeap::millis_since_last_gc()
 417  417      NOT_PRODUCT(
 418  418        if (now < _time_of_last_gc) {
 419      -        warning("time warp: %d to %d", _time_of_last_gc, now);
      419 +        warning("time warp: "INT64_FORMAT" to "INT64_FORMAT, _time_of_last_gc, now);
 420  420        }
 421  421      )
 422  422      return _time_of_last_gc;
 423  423    }
 424  424  
 425  425    virtual void update_time_of_last_gc(jlong now)  {
 426  426      _time_of_last_gc = now;
 427  427    }
 428  428  
 429  429    // Generations may keep statistics about collection.  This
↓ open down ↓ 328 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX