8210463: Recalculate_used() always sets time taken in G1GCPhaseTimes
Reviewed-by: phh, sjohanss
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Tue Sep 11 09:27:47 2018 +0800
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Tue Sep 11 09:13:37 2018 +0200
@@ -1950,12 +1950,8 @@
};
size_t G1CollectedHeap::recalculate_used() const {
- double recalculate_used_start = os::elapsedTime();
-
SumUsedClosure blk;
heap_region_iterate(&blk);
-
- g1_policy()->phase_times()->record_evac_fail_recalc_used_time((os::elapsedTime() - recalculate_used_start) * 1000.0);
return blk.result();
}
@@ -3013,7 +3009,10 @@
g1_policy()->phase_times()->record_start_new_cset_time_ms((os::elapsedTime() - start) * 1000.0);
if (evacuation_failed()) {
+ double recalculate_used_start = os::elapsedTime();
set_used(recalculate_used());
+ g1_policy()->phase_times()->record_evac_fail_recalc_used_time((os::elapsedTime() - recalculate_used_start) * 1000.0);
+
if (_archive_allocator != NULL) {
_archive_allocator->clear_used();
}