void G1MMUTrackerQueue::add_pause(double start, double end, bool gc_thread) { double longest_allowed = longest_pause_internal(start); if (longest_allowed < 0.0) longest_allowed = 0.0; double duration = end - start; remove_expired_entries(end); if (_no_entries == QueueLength) { // OK, right now when we fill up we bomb out // there are a few ways of dealing with this "gracefully" // increase the array size (:-) // remove the oldest entry (this might allow more GC time for // the time slice than what's allowed) // consolidate the two entries with the minimum gap between them // (this might allow less GC time than what's allowed) guarantee(NOT_PRODUCT(ScavengeALot ||) G1UseFixedWindowMMUTracker, "array full, currently we can't recover unless +G1UseFixedWindowMMUTracker"); // In the case where ScavengeALot is true, such overflow is not // uncommon; in such cases, we can, without much loss of precision // or performance (we are GC'ing most of the time anyway!), // simply overwrite the oldest entry in the tracker: this // is also the behaviour when G1UseFixedWindowMMUTracker is enabled. _head_index = trim_index(_head_index + 1); assert(_head_index == _tail_index, "Because we have a full circular buffer"); _tail_index = trim_index(_tail_index + 1); } else {
void G1MMUTrackerQueue::add_pause(double start, double end, bool gc_thread) { double longest_allowed = longest_pause_internal(start); if (longest_allowed < 0.0) longest_allowed = 0.0; 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" // increase the array size (:-) // remove the oldest entry (this might allow more GC time for // the time slice than what's allowed) - this is what we // currently do // consolidate the two entries with the minimum gap between them // (this might allow less GC time than what's allowed) // In the case where ScavengeALot is true, such overflow is not // uncommon; in such cases, we can, without much loss of precision // or performance (we are GC'ing most of the time anyway!), // simply overwrite the oldest entry in the tracker. _head_index = trim_index(_head_index + 1); assert(_head_index == _tail_index, "Because we have a full circular buffer"); _tail_index = trim_index(_tail_index + 1); } else { _head_index = trim_index(_head_index + 1); ++_no_entries; } _array[_head_index] = G1MMUTrackerQueueElem(start, end); }
double G1MMUTrackerQueue::when_sec(double current_time, double pause_time) { if (_DISABLE_MMU) return 0.0; MutexLockerEx x(MMUTracker_lock, Mutex::_no_safepoint_check_flag); remove_expired_entries(current_time); return when_internal(current_time, pause_time); }
double G1MMUTrackerQueue::longest_pause(double current_time) { if (_DISABLE_MMU) return _max_gc_time; MutexLockerEx x(MMUTracker_lock, Mutex::_no_safepoint_check_flag); remove_expired_entries(current_time); return longest_pause_internal(current_time); }