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/utilities/globalDefinitions.hpp
          +++ new/src/share/vm/utilities/globalDefinitions.hpp
↓ open down ↓ 167 lines elided ↑ open up ↑
 168  168  const jint min_jint = (jint)1 << (sizeof(jint)*BitsPerByte-1); // 0x80000000 == smallest jint
 169  169  const jint max_jint = (juint)min_jint - 1;                     // 0x7FFFFFFF == largest jint
 170  170  
 171  171  // Constants for converting from a base unit to milli-base units.  For
 172  172  // example from seconds to milliseconds and microseconds
 173  173  
 174  174  const int MILLIUNITS    = 1000;         // milli units per base unit
 175  175  const int MICROUNITS    = 1000000;      // micro units per base unit
 176  176  const int NANOUNITS     = 1000000000;   // nano units per base unit
 177  177  
      178 +const jlong NANOSECS_PER_SEC      = CONST64(1000000000);
      179 +const jint  NANOSECS_PER_MILLISEC = 1000000;
      180 +
 178  181  inline const char* proper_unit_for_byte_size(size_t s) {
 179  182    if (s >= 10*M) {
 180  183      return "M";
 181  184    } else if (s >= 10*K) {
 182  185      return "K";
 183  186    } else {
 184  187      return "B";
 185  188    }
 186  189  }
 187  190  
↓ open down ↓ 1050 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX