< prev index next >

src/share/vm/gc/g1/g1CollectorPolicy.hpp

Print this page
rev 9402 : dihop-changes
rev 9404 : [mq]: erik-jmasa-review

@@ -27,13 +27,15 @@
 
 #include "gc/g1/collectionSetChooser.hpp"
 #include "gc/g1/g1CollectorState.hpp"
 #include "gc/g1/g1GCPhaseTimes.hpp"
 #include "gc/g1/g1InCSetState.hpp"
+#include "gc/g1/g1InitialMarkToMixedTimeTracker.hpp"
 #include "gc/g1/g1MMUTracker.hpp"
 #include "gc/g1/g1Predictions.hpp"
 #include "gc/shared/collectorPolicy.hpp"
+#include "utilities/pair.hpp"
 
 // A G1CollectorPolicy makes policy decisions that determine the
 // characteristics of the collector.  Examples include:
 //   * choice of collection set.
 //   * when to collect.

@@ -283,61 +285,11 @@
 
   // The amount of allocated bytes in old gen during the last mutator and the following
   // young GC phase.
   size_t _last_old_allocated_bytes;
 
-  // Used to track time from the end of initial mark to the first mixed GC.
-  class InitialMarkToMixedTimeTracker {
-   private:
-    bool _active;
-    double _initial_mark_end_time;
-    double _mixed_start_time;
-    double _total_pause_time;
-
-    double wall_time() const {
-      return _mixed_start_time - _initial_mark_end_time;
-    }
-   public:
-    InitialMarkToMixedTimeTracker() { reset(); }
-
-    void record_initial_mark_end(double end_time) {
-      assert(!_active, "Initial mark out of order.");
-      _initial_mark_end_time = end_time;
-      _active = true;
-    }
-
-    void record_mixed_gc_start(double start_time) {
-      if (_active) {
-        _mixed_start_time = start_time;
-        _active = false;
-      }
-    }
-
-    double last_marking_time() {
-      assert(has_result(), "Do not have all measurements yet.");
-      double result = (_mixed_start_time - _initial_mark_end_time) - _total_pause_time;
-      reset();
-      return result;
-    }
-
-    void reset() {
-      _active = false;
-      _total_pause_time = 0.0;
-      _initial_mark_end_time = -1.0;
-      _mixed_start_time = -1.0;
-    }
-
-    void add_pause(double time) {
-      if (_active) {
-        _total_pause_time += time;
-      }
-    }
-
-    bool has_result() const { return _mixed_start_time > 0.0 && _initial_mark_end_time > 0.0; }
-  };
-
-  InitialMarkToMixedTimeTracker _initial_mark_to_mixed;
+  G1InitialMarkToMixedTimeTracker _initial_mark_to_mixed;
 public:
   const G1Predictions& predictor() const { return _predictor; }
 
   // Add the given number of bytes to the total number of allocated bytes in the old gen.
   void add_last_old_allocated_bytes(size_t bytes) { _last_old_allocated_bytes += bytes; }

@@ -539,20 +491,22 @@
   // determine whether we should initiate a new marking.
   double _cur_mark_stop_world_time_ms;
   double _mark_remark_start_sec;
   double _mark_cleanup_start_sec;
 
-  void update_young_list_max_and_target_length(size_t* unbounded_target_length = NULL);
-  void update_young_list_max_and_target_length(size_t rs_lengths, size_t* unbounded_target_length = NULL);
+  // Updates the internal young list maximum and target lengths. Returns the
+  // unbounded young list target length.
+  uint update_young_list_max_and_target_length();
+  uint update_young_list_max_and_target_length(size_t rs_lengths);
 
   // Update the young list target length either by setting it to the
   // desired fixed value or by calculating it using G1's pause
   // prediction model. If no rs_lengths parameter is passed, predict
   // the RS lengths using the prediction model, otherwise use the
   // given rs_lengths as the prediction.
-  void update_young_list_target_length();
-  void update_young_list_target_length(size_t rs_lengths, size_t* unbounded_target_length = NULL);
+  // Returns the unbounded young list target length.
+  uint update_young_list_target_length(size_t rs_lengths);
 
   // Calculate and return the minimum desired young list target
   // length. This is the minimum desired young list length according
   // to the user's inputs.
   uint calculate_young_list_desired_min_length(uint base_min_length) const;

@@ -571,11 +525,14 @@
   uint calculate_young_list_target_length(size_t rs_lengths,
                                           uint base_min_length,
                                           uint desired_min_length,
                                           uint desired_max_length) const;
 
-  uint bounded_young_list_target_length(size_t rs_lengths, size_t* unbounded_target_length = NULL) const;
+  // Result of the bounded_young_list_target_length() method, containing both the
+  // bounded as well as the unbounded young list target lengths in this order.
+  typedef Pair<uint, uint, StackObj> YoungTargetLengths;
+  YoungTargetLengths young_list_target_lengths(size_t rs_lengths) const;
 
   void update_rs_lengths_prediction();
   void update_rs_lengths_prediction(size_t prediction);
 
   // Calculate and return chunk size (in number of regions) for parallel
< prev index next >