168 double* _par_last_gc_worker_start_times_ms;
169 double* _par_last_ext_root_scan_times_ms;
170 double* _par_last_mark_stack_scan_times_ms;
171 double* _par_last_update_rs_times_ms;
172 double* _par_last_update_rs_processed_buffers;
173 double* _par_last_scan_rs_times_ms;
174 double* _par_last_obj_copy_times_ms;
175 double* _par_last_termination_times_ms;
176 double* _par_last_termination_attempts;
177 double* _par_last_gc_worker_end_times_ms;
178 double* _par_last_gc_worker_times_ms;
179
180 // indicates whether we are in full young or partially young GC mode
181 bool _full_young_gcs;
182
183 // if true, then it tries to dynamically adjust the length of the
184 // young list
185 bool _adaptive_young_list_length;
186 size_t _young_list_target_length;
187 size_t _young_list_fixed_length;
188
189 // The max number of regions we can extend the eden by while the GC
190 // locker is active. This should be >= _young_list_target_length;
191 size_t _young_list_max_length;
192
193 size_t _young_cset_length;
194 bool _last_young_gc_full;
195
196 unsigned _full_young_pause_num;
197 unsigned _partial_young_pause_num;
198
199 bool _during_marking;
200 bool _in_marking_window;
201 bool _in_marking_window_im;
202
203 SurvRateGroup* _short_lived_surv_rate_group;
204 SurvRateGroup* _survivor_surv_rate_group;
205 // add here any more surv rate groups
206
207 double _gc_overhead_perc;
208
209 double _reserve_factor;
210 double _reserve_regions;
211
212 bool during_marking() {
213 return _during_marking;
214 }
215
216 // <NEW PREDICTION>
217
218 private:
219 enum PredictionConstants {
220 TruncatedSeqLength = 10
221 };
222
223 TruncatedSeq* _alloc_rate_ms_seq;
224 double _prev_collection_pause_end_ms;
225
226 TruncatedSeq* _pending_card_diff_seq;
227 TruncatedSeq* _rs_length_diff_seq;
228 TruncatedSeq* _cost_per_card_ms_seq;
229 TruncatedSeq* _fully_young_cards_per_entry_ratio_seq;
230 TruncatedSeq* _partially_young_cards_per_entry_ratio_seq;
231 TruncatedSeq* _cost_per_entry_ms_seq;
232 TruncatedSeq* _partially_young_cost_per_entry_ms_seq;
233 TruncatedSeq* _cost_per_byte_ms_seq;
234 TruncatedSeq* _constant_other_time_ms_seq;
235 TruncatedSeq* _young_other_cost_per_region_ms_seq;
236 TruncatedSeq* _non_young_other_cost_per_region_ms_seq;
237
238 TruncatedSeq* _pending_cards_seq;
239 TruncatedSeq* _scanned_cards_seq;
240 TruncatedSeq* _rs_lengths_seq;
241
242 TruncatedSeq* _cost_per_byte_ms_during_cm_seq;
243
244 TruncatedSeq* _young_gc_eff_seq;
245
246 TruncatedSeq* _max_conc_overhead_seq;
247
248 size_t _recorded_young_regions;
249 size_t _recorded_non_young_regions;
250 size_t _recorded_region_num;
251
252 size_t _free_regions_at_end_of_collection;
253
254 size_t _recorded_rs_lengths;
255 size_t _max_rs_lengths;
256
257 size_t _recorded_marked_bytes;
258 size_t _recorded_young_bytes;
259
260 size_t _predicted_pending_cards;
261 size_t _predicted_cards_scanned;
262 size_t _predicted_rs_lengths;
263 size_t _predicted_bytes_to_copy;
264
265 double _predicted_survival_ratio;
266 double _predicted_rs_update_time_ms;
267 double _predicted_rs_scan_time_ms;
810
811 virtual G1CollectorPolicy* as_g1_policy() { return this; }
812
813 virtual CollectorPolicy::Name kind() {
814 return CollectorPolicy::G1CollectorPolicyKind;
815 }
816
817 // Check the current value of the young list RSet lengths and
818 // compare it against the last prediction. If the current value is
819 // higher, recalculate the young list target length prediction.
820 void revise_young_list_target_length_if_necessary();
821
822 size_t bytes_in_collection_set() {
823 return _bytes_in_collection_set_before_gc;
824 }
825
826 unsigned calc_gc_alloc_time_stamp() {
827 return _all_pause_times_ms->num() + 1;
828 }
829
830 // Recalculate the reserve region number. This should be called
831 // after the heap is resized.
832 void calculate_reserve(size_t all_regions);
833
834 protected:
835
836 // Count the number of bytes used in the CS.
837 void count_CS_bytes_used();
838
839 // Together these do the base cleanup-recording work. Subclasses might
840 // want to put something between them.
841 void record_concurrent_mark_cleanup_end_work1(size_t freed_bytes,
842 size_t max_live_bytes);
843 void record_concurrent_mark_cleanup_end_work2();
844
845 public:
846
847 virtual void init();
848
849 // Create jstat counters for the policy.
850 virtual void initialize_gc_policy_counters();
851
852 virtual HeapWord* mem_allocate_work(size_t size,
853 bool is_tlab,
854 bool* gc_overhead_limit_was_exceeded);
855
856 // This method controls how a collector handles one or more
857 // of its generations being fully allocated.
858 virtual HeapWord* satisfy_failed_allocation(size_t size,
859 bool is_tlab);
860
861 BarrierSet::Name barrier_set_name() { return BarrierSet::G1SATBCTLogging; }
862
863 GenRemSet::Name rem_set_name() { return GenRemSet::CardTable; }
|
168 double* _par_last_gc_worker_start_times_ms;
169 double* _par_last_ext_root_scan_times_ms;
170 double* _par_last_mark_stack_scan_times_ms;
171 double* _par_last_update_rs_times_ms;
172 double* _par_last_update_rs_processed_buffers;
173 double* _par_last_scan_rs_times_ms;
174 double* _par_last_obj_copy_times_ms;
175 double* _par_last_termination_times_ms;
176 double* _par_last_termination_attempts;
177 double* _par_last_gc_worker_end_times_ms;
178 double* _par_last_gc_worker_times_ms;
179
180 // indicates whether we are in full young or partially young GC mode
181 bool _full_young_gcs;
182
183 // if true, then it tries to dynamically adjust the length of the
184 // young list
185 bool _adaptive_young_list_length;
186 size_t _young_list_target_length;
187 size_t _young_list_fixed_length;
188 size_t _prev_eden_capacity; // used for logging
189
190 // The max number of regions we can extend the eden by while the GC
191 // locker is active. This should be >= _young_list_target_length;
192 size_t _young_list_max_length;
193
194 size_t _young_cset_length;
195 bool _last_young_gc_full;
196
197 unsigned _full_young_pause_num;
198 unsigned _partial_young_pause_num;
199
200 bool _during_marking;
201 bool _in_marking_window;
202 bool _in_marking_window_im;
203
204 SurvRateGroup* _short_lived_surv_rate_group;
205 SurvRateGroup* _survivor_surv_rate_group;
206 // add here any more surv rate groups
207
208 double _gc_overhead_perc;
209
210 double _reserve_factor;
211 size_t _reserve_regions;
212
213 bool during_marking() {
214 return _during_marking;
215 }
216
217 // <NEW PREDICTION>
218
219 private:
220 enum PredictionConstants {
221 TruncatedSeqLength = 10
222 };
223
224 TruncatedSeq* _alloc_rate_ms_seq;
225 double _prev_collection_pause_end_ms;
226
227 TruncatedSeq* _pending_card_diff_seq;
228 TruncatedSeq* _rs_length_diff_seq;
229 TruncatedSeq* _cost_per_card_ms_seq;
230 TruncatedSeq* _fully_young_cards_per_entry_ratio_seq;
231 TruncatedSeq* _partially_young_cards_per_entry_ratio_seq;
232 TruncatedSeq* _cost_per_entry_ms_seq;
233 TruncatedSeq* _partially_young_cost_per_entry_ms_seq;
234 TruncatedSeq* _cost_per_byte_ms_seq;
235 TruncatedSeq* _constant_other_time_ms_seq;
236 TruncatedSeq* _young_other_cost_per_region_ms_seq;
237 TruncatedSeq* _non_young_other_cost_per_region_ms_seq;
238
239 TruncatedSeq* _pending_cards_seq;
240 TruncatedSeq* _scanned_cards_seq;
241 TruncatedSeq* _rs_lengths_seq;
242
243 TruncatedSeq* _cost_per_byte_ms_during_cm_seq;
244
245 TruncatedSeq* _young_gc_eff_seq;
246
247 TruncatedSeq* _max_conc_overhead_seq;
248
249 bool _using_new_ratio_calculations;
250 size_t _min_desired_young_length; // as set on the command line or default calculations
251 size_t _max_desired_young_length; // as set on the command line or default calculations
252
253 size_t _recorded_young_regions;
254 size_t _recorded_non_young_regions;
255 size_t _recorded_region_num;
256
257 size_t _free_regions_at_end_of_collection;
258
259 size_t _recorded_rs_lengths;
260 size_t _max_rs_lengths;
261
262 size_t _recorded_marked_bytes;
263 size_t _recorded_young_bytes;
264
265 size_t _predicted_pending_cards;
266 size_t _predicted_cards_scanned;
267 size_t _predicted_rs_lengths;
268 size_t _predicted_bytes_to_copy;
269
270 double _predicted_survival_ratio;
271 double _predicted_rs_update_time_ms;
272 double _predicted_rs_scan_time_ms;
815
816 virtual G1CollectorPolicy* as_g1_policy() { return this; }
817
818 virtual CollectorPolicy::Name kind() {
819 return CollectorPolicy::G1CollectorPolicyKind;
820 }
821
822 // Check the current value of the young list RSet lengths and
823 // compare it against the last prediction. If the current value is
824 // higher, recalculate the young list target length prediction.
825 void revise_young_list_target_length_if_necessary();
826
827 size_t bytes_in_collection_set() {
828 return _bytes_in_collection_set_before_gc;
829 }
830
831 unsigned calc_gc_alloc_time_stamp() {
832 return _all_pause_times_ms->num() + 1;
833 }
834
835 // This should be called after the heap is resized.
836 void record_new_heap_size(size_t new_number_of_regions);
837
838 protected:
839
840 // Count the number of bytes used in the CS.
841 void count_CS_bytes_used();
842
843 // Together these do the base cleanup-recording work. Subclasses might
844 // want to put something between them.
845 void record_concurrent_mark_cleanup_end_work1(size_t freed_bytes,
846 size_t max_live_bytes);
847 void record_concurrent_mark_cleanup_end_work2();
848
849 void update_young_list_size_using_newratio(size_t number_of_heap_regions);
850
851 public:
852
853 virtual void init();
854
855 // Create jstat counters for the policy.
856 virtual void initialize_gc_policy_counters();
857
858 virtual HeapWord* mem_allocate_work(size_t size,
859 bool is_tlab,
860 bool* gc_overhead_limit_was_exceeded);
861
862 // This method controls how a collector handles one or more
863 // of its generations being fully allocated.
864 virtual HeapWord* satisfy_failed_allocation(size_t size,
865 bool is_tlab);
866
867 BarrierSet::Name barrier_set_name() { return BarrierSet::G1SATBCTLogging; }
868
869 GenRemSet::Name rem_set_name() { return GenRemSet::CardTable; }
|