--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp Tue Aug 21 10:05:57 2012 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp Tue Aug 21 14:10:39 2012 -0700
@@ -384,10 +384,17 @@
}
void HeapRegion::calc_gc_efficiency() {
+ // GC efficiency is the ratio of how much space would be
+ // reclaimed over how long we predict it would take to reclaim it.
G1CollectedHeap* g1h = G1CollectedHeap::heap();
G1CollectorPolicy* g1p = g1h->g1_policy();
- _gc_efficiency = (double) reclaimable_bytes() /
- g1p->predict_region_elapsed_time_ms(this, false);
+
+ // Retrieve a prediction of the elapsed time for this region for
+ // a mixed gc because the region will only be evacuated during a
+ // mixed gc.
+ double region_elapsed_time_ms =
+ g1p->predict_region_elapsed_time_ms(this, false /* for_young_gc */);
+ _gc_efficiency = (double) reclaimable_bytes() / region_elapsed_time_ms;
}
void HeapRegion::set_startsHumongous(HeapWord* new_top, HeapWord* new_end) {