< prev index next >

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

Print this page
rev 9416 : dihop-changes
rev 9418 : imported patch erik-jmasa-review
rev 9419 : [mq]: fix-evac-failure-needs-stats

@@ -1207,25 +1207,13 @@
   // prediction too small and the limit the young gen every time we get to the
   // predicted target occupancy.
   size_t last_unrestrained_young_length = update_young_list_max_and_target_length();
   update_rs_lengths_prediction();
 
-  // Only update IHOP information on regular GCs.
-  if (update_stats) {
-    double marking_to_mixed_time = -1.0;
-    if (!collector_state()->last_gc_was_young() && _initial_mark_to_mixed.has_result()) {
-      marking_to_mixed_time = _initial_mark_to_mixed.last_marking_time();
-      assert(marking_to_mixed_time > 0.0,
-             "Initial mark to mixed time must be larger than zero but is %.3f",
-             marking_to_mixed_time);
-    }
-
-    update_ihop_statistics(marking_to_mixed_time,
-                           app_time_ms / 1000.0,
+  update_ihop_prediction(app_time_ms / 1000.0,
                            _last_old_allocated_bytes,
                            last_unrestrained_young_length * HeapRegion::GrainBytes);
-  }
   _last_old_allocated_bytes = 0;
 
   // Note that _mmu_tracker->max_gc_time() returns the time in seconds.
   double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0;
 

@@ -1254,24 +1242,33 @@
 G1IHOPControl* G1CollectorPolicy::create_ihop_control() const {
   return new G1StaticIHOPControl(InitiatingHeapOccupancyPercent,
                                  G1CollectedHeap::heap()->max_capacity());
 }
 
-void G1CollectorPolicy::update_ihop_statistics(double marking_time,
-                                               double mutator_time_s,
+void G1CollectorPolicy::update_ihop_prediction(double mutator_time_s,
                                                size_t mutator_alloc_bytes,
                                                size_t young_gen_size) {
-  bool report = false;
+  // Always try to update IHOP prediction. Even evacuation failures give information
+  // about e.g. whether to start IHOP earlier next time.
 
-  // To avoid using really small times that may be caused by e.g. back-to-back gcs
-  // we filter them out.
+  // Avoid using really small application times that might create samples with
+  // very high or very low values. They may be caused by e.g. back-to-back gcs.
   double const min_valid_time = 1e-6;
 
-  if (marking_time > min_valid_time) {
-    _ihop_control->update_marking_length(marking_time);
+  bool report = false;
+
+  double marking_to_mixed_time = -1.0;
+  if (!collector_state()->last_gc_was_young() && _initial_mark_to_mixed.has_result()) {
+    marking_to_mixed_time = _initial_mark_to_mixed.last_marking_time();
+    assert(marking_to_mixed_time > 0.0,
+           "Initial mark to mixed time must be larger than zero but is %.3f",
+           marking_to_mixed_time);
+    if (marking_to_mixed_time > min_valid_time) {
+      _ihop_control->update_marking_length(marking_to_mixed_time);
     report = true;
   }
+  }
 
   // As an approximation for the young gc promotion rates during marking we use
   // all of them. In many applications there are only a few if any young gcs during
   // marking, which makes any prediction useless. This increases the accuracy of the
   // prediction.
< prev index next >