From 77dc9b24dcf3bd63b67b05f40499c08886a45a8b Mon Sep 17 00:00:00 2001 From: tonyp Date: Tue, 24 Feb 2009 15:50:23 -0500 Subject: [PATCH] 6804746: G1: guarantee(variance() > -1.0,"variance should be >= 0") (due to evacuation failure) Summary: Under certain circumstances (evacuation failure) the pause time is not communicated to the policy and, as a result, the pause time field is not initialized properly. Reviewed-by: jmasa --- .../share/vm/gc_implementation/g1/g1CollectedHeap.cpp | 5 ++--- .../share/vm/gc_implementation/g1/g1CollectorPolicy.cpp | 9 +++++---- .../share/vm/gc_implementation/g1/g1CollectorPolicy.hpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 1c6766b994..8d7b5e1886 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -2626,9 +2626,8 @@ G1CollectedHeap::do_collection_pause_at_safepoint(HeapRegion* popular_region) { #endif // SCAN_ONLY_VERBOSE double end_time_sec = os::elapsedTime(); - if (!evacuation_failed()) { - g1_policy()->record_pause_time((end_time_sec - start_time_sec)*1000.0); - } + double pause_time_ms = (end_time_sec - start_time_sec) * MILLIUNITS; + g1_policy()->record_pause_time_ms(pause_time_ms); GCOverheadReporter::recordSTWEnd(end_time_sec); g1_policy()->record_collection_pause_end(popular_region != NULL, abandoned); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp index 949e3f9970..142a4e24fc 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -1014,7 +1014,7 @@ void G1CollectorPolicy::record_full_collection_end() { _all_full_gc_times_ms->add(full_gc_time_ms); - update_recent_gc_times(end_sec, full_gc_time_sec); + update_recent_gc_times(end_sec, full_gc_time_ms); _g1->clear_full_collection(); @@ -1475,6 +1475,7 @@ void G1CollectorPolicy::record_collection_pause_end(bool popular, size_t cur_used_bytes = _g1->used(); assert(cur_used_bytes == _g1->recalculate_used(), "It should!"); bool last_pause_included_initial_mark = false; + bool update_stats = !abandoned && !_g1->evacuation_failed(); #ifndef PRODUCT if (G1YoungSurvRateVerbose) { @@ -1535,7 +1536,7 @@ void G1CollectorPolicy::record_collection_pause_end(bool popular, _n_pauses++; - if (!abandoned) { + if (update_stats) { _recent_CH_strong_roots_times_ms->add(_cur_CH_strong_roots_dur_ms); _recent_G1_strong_roots_times_ms->add(_cur_G1_strong_roots_dur_ms); _recent_evac_times_ms->add(evac_ms); @@ -1636,7 +1637,7 @@ void G1CollectorPolicy::record_collection_pause_end(bool popular, double termination_time = avg_value(_par_last_termination_times_ms); double parallel_other_time; - if (!abandoned) { + if (update_stats) { MainBodySummary* body_summary = summary->main_body_summary(); guarantee(body_summary != NULL, "should not be null!"); @@ -1852,7 +1853,7 @@ void G1CollectorPolicy::record_collection_pause_end(bool popular, // - if (!popular && !abandoned) { + if (!popular && update_stats) { double pause_time_ms = elapsed_ms; size_t diff = 0; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp index 1649584cd3..404e292b84 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp @@ -966,7 +966,7 @@ public: record_termination_time(0, ms); } - void record_pause_time(double ms) { + void record_pause_time_ms(double ms) { _last_pause_time_ms = ms; } -- GitLab