< prev index next >

src/hotspot/share/gc/g1/g1IHOPControl.cpp

Print this page
rev 58105 : [mq]: 8236073-softmaxheapsize


  91   _predictor(predictor),
  92   _marking_times_s(10, 0.95),
  93   _allocation_rate_s(10, 0.95),
  94   _last_unrestrained_young_size(0)
  95 {
  96 }
  97 
  98 size_t G1AdaptiveIHOPControl::actual_target_threshold() const {
  99   guarantee(_target_occupancy > 0, "Target occupancy still not updated yet.");
 100   // The actual target threshold takes the heap reserve and the expected waste in
 101   // free space  into account.
 102   // _heap_reserve is that part of the total heap capacity that is reserved for
 103   // eventual promotion failure.
 104   // _heap_waste is the amount of space will never be reclaimed in any
 105   // heap, so can not be used for allocation during marking and must always be
 106   // considered.
 107 
 108   double safe_total_heap_percentage = MIN2((double)(_heap_reserve_percent + _heap_waste_percent), 100.0);
 109 
 110   return (size_t)MIN2(
 111     G1CollectedHeap::heap()->max_capacity() * (100.0 - safe_total_heap_percentage) / 100.0,
 112     _target_occupancy * (100.0 - _heap_waste_percent) / 100.0
 113     );
 114 }
 115 
 116 double G1AdaptiveIHOPControl::predict(TruncatedSeq const* seq) const {
 117   return _predictor->predict_zero_bounded(seq);
 118 }
 119 
 120 bool G1AdaptiveIHOPControl::have_enough_data_for_prediction() const {
 121   return ((size_t)_marking_times_s.num() >= G1AdaptiveIHOPNumInitialSamples) &&
 122          ((size_t)_allocation_rate_s.num() >= G1AdaptiveIHOPNumInitialSamples);
 123 }
 124 
 125 size_t G1AdaptiveIHOPControl::get_conc_mark_start_threshold() {
 126   if (have_enough_data_for_prediction()) {
 127     double pred_marking_time = predict(&_marking_times_s);
 128     double pred_promotion_rate = predict(&_allocation_rate_s);
 129     size_t pred_promotion_size = (size_t)(pred_marking_time * pred_promotion_rate);
 130 
 131     size_t predicted_needed_bytes_during_marking =


 169                       "predicted marking phase length: %1.2fms, prediction active: %s",
 170                       get_conc_mark_start_threshold(),
 171                       percent_of(get_conc_mark_start_threshold(), actual_target),
 172                       actual_target,
 173                       G1CollectedHeap::heap()->used(),
 174                       _last_unrestrained_young_size,
 175                       predict(&_allocation_rate_s),
 176                       predict(&_marking_times_s) * 1000.0,
 177                       have_enough_data_for_prediction() ? "true" : "false");
 178 }
 179 
 180 void G1AdaptiveIHOPControl::send_trace_event(G1NewTracer* tracer) {
 181   G1IHOPControl::send_trace_event(tracer);
 182   tracer->report_adaptive_ihop_statistics(get_conc_mark_start_threshold(),
 183                                           actual_target_threshold(),
 184                                           G1CollectedHeap::heap()->used(),
 185                                           _last_unrestrained_young_size,
 186                                           predict(&_allocation_rate_s),
 187                                           predict(&_marking_times_s),
 188                                           have_enough_data_for_prediction());





 189 }


  91   _predictor(predictor),
  92   _marking_times_s(10, 0.95),
  93   _allocation_rate_s(10, 0.95),
  94   _last_unrestrained_young_size(0)
  95 {
  96 }
  97 
  98 size_t G1AdaptiveIHOPControl::actual_target_threshold() const {
  99   guarantee(_target_occupancy > 0, "Target occupancy still not updated yet.");
 100   // The actual target threshold takes the heap reserve and the expected waste in
 101   // free space  into account.
 102   // _heap_reserve is that part of the total heap capacity that is reserved for
 103   // eventual promotion failure.
 104   // _heap_waste is the amount of space will never be reclaimed in any
 105   // heap, so can not be used for allocation during marking and must always be
 106   // considered.
 107 
 108   double safe_total_heap_percentage = MIN2((double)(_heap_reserve_percent + _heap_waste_percent), 100.0);
 109 
 110   return (size_t)MIN2(
 111     G1CollectedHeap::heap()->soft_max_capacity() * (100.0 - safe_total_heap_percentage) / 100.0,
 112     _target_occupancy * (100.0 - _heap_waste_percent) / 100.0
 113     );
 114 }
 115 
 116 double G1AdaptiveIHOPControl::predict(TruncatedSeq const* seq) const {
 117   return _predictor->predict_zero_bounded(seq);
 118 }
 119 
 120 bool G1AdaptiveIHOPControl::have_enough_data_for_prediction() const {
 121   return ((size_t)_marking_times_s.num() >= G1AdaptiveIHOPNumInitialSamples) &&
 122          ((size_t)_allocation_rate_s.num() >= G1AdaptiveIHOPNumInitialSamples);
 123 }
 124 
 125 size_t G1AdaptiveIHOPControl::get_conc_mark_start_threshold() {
 126   if (have_enough_data_for_prediction()) {
 127     double pred_marking_time = predict(&_marking_times_s);
 128     double pred_promotion_rate = predict(&_allocation_rate_s);
 129     size_t pred_promotion_size = (size_t)(pred_marking_time * pred_promotion_rate);
 130 
 131     size_t predicted_needed_bytes_during_marking =


 169                       "predicted marking phase length: %1.2fms, prediction active: %s",
 170                       get_conc_mark_start_threshold(),
 171                       percent_of(get_conc_mark_start_threshold(), actual_target),
 172                       actual_target,
 173                       G1CollectedHeap::heap()->used(),
 174                       _last_unrestrained_young_size,
 175                       predict(&_allocation_rate_s),
 176                       predict(&_marking_times_s) * 1000.0,
 177                       have_enough_data_for_prediction() ? "true" : "false");
 178 }
 179 
 180 void G1AdaptiveIHOPControl::send_trace_event(G1NewTracer* tracer) {
 181   G1IHOPControl::send_trace_event(tracer);
 182   tracer->report_adaptive_ihop_statistics(get_conc_mark_start_threshold(),
 183                                           actual_target_threshold(),
 184                                           G1CollectedHeap::heap()->used(),
 185                                           _last_unrestrained_young_size,
 186                                           predict(&_allocation_rate_s),
 187                                           predict(&_marking_times_s),
 188                                           have_enough_data_for_prediction());
 189 }
 190 
 191 size_t G1AdaptiveIHOPControl::predict_unrestrained_buffer_size() const {
 192   // Besides the young size, the promotion bytes of Prepare Mixed and 1st Mixed GC will be counted
 193   return  _last_unrestrained_young_size + _last_allocated_bytes * 2;
 194 }
< prev index next >