--- old/src/share/vm/gc/g1/g1CollectorPolicy.cpp 2015-11-19 11:52:57.435832421 +0100 +++ new/src/share/vm/gc/g1/g1CollectorPolicy.cpp 2015-11-19 11:52:57.348829865 +0100 @@ -1209,21 +1209,9 @@ size_t last_unrestrained_young_length = update_young_list_max_and_target_length(); update_rs_lengths_prediction(); - // Only update IHOP information on regular GCs. - if (update_stats) { - double marking_to_mixed_time = -1.0; - if (!collector_state()->last_gc_was_young() && _initial_mark_to_mixed.has_result()) { - marking_to_mixed_time = _initial_mark_to_mixed.last_marking_time(); - assert(marking_to_mixed_time > 0.0, - "Initial mark to mixed time must be larger than zero but is %.3f", - marking_to_mixed_time); - } - - update_ihop_statistics(marking_to_mixed_time, - app_time_ms / 1000.0, - _last_old_allocated_bytes, - last_unrestrained_young_length * HeapRegion::GrainBytes); - } + update_ihop_prediction(app_time_ms / 1000.0, + _last_old_allocated_bytes, + last_unrestrained_young_length * HeapRegion::GrainBytes); _last_old_allocated_bytes = 0; // Note that _mmu_tracker->max_gc_time() returns the time in seconds. @@ -1256,19 +1244,28 @@ G1CollectedHeap::heap()->max_capacity()); } -void G1CollectorPolicy::update_ihop_statistics(double marking_time, - double mutator_time_s, +void G1CollectorPolicy::update_ihop_prediction(double mutator_time_s, size_t mutator_alloc_bytes, size_t young_gen_size) { - bool report = false; + // Always try to update IHOP prediction. Even evacuation failures give information + // about e.g. whether to start IHOP earlier next time. - // To avoid using really small times that may be caused by e.g. back-to-back gcs - // we filter them out. + // Avoid using really small application times that might create samples with + // very high or very low values. They may be caused by e.g. back-to-back gcs. double const min_valid_time = 1e-6; - if (marking_time > min_valid_time) { - _ihop_control->update_marking_length(marking_time); - report = true; + bool report = false; + + double marking_to_mixed_time = -1.0; + if (!collector_state()->last_gc_was_young() && _initial_mark_to_mixed.has_result()) { + marking_to_mixed_time = _initial_mark_to_mixed.last_marking_time(); + assert(marking_to_mixed_time > 0.0, + "Initial mark to mixed time must be larger than zero but is %.3f", + marking_to_mixed_time); + if (marking_to_mixed_time > min_valid_time) { + _ihop_control->update_marking_length(marking_to_mixed_time); + report = true; + } } // As an approximation for the young gc promotion rates during marking we use