226 }; |
226 }; |
227 |
227 |
228 TruncatedSeq* _alloc_rate_ms_seq; |
228 TruncatedSeq* _alloc_rate_ms_seq; |
229 double _prev_collection_pause_end_ms; |
229 double _prev_collection_pause_end_ms; |
230 |
230 |
231 TruncatedSeq* _pending_card_diff_seq; |
|
232 TruncatedSeq* _rs_length_diff_seq; |
231 TruncatedSeq* _rs_length_diff_seq; |
233 TruncatedSeq* _cost_per_card_ms_seq; |
232 TruncatedSeq* _cost_per_card_ms_seq; |
234 TruncatedSeq* _young_cards_per_entry_ratio_seq; |
233 TruncatedSeq* _young_cards_per_entry_ratio_seq; |
235 TruncatedSeq* _mixed_cards_per_entry_ratio_seq; |
234 TruncatedSeq* _mixed_cards_per_entry_ratio_seq; |
236 TruncatedSeq* _cost_per_entry_ms_seq; |
235 TruncatedSeq* _cost_per_entry_ms_seq; |
293 void set_no_of_gc_threads(uintx v) { _no_of_gc_threads = v; } |
292 void set_no_of_gc_threads(uintx v) { _no_of_gc_threads = v; } |
294 |
293 |
295 double _pause_time_target_ms; |
294 double _pause_time_target_ms; |
296 |
295 |
297 size_t _pending_cards; |
296 size_t _pending_cards; |
298 size_t _max_pending_cards; |
|
299 |
297 |
300 public: |
298 public: |
301 // Accessors |
299 // Accessors |
302 |
300 |
303 void set_region_eden(HeapRegion* hr, int young_index_in_cset) { |
301 void set_region_eden(HeapRegion* hr, int young_index_in_cset) { |
321 seq->davg() * confidence_factor(seq->num())); |
319 seq->davg() * confidence_factor(seq->num())); |
322 } |
320 } |
323 |
321 |
324 void record_max_rs_lengths(size_t rs_lengths) { |
322 void record_max_rs_lengths(size_t rs_lengths) { |
325 _max_rs_lengths = rs_lengths; |
323 _max_rs_lengths = rs_lengths; |
326 } |
|
327 |
|
328 size_t predict_pending_card_diff() { |
|
329 double prediction = get_new_neg_prediction(_pending_card_diff_seq); |
|
330 if (prediction < 0.00001) { |
|
331 return 0; |
|
332 } else { |
|
333 return (size_t) prediction; |
|
334 } |
|
335 } |
|
336 |
|
337 size_t predict_pending_cards() { |
|
338 size_t max_pending_card_num = _g1->max_pending_card_num(); |
|
339 size_t diff = predict_pending_card_diff(); |
|
340 size_t prediction; |
|
341 if (diff > max_pending_card_num) { |
|
342 prediction = max_pending_card_num; |
|
343 } else { |
|
344 prediction = max_pending_card_num - diff; |
|
345 } |
|
346 |
|
347 return prediction; |
|
348 } |
324 } |
349 |
325 |
350 size_t predict_rs_length_diff() { |
326 size_t predict_rs_length_diff() { |
351 return (size_t) get_new_prediction(_rs_length_diff_seq); |
327 return (size_t) get_new_prediction(_rs_length_diff_seq); |
352 } |
328 } |
437 |
413 |
438 double predict_base_elapsed_time_ms(size_t pending_cards); |
414 double predict_base_elapsed_time_ms(size_t pending_cards); |
439 double predict_base_elapsed_time_ms(size_t pending_cards, |
415 double predict_base_elapsed_time_ms(size_t pending_cards, |
440 size_t scanned_cards); |
416 size_t scanned_cards); |
441 size_t predict_bytes_to_copy(HeapRegion* hr); |
417 size_t predict_bytes_to_copy(HeapRegion* hr); |
442 double predict_region_elapsed_time_ms(HeapRegion* hr, bool young); |
418 double predict_region_elapsed_time_ms(HeapRegion* hr, bool for_young_gc); |
443 |
419 |
444 void set_recorded_rs_lengths(size_t rs_lengths); |
420 void set_recorded_rs_lengths(size_t rs_lengths); |
445 |
421 |
446 uint cset_region_length() { return young_cset_region_length() + |
422 uint cset_region_length() { return young_cset_region_length() + |
447 old_cset_region_length(); } |
423 old_cset_region_length(); } |
493 double accum_yg_surv_rate_pred(int age) { |
469 double accum_yg_surv_rate_pred(int age) { |
494 return _short_lived_surv_rate_group->accum_surv_rate_pred(age); |
470 return _short_lived_surv_rate_group->accum_surv_rate_pred(age); |
495 } |
471 } |
496 |
472 |
497 private: |
473 private: |
498 size_t _bytes_in_collection_set_before_gc; |
|
499 size_t _bytes_copied_during_gc; |
|
500 |
|
501 // Used to count used bytes in CS. |
|
502 friend class CountCSClosure; |
|
503 |
|
504 // Statistics kept per GC stoppage, pause or full. |
474 // Statistics kept per GC stoppage, pause or full. |
505 TruncatedSeq* _recent_prev_end_times_for_all_gcs_sec; |
475 TruncatedSeq* _recent_prev_end_times_for_all_gcs_sec; |
506 |
476 |
507 // Add a new GC of the given duration and end time to the record. |
477 // Add a new GC of the given duration and end time to the record. |
508 void update_recent_gc_times(double end_time_sec, double elapsed_ms); |
478 void update_recent_gc_times(double end_time_sec, double elapsed_ms); |
512 // set at the start of the pause. |
482 // set at the start of the pause. |
513 HeapRegion* _collection_set; |
483 HeapRegion* _collection_set; |
514 |
484 |
515 // The number of bytes in the collection set before the pause. Set from |
485 // The number of bytes in the collection set before the pause. Set from |
516 // the incrementally built collection set at the start of an evacuation |
486 // the incrementally built collection set at the start of an evacuation |
517 // pause. |
487 // pause, and incremented in finalize_cset() when adding old regions |
|
488 // (if any) to the collection set. |
518 size_t _collection_set_bytes_used_before; |
489 size_t _collection_set_bytes_used_before; |
|
490 |
|
491 // The number of bytes copied during the GC. |
|
492 size_t _bytes_copied_during_gc; |
519 |
493 |
520 // The associated information that is maintained while the incremental |
494 // The associated information that is maintained while the incremental |
521 // collection set is being built with young regions. Used to populate |
495 // collection set is being built with young regions. Used to populate |
522 // the recorded info for the evacuation pause. |
496 // the recorded info for the evacuation pause. |
523 |
497 |
644 // given free space (expressed by base_free_regions). It is used by |
618 // given free space (expressed by base_free_regions). It is used by |
645 // calculate_young_list_target_length(). |
619 // calculate_young_list_target_length(). |
646 bool predict_will_fit(uint young_length, double base_time_ms, |
620 bool predict_will_fit(uint young_length, double base_time_ms, |
647 uint base_free_regions, double target_pause_time_ms); |
621 uint base_free_regions, double target_pause_time_ms); |
648 |
622 |
649 // Count the number of bytes used in the CS. |
|
650 void count_CS_bytes_used(); |
|
651 |
|
652 public: |
623 public: |
653 |
624 |
654 G1CollectorPolicy(); |
625 G1CollectorPolicy(); |
655 |
626 |
656 virtual G1CollectorPolicy* as_g1_policy() { return this; } |
627 virtual G1CollectorPolicy* as_g1_policy() { return this; } |
663 |
634 |
664 // Check the current value of the young list RSet lengths and |
635 // Check the current value of the young list RSet lengths and |
665 // compare it against the last prediction. If the current value is |
636 // compare it against the last prediction. If the current value is |
666 // higher, recalculate the young list target length prediction. |
637 // higher, recalculate the young list target length prediction. |
667 void revise_young_list_target_length_if_necessary(); |
638 void revise_young_list_target_length_if_necessary(); |
668 |
|
669 size_t bytes_in_collection_set() { |
|
670 return _bytes_in_collection_set_before_gc; |
|
671 } |
|
672 |
639 |
673 // This should be called after the heap is resized. |
640 // This should be called after the heap is resized. |
674 void record_new_heap_size(uint new_number_of_regions); |
641 void record_new_heap_size(uint new_number_of_regions); |
675 |
642 |
676 void init(); |
643 void init(); |