double G1MMUTrackerQueue::when_internal(double current_time, double pause_time) { // if the pause is over the maximum, just assume that it's the maximum double adjusted_pause_time = (pause_time > max_gc_time()) ? max_gc_time() : pause_time; double earliest_end = current_time + adjusted_pause_time; double limit = earliest_end - _time_slice; 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; 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; } index = trim_index(index+1); guarantee(index != trim_index(_head_index + 1), "should not go past head"); } }
inline double when_max_gc_sec(double current_time) { return when_sec(current_time, max_gc_time()); }
inline bool now_max_gc(double current_time) { return when_sec(current_time, max_gc_time()) < 0.00001; }