diff src/share/vm/memory/genMarkSweep.cpp @ 4911:d903bf750e9f

7129514: time warp warnings after 7117303 Summary: Replace calls to os::javaTimeMillis() that are used to update the milliseconds since the last GC to an equivalent that uses a monotonically non-decreasing time source. Reviewed-by: ysr, jmasa
author johnc
date Wed, 18 Jan 2012 09:50:16 -0800
parents aa3d708d67c4
children 9d679effd28c
line wrap: on
line diff
--- a/src/share/vm/memory/genMarkSweep.cpp	Tue Feb 14 08:21:08 2012 -0500
+++ b/src/share/vm/memory/genMarkSweep.cpp	Wed Jan 18 09:50:16 2012 -0800
@@ -176,7 +176,11 @@
 
   // Update time of last gc for all generations we collected
   // (which curently is all the generations in the heap).
-  gch->update_time_of_last_gc(os::javaTimeMillis());
+  // We need to use a monotonically non-deccreasing time in ms
+  // or we will see time-warp warnings and os::javaTimeMillis()
+  // does not guarantee monotonicity.
+  jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
+  gch->update_time_of_last_gc(now);
 }
 
 void GenMarkSweep::allocate_stacks() {