hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp
changeset 37170 355117fc6eab
parent 37160 5249697af3f8
child 37214 bc4e0e0995e6
--- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp	Tue Mar 22 01:52:23 2016 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp	Mon Mar 21 15:59:58 2016 -0400
@@ -169,6 +169,21 @@
 
   double accum_yg_surv_rate_pred(int age) const;
 
+  // When copying, we will likely need more bytes free than is live in the region.
+  // Add some safety margin to factor in the confidence of our guess, and the
+  // natural expected waste.
+  // (100.0 / G1ConfidencePercent) is a scale factor that expresses the uncertainty
+  // of the calculation: the lower the confidence, the more headroom.
+  // (100 + TargetPLABWastePct) represents the increase in expected bytes during
+  // copying due to anticipated waste in the PLABs.
+  double safety_factor() const {
+    return (100.0 / G1ConfidencePercent) * (100 + TargetPLABWastePct) / 100.0;
+  }
+
+  // Returns an estimate of the available bytes at end of collection, adjusted by
+  // the safety factor.
+  size_t available_bytes_estimate();
+
 protected:
   G1CollectionSet* _collection_set;
   virtual double average_time_ms(G1GCPhaseTimes::GCParPhases phase) const;