139 uint calculate_default_min_length(uint new_number_of_heap_regions);
140 uint calculate_default_max_length(uint new_number_of_heap_regions);
141
142 // Update the given values for minimum and maximum young gen length in regions
143 // given the number of heap regions depending on the kind of sizing algorithm.
144 void recalculate_min_max_young_length(uint number_of_heap_regions, uint* min_young_length, uint* max_young_length);
145
146 public:
147 G1YoungGenSizer();
148 // Calculate the maximum length of the young gen given the number of regions
149 // depending on the sizing algorithm.
150 uint max_young_length(uint number_of_heap_regions);
151
152 void heap_size_changed(uint new_number_of_heap_regions);
153 uint min_desired_young_length() {
154 return _min_desired_young_length;
155 }
156 uint max_desired_young_length() {
157 return _max_desired_young_length;
158 }
159 bool adaptive_young_list_length() const {
160 return _adaptive_size;
161 }
162 };
163
164 class G1CollectorPolicy: public CollectorPolicy {
165 private:
166 G1Predictions _predictor;
167
168 double get_new_prediction(TruncatedSeq const* seq) const;
169
170 // either equal to the number of parallel threads, if ParallelGCThreads
171 // has been set, or 1 otherwise
172 int _parallel_gc_threads;
173
174 // The number of GC threads currently active.
175 uintx _no_of_gc_threads;
176
177 G1MMUTracker* _mmu_tracker;
178
583 void record_full_collection_end();
584
585 // Must currently be called while the world is stopped.
586 void record_concurrent_mark_init_end(double mark_init_elapsed_time_ms);
587
588 // Record start and end of remark.
589 void record_concurrent_mark_remark_start();
590 void record_concurrent_mark_remark_end();
591
592 // Record start, end, and completion of cleanup.
593 void record_concurrent_mark_cleanup_start();
594 void record_concurrent_mark_cleanup_end();
595 void record_concurrent_mark_cleanup_completed();
596
597 // Records the information about the heap size for reporting in
598 // print_detailed_heap_transition
599 void record_heap_size_info_at_start(bool full);
600
601 // Print heap sizing transition (with less and more detail).
602
603 void print_heap_transition(size_t bytes_before) const;
604 void print_heap_transition() const;
605 void print_detailed_heap_transition(bool full = false) const;
606
607 virtual void print_phases(double pause_time_sec);
608
609 void record_stop_world_start();
610 void record_concurrent_pause();
611
612 // Record how much space we copied during a GC. This is typically
613 // called when a GC alloc region is being retired.
614 void record_bytes_copied_during_gc(size_t bytes) {
615 _bytes_copied_during_gc += bytes;
616 }
617
618 // The amount of space we copied during a GC.
619 size_t bytes_copied_during_gc() const {
620 return _bytes_copied_during_gc;
621 }
622
623 size_t collection_set_bytes_used_before() const {
624 return _collection_set_bytes_used_before;
625 }
740 }
741
742 private:
743 //
744 // Survivor regions policy.
745 //
746
747 // Current tenuring threshold, set to 0 if the collector reaches the
748 // maximum amount of survivors regions.
749 uint _tenuring_threshold;
750
751 // The limit on the number of regions allocated for survivors.
752 uint _max_survivor_regions;
753
754 // For reporting purposes.
755 // The value of _heap_bytes_before_gc is also used to calculate
756 // the cost of copying.
757
758 size_t _eden_used_bytes_before_gc; // Eden occupancy before GC
759 size_t _survivor_used_bytes_before_gc; // Survivor occupancy before GC
760 size_t _heap_used_bytes_before_gc; // Heap occupancy before GC
761 size_t _metaspace_used_bytes_before_gc; // Metaspace occupancy before GC
762
763 size_t _eden_capacity_bytes_before_gc; // Eden capacity before GC
764 size_t _heap_capacity_bytes_before_gc; // Heap capacity before GC
765
766 // The amount of survivor regions after a collection.
767 uint _recorded_survivor_regions;
768 // List of survivor regions.
769 HeapRegion* _recorded_survivor_head;
770 HeapRegion* _recorded_survivor_tail;
771
772 ageTable _survivors_age_table;
773
774 public:
775 uint tenuring_threshold() const { return _tenuring_threshold; }
776
777 static const uint REGIONS_UNLIMITED = (uint) -1;
778
779 uint max_regions(InCSetState dest) const {
|
139 uint calculate_default_min_length(uint new_number_of_heap_regions);
140 uint calculate_default_max_length(uint new_number_of_heap_regions);
141
142 // Update the given values for minimum and maximum young gen length in regions
143 // given the number of heap regions depending on the kind of sizing algorithm.
144 void recalculate_min_max_young_length(uint number_of_heap_regions, uint* min_young_length, uint* max_young_length);
145
146 public:
147 G1YoungGenSizer();
148 // Calculate the maximum length of the young gen given the number of regions
149 // depending on the sizing algorithm.
150 uint max_young_length(uint number_of_heap_regions);
151
152 void heap_size_changed(uint new_number_of_heap_regions);
153 uint min_desired_young_length() {
154 return _min_desired_young_length;
155 }
156 uint max_desired_young_length() {
157 return _max_desired_young_length;
158 }
159
160 bool adaptive_young_list_length() const {
161 return _adaptive_size;
162 }
163 };
164
165 class G1CollectorPolicy: public CollectorPolicy {
166 private:
167 G1Predictions _predictor;
168
169 double get_new_prediction(TruncatedSeq const* seq) const;
170
171 // either equal to the number of parallel threads, if ParallelGCThreads
172 // has been set, or 1 otherwise
173 int _parallel_gc_threads;
174
175 // The number of GC threads currently active.
176 uintx _no_of_gc_threads;
177
178 G1MMUTracker* _mmu_tracker;
179
584 void record_full_collection_end();
585
586 // Must currently be called while the world is stopped.
587 void record_concurrent_mark_init_end(double mark_init_elapsed_time_ms);
588
589 // Record start and end of remark.
590 void record_concurrent_mark_remark_start();
591 void record_concurrent_mark_remark_end();
592
593 // Record start, end, and completion of cleanup.
594 void record_concurrent_mark_cleanup_start();
595 void record_concurrent_mark_cleanup_end();
596 void record_concurrent_mark_cleanup_completed();
597
598 // Records the information about the heap size for reporting in
599 // print_detailed_heap_transition
600 void record_heap_size_info_at_start(bool full);
601
602 // Print heap sizing transition (with less and more detail).
603
604 void print_detailed_heap_transition() const;
605
606 virtual void print_phases(double pause_time_sec);
607
608 void record_stop_world_start();
609 void record_concurrent_pause();
610
611 // Record how much space we copied during a GC. This is typically
612 // called when a GC alloc region is being retired.
613 void record_bytes_copied_during_gc(size_t bytes) {
614 _bytes_copied_during_gc += bytes;
615 }
616
617 // The amount of space we copied during a GC.
618 size_t bytes_copied_during_gc() const {
619 return _bytes_copied_during_gc;
620 }
621
622 size_t collection_set_bytes_used_before() const {
623 return _collection_set_bytes_used_before;
624 }
739 }
740
741 private:
742 //
743 // Survivor regions policy.
744 //
745
746 // Current tenuring threshold, set to 0 if the collector reaches the
747 // maximum amount of survivors regions.
748 uint _tenuring_threshold;
749
750 // The limit on the number of regions allocated for survivors.
751 uint _max_survivor_regions;
752
753 // For reporting purposes.
754 // The value of _heap_bytes_before_gc is also used to calculate
755 // the cost of copying.
756
757 size_t _eden_used_bytes_before_gc; // Eden occupancy before GC
758 size_t _survivor_used_bytes_before_gc; // Survivor occupancy before GC
759 size_t _old_used_bytes_before_gc; // Old occupancy before GC
760 size_t _heap_used_bytes_before_gc; // Heap occupancy before GC
761 size_t _metaspace_used_bytes_before_gc; // Metaspace occupancy before GC
762
763 size_t _eden_capacity_bytes_before_gc; // Eden capacity before GC
764 size_t _heap_capacity_bytes_before_gc; // Heap capacity before GC
765
766 // The amount of survivor regions after a collection.
767 uint _recorded_survivor_regions;
768 // List of survivor regions.
769 HeapRegion* _recorded_survivor_head;
770 HeapRegion* _recorded_survivor_tail;
771
772 ageTable _survivors_age_table;
773
774 public:
775 uint tenuring_threshold() const { return _tenuring_threshold; }
776
777 static const uint REGIONS_UNLIMITED = (uint) -1;
778
779 uint max_regions(InCSetState dest) const {
|