src/hotspot/share/gc/z/zStat.cpp
changeset 54922 185ffc45593c
parent 54632 2d0c05e71bd5
child 55285 9a120214e732
child 58678 9cf78a70fa4f
--- a/src/hotspot/share/gc/z/zStat.cpp	Fri May 17 11:44:44 2019 +0200
+++ b/src/hotspot/share/gc/z/zStat.cpp	Fri May 17 12:06:03 2019 +0200
@@ -850,7 +850,16 @@
 }
 
 bool ZStat::should_print(LogTargetHandle log) const {
-  return log.is_enabled() && (_metronome.nticks() % ZStatisticsInterval == 0);
+  static uint64_t print_at = ZStatisticsInterval;
+  const uint64_t now = os::elapsedTime();
+
+  if (now < print_at) {
+    return false;
+  }
+
+  print_at = ((now / ZStatisticsInterval) * ZStatisticsInterval) + ZStatisticsInterval;
+
+  return log.is_enabled();
 }
 
 void ZStat::print(LogTargetHandle log, const ZStatSamplerHistory* history) const {