89 size_t get_conc_mark_start_threshold() { return (size_t) (_initial_ihop_percent * _target_occupancy / 100.0); }
90
91 virtual void update_marking_length(double marking_length_s) {
92 assert(marking_length_s > 0.0, "Marking length must be larger than zero but is %.3f", marking_length_s);
93 _last_marking_length_s = marking_length_s;
94 }
95
96 #ifndef PRODUCT
97 static void test();
98 #endif
99 };
100
101 // This algorithm tries to return a concurrent mark starting occupancy value that
102 // makes sure that during marking the given target occupancy is never exceeded,
103 // based on predictions of current allocation rate and time periods between
104 // initial mark and the first mixed gc.
105 class G1AdaptiveIHOPControl : public G1IHOPControl {
106 size_t _heap_reserve_percent; // Percentage of maximum heap capacity we should avoid to touch
107 size_t _heap_waste_percent; // Percentage of free heap that should be considered as waste.
108
109 G1Predictions const * _predictor;
110
111 TruncatedSeq _marking_times_s;
112 TruncatedSeq _allocation_rate_s;
113
114 size_t _last_allocation_bytes; // Most recent mutator allocation since last GC.
115 // The most recent unrestrained size of the young gen. This is used as an additional
116 // factor in the calculation of the threshold, as the threshold is based on
117 // non-young gen occupancy at the end of GC. For the IHOP threshold, we need to
118 // consider the young gen size during that time too.
119 // Since we cannot know what young gen sizes are used in the future, we will just
120 // use the current one. We expect that this one will be one with a fairly large size,
121 // as there is no marking or mixed gc that could impact its size too much.
122 size_t _last_unrestrained_young_size;
123
124 bool have_enough_data_for_prediction() const;
125
126 // The "actual" target threshold the algorithm wants to keep during and at the
127 // end of marking. This is typically lower than the requested threshold, as the
128 // algorithm needs to consider restrictions by the environment.
129 size_t actual_target_threshold() const;
130 protected:
131 virtual double last_marking_length_s() const { return _marking_times_s.last(); }
132 public:
133 G1AdaptiveIHOPControl(double ihop_percent,
134 size_t initial_target_occupancy,
135 G1Predictions const* predictor,
136 size_t heap_reserve_percent, // The percentage of total heap capacity that should not be tapped into.
137 size_t heap_waste_percent); // The percentage of the free space in the heap that we think is not usable for allocation.
138
139 virtual void set_target_occupancy(size_t target_occupancy);
140
141 virtual size_t get_conc_mark_start_threshold();
142
143 virtual void update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size);
144 virtual void update_marking_length(double marking_length_s);
145
146 virtual void print();
147 #ifndef PRODUCT
148 static void test();
149 #endif
150 };
151
152 #endif // SHARE_VM_GC_G1_G1IHOPCONTROL_HPP
|
89 size_t get_conc_mark_start_threshold() { return (size_t) (_initial_ihop_percent * _target_occupancy / 100.0); }
90
91 virtual void update_marking_length(double marking_length_s) {
92 assert(marking_length_s > 0.0, "Marking length must be larger than zero but is %.3f", marking_length_s);
93 _last_marking_length_s = marking_length_s;
94 }
95
96 #ifndef PRODUCT
97 static void test();
98 #endif
99 };
100
101 // This algorithm tries to return a concurrent mark starting occupancy value that
102 // makes sure that during marking the given target occupancy is never exceeded,
103 // based on predictions of current allocation rate and time periods between
104 // initial mark and the first mixed gc.
105 class G1AdaptiveIHOPControl : public G1IHOPControl {
106 size_t _heap_reserve_percent; // Percentage of maximum heap capacity we should avoid to touch
107 size_t _heap_waste_percent; // Percentage of free heap that should be considered as waste.
108
109 const G1Predictions * _predictor;
110
111 TruncatedSeq _marking_times_s;
112 TruncatedSeq _allocation_rate_s;
113
114 size_t _last_allocation_bytes; // Most recent mutator allocation since last GC.
115 // The most recent unrestrained size of the young gen. This is used as an additional
116 // factor in the calculation of the threshold, as the threshold is based on
117 // non-young gen occupancy at the end of GC. For the IHOP threshold, we need to
118 // consider the young gen size during that time too.
119 // Since we cannot know what young gen sizes are used in the future, we will just
120 // use the current one. We expect that this one will be one with a fairly large size,
121 // as there is no marking or mixed gc that could impact its size too much.
122 size_t _last_unrestrained_young_size;
123
124 bool have_enough_data_for_prediction() const;
125
126 // The "actual" target threshold the algorithm wants to keep during and at the
127 // end of marking. This is typically lower than the requested threshold, as the
128 // algorithm needs to consider restrictions by the environment.
129 size_t actual_target_threshold() const;
130 protected:
131 virtual double last_marking_length_s() const { return _marking_times_s.last(); }
132 public:
133 G1AdaptiveIHOPControl(double ihop_percent,
134 size_t initial_target_occupancy,
135 G1Predictions const* predictor,
136 size_t heap_reserve_percent, // The percentage of total heap capacity that should not be tapped into.
137 size_t heap_waste_percent); // The percentage of the free space in the heap that we think is not usable for allocation.
138
139 virtual size_t get_conc_mark_start_threshold();
140
141 virtual void update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size);
142 virtual void update_marking_length(double marking_length_s);
143
144 virtual void print();
145 #ifndef PRODUCT
146 static void test();
147 #endif
148 };
149
150 #endif // SHARE_VM_GC_G1_G1IHOPCONTROL_HPP
|