111 G1CollectedHeap::heap()->max_capacity() * (100.0 - safe_total_heap_percentage) / 100.0, |
111 G1CollectedHeap::heap()->max_capacity() * (100.0 - safe_total_heap_percentage) / 100.0, |
112 _target_occupancy * (100.0 - _heap_waste_percent) / 100.0 |
112 _target_occupancy * (100.0 - _heap_waste_percent) / 100.0 |
113 ); |
113 ); |
114 } |
114 } |
115 |
115 |
|
116 double G1AdaptiveIHOPControl::get_new_prediction(TruncatedSeq const* seq) const { |
|
117 return _predictor->get_new_lower_zero_bound_prediction(seq); |
|
118 } |
|
119 |
116 bool G1AdaptiveIHOPControl::have_enough_data_for_prediction() const { |
120 bool G1AdaptiveIHOPControl::have_enough_data_for_prediction() const { |
117 return ((size_t)_marking_times_s.num() >= G1AdaptiveIHOPNumInitialSamples) && |
121 return ((size_t)_marking_times_s.num() >= G1AdaptiveIHOPNumInitialSamples) && |
118 ((size_t)_allocation_rate_s.num() >= G1AdaptiveIHOPNumInitialSamples); |
122 ((size_t)_allocation_rate_s.num() >= G1AdaptiveIHOPNumInitialSamples); |
119 } |
123 } |
120 |
124 |
121 size_t G1AdaptiveIHOPControl::get_conc_mark_start_threshold() { |
125 size_t G1AdaptiveIHOPControl::get_conc_mark_start_threshold() { |
122 if (have_enough_data_for_prediction()) { |
126 if (have_enough_data_for_prediction()) { |
123 double pred_marking_time = _predictor->get_new_prediction(&_marking_times_s); |
127 double pred_marking_time = get_new_prediction(&_marking_times_s); |
124 double pred_promotion_rate = _predictor->get_new_prediction(&_allocation_rate_s); |
128 double pred_promotion_rate = get_new_prediction(&_allocation_rate_s); |
125 size_t pred_promotion_size = (size_t)(pred_marking_time * pred_promotion_rate); |
129 size_t pred_promotion_size = (size_t)(pred_marking_time * pred_promotion_rate); |
126 |
130 |
127 size_t predicted_needed_bytes_during_marking = |
131 size_t predicted_needed_bytes_during_marking = |
128 pred_promotion_size + |
132 pred_promotion_size + |
129 // In reality we would need the maximum size of the young gen during |
133 // In reality we would need the maximum size of the young gen during |
166 get_conc_mark_start_threshold(), |
170 get_conc_mark_start_threshold(), |
167 percent_of(get_conc_mark_start_threshold(), actual_target), |
171 percent_of(get_conc_mark_start_threshold(), actual_target), |
168 actual_target, |
172 actual_target, |
169 G1CollectedHeap::heap()->used(), |
173 G1CollectedHeap::heap()->used(), |
170 _last_unrestrained_young_size, |
174 _last_unrestrained_young_size, |
171 _predictor->get_new_prediction(&_allocation_rate_s), |
175 get_new_prediction(&_allocation_rate_s), |
172 _predictor->get_new_prediction(&_marking_times_s) * 1000.0, |
176 get_new_prediction(&_marking_times_s) * 1000.0, |
173 have_enough_data_for_prediction() ? "true" : "false"); |
177 have_enough_data_for_prediction() ? "true" : "false"); |
174 } |
178 } |
175 |
179 |
176 void G1AdaptiveIHOPControl::send_trace_event(G1NewTracer* tracer) { |
180 void G1AdaptiveIHOPControl::send_trace_event(G1NewTracer* tracer) { |
177 G1IHOPControl::send_trace_event(tracer); |
181 G1IHOPControl::send_trace_event(tracer); |
178 tracer->report_adaptive_ihop_statistics(get_conc_mark_start_threshold(), |
182 tracer->report_adaptive_ihop_statistics(get_conc_mark_start_threshold(), |
179 actual_target_threshold(), |
183 actual_target_threshold(), |
180 G1CollectedHeap::heap()->used(), |
184 G1CollectedHeap::heap()->used(), |
181 _last_unrestrained_young_size, |
185 _last_unrestrained_young_size, |
182 _predictor->get_new_prediction(&_allocation_rate_s), |
186 get_new_prediction(&_allocation_rate_s), |
183 _predictor->get_new_prediction(&_marking_times_s), |
187 get_new_prediction(&_marking_times_s), |
184 have_enough_data_for_prediction()); |
188 have_enough_data_for_prediction()); |
185 } |
189 } |