< prev index next >

src/hotspot/share/gc/g1/g1MMUTracker.cpp

Print this page

        

@@ -74,11 +74,10 @@
   }
   return gc_time;
 }
 
 void G1MMUTrackerQueue::add_pause(double start, double end) {
-  double duration = end - start;
 
   remove_expired_entries(end);
   if (_no_entries == QueueLength) {
     // OK, we've filled up the queue. There are a few ways
     // of dealing with this "gracefully"

@@ -125,20 +124,25 @@
   double gc_time = calculate_gc_time(earliest_end);
   double diff = gc_time + adjusted_pause_time - max_gc_time();
   if (is_double_leq_0(diff))
     return 0.0;
 
+  if (adjusted_pause_time == max_gc_time()) {
+    G1MMUTrackerQueueElem *elem = &_array[_head_index];
+    return elem->end_time() - limit;
+  }
+
   int index = _tail_index;
   while ( 1 ) {
     G1MMUTrackerQueueElem *elem = &_array[index];
     if (elem->end_time() > limit) {
       if (elem->start_time() > limit)
         diff -= elem->duration();
       else
         diff -= elem->end_time() - limit;
       if (is_double_leq_0(diff))
-        return  elem->end_time() + diff + _time_slice - adjusted_pause_time - current_time;
+        return  elem->end_time() + diff  - limit;
     }
     index = trim_index(index+1);
     guarantee(index != trim_index(_head_index + 1), "should not go past head");
   }
 }
< prev index next >