comparison src/share/vm/gc_implementation/shared/adaptiveSizePolicy.hpp @ 14909:4ca6dc0799b6

Backout jdk9 merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 01 Apr 2014 13:57:07 +0200
parents 63a4eb8bcd23
children
comparison
equal deleted inserted replaced
14908:8db6e76cb658 14909:4ca6dc0799b6
72 decrease_old_gen_for_footprint_true = 7, 72 decrease_old_gen_for_footprint_true = 7,
73 decide_at_full_gc_true = 8 73 decide_at_full_gc_true = 8
74 }; 74 };
75 75
76 // Goal for the fraction of the total time during which application 76 // Goal for the fraction of the total time during which application
77 // threads run 77 // threads run.
78 const double _throughput_goal; 78 const double _throughput_goal;
79 79
80 // Last calculated sizes, in bytes, and aligned 80 // Last calculated sizes, in bytes, and aligned
81 size_t _eden_size; // calculated eden free space in bytes 81 size_t _eden_size; // calculated eden free space in bytes
82 size_t _promo_size; // calculated cms gen free space in bytes 82 size_t _promo_size; // calculated cms gen free space in bytes
83 83
84 size_t _survivor_size; // calculated survivor size in bytes 84 size_t _survivor_size; // calculated survivor size in bytes
85 85
86 // This is a hint for the heap: we've detected that GC times 86 // This is a hint for the heap: we've detected that gc times
87 // are taking longer than GCTimeLimit allows. 87 // are taking longer than GCTimeLimit allows.
88 bool _gc_overhead_limit_exceeded; 88 bool _gc_overhead_limit_exceeded;
89 // Use for diagnostics only. If UseGCOverheadLimit is false, 89 // Use for diagnostics only. If UseGCOverheadLimit is false,
90 // this variable is still set. 90 // this variable is still set.
91 bool _print_gc_overhead_limit_would_be_exceeded; 91 bool _print_gc_overhead_limit_would_be_exceeded;
92 // Count of consecutive GC that have exceeded the 92 // Count of consecutive GC that have exceeded the
93 // GC time limit criterion 93 // GC time limit criterion.
94 uint _gc_overhead_limit_count; 94 uint _gc_overhead_limit_count;
95 // This flag signals that GCTimeLimit is being exceeded 95 // This flag signals that GCTimeLimit is being exceeded
96 // but may not have done so for the required number of consecutive 96 // but may not have done so for the required number of consequetive
97 // collections 97 // collections.
98 98
99 // Minor collection timers used to determine both 99 // Minor collection timers used to determine both
100 // pause and interval times for collections 100 // pause and interval times for collections.
101 static elapsedTimer _minor_timer; 101 static elapsedTimer _minor_timer;
102 102
103 // Major collection timers, used to determine both 103 // Major collection timers, used to determine both
104 // pause and interval times for collections 104 // pause and interval times for collections
105 static elapsedTimer _major_timer; 105 static elapsedTimer _major_timer;
118 AdaptiveWeightedAverage* _avg_old_live; 118 AdaptiveWeightedAverage* _avg_old_live;
119 119
120 // Statistics for survivor space calculation for young generation 120 // Statistics for survivor space calculation for young generation
121 AdaptivePaddedAverage* _avg_survived; 121 AdaptivePaddedAverage* _avg_survived;
122 122
123 // Objects that have been directly allocated in the old generation 123 // Objects that have been directly allocated in the old generation.
124 AdaptivePaddedNoZeroDevAverage* _avg_pretenured; 124 AdaptivePaddedNoZeroDevAverage* _avg_pretenured;
125 125
126 // Variable for estimating the major and minor pause times. 126 // Variable for estimating the major and minor pause times.
127 // These variables represent linear least-squares fits of 127 // These variables represent linear least-squares fits of
128 // the data. 128 // the data.
140 // These record the most recent collection times. They 140 // These record the most recent collection times. They
141 // are available as an alternative to using the averages 141 // are available as an alternative to using the averages
142 // for making ergonomic decisions. 142 // for making ergonomic decisions.
143 double _latest_minor_mutator_interval_seconds; 143 double _latest_minor_mutator_interval_seconds;
144 144
145 // Allowed difference between major and minor GC times, used 145 // Allowed difference between major and minor gc times, used
146 // for computing tenuring_threshold 146 // for computing tenuring_threshold.
147 const double _threshold_tolerance_percent; 147 const double _threshold_tolerance_percent;
148 148
149 const double _gc_pause_goal_sec; // Goal for maximum GC pause 149 const double _gc_pause_goal_sec; // goal for maximum gc pause
150 150
151 // Flag indicating that the adaptive policy is ready to use 151 // Flag indicating that the adaptive policy is ready to use
152 bool _young_gen_policy_is_ready; 152 bool _young_gen_policy_is_ready;
153 153
154 // Decrease/increase the young generation for minor pause time 154 // decrease/increase the young generation for minor pause time
155 int _change_young_gen_for_min_pauses; 155 int _change_young_gen_for_min_pauses;
156 156
157 // Decrease/increase the old generation for major pause time 157 // decrease/increase the old generation for major pause time
158 int _change_old_gen_for_maj_pauses; 158 int _change_old_gen_for_maj_pauses;
159 159
160 // change old generation for throughput 160 // change old geneneration for throughput
161 int _change_old_gen_for_throughput; 161 int _change_old_gen_for_throughput;
162 162
163 // change young generation for throughput 163 // change young generation for throughput
164 int _change_young_gen_for_throughput; 164 int _change_young_gen_for_throughput;
165 165
166 // Flag indicating that the policy would 166 // Flag indicating that the policy would
167 // increase the tenuring threshold because of the total major GC cost 167 // increase the tenuring threshold because of the total major gc cost
168 // is greater than the total minor GC cost 168 // is greater than the total minor gc cost
169 bool _increment_tenuring_threshold_for_gc_cost; 169 bool _increment_tenuring_threshold_for_gc_cost;
170 // decrease the tenuring threshold because of the the total minor GC 170 // decrease the tenuring threshold because of the the total minor gc
171 // cost is greater than the total major GC cost 171 // cost is greater than the total major gc cost
172 bool _decrement_tenuring_threshold_for_gc_cost; 172 bool _decrement_tenuring_threshold_for_gc_cost;
173 // decrease due to survivor size limit 173 // decrease due to survivor size limit
174 bool _decrement_tenuring_threshold_for_survivor_limit; 174 bool _decrement_tenuring_threshold_for_survivor_limit;
175 175
176 // decrease generation sizes for footprint 176 // decrease generation sizes for footprint
180 int _decide_at_full_gc; 180 int _decide_at_full_gc;
181 181
182 // Changing the generation sizing depends on the data that is 182 // Changing the generation sizing depends on the data that is
183 // gathered about the effects of changes on the pause times and 183 // gathered about the effects of changes on the pause times and
184 // throughput. These variable count the number of data points 184 // throughput. These variable count the number of data points
185 // gathered. The policy may use these counters as a threshold 185 // gathered. The policy may use these counters as a threshhold
186 // for reliable data. 186 // for reliable data.
187 julong _young_gen_change_for_minor_throughput; 187 julong _young_gen_change_for_minor_throughput;
188 julong _old_gen_change_for_major_throughput; 188 julong _old_gen_change_for_major_throughput;
189 189
190 static const uint GCWorkersPerJavaThread = 2; 190 static const uint GCWorkersPerJavaThread = 2;
223 223
224 // Because we're dealing with averages, gc_cost() can be 224 // Because we're dealing with averages, gc_cost() can be
225 // larger than 1.0 if just the sum of the minor cost the 225 // larger than 1.0 if just the sum of the minor cost the
226 // the major cost is used. Worse than that is the 226 // the major cost is used. Worse than that is the
227 // fact that the minor cost and the major cost each 227 // fact that the minor cost and the major cost each
228 // tend toward 1.0 in the extreme of high GC costs. 228 // tend toward 1.0 in the extreme of high gc costs.
229 // Limit the value of gc_cost to 1.0 so that the mutator 229 // Limit the value of gc_cost to 1.0 so that the mutator
230 // cost stays non-negative. 230 // cost stays non-negative.
231 virtual double gc_cost() const { 231 virtual double gc_cost() const {
232 double result = MIN2(1.0, minor_gc_cost() + major_gc_cost()); 232 double result = MIN2(1.0, minor_gc_cost() + major_gc_cost());
233 assert(result >= 0.0, "Both minor and major costs are non-negative"); 233 assert(result >= 0.0, "Both minor and major costs are non-negative");
236 236
237 // Elapsed time since the last major collection. 237 // Elapsed time since the last major collection.
238 virtual double time_since_major_gc() const; 238 virtual double time_since_major_gc() const;
239 239
240 // Average interval between major collections to be used 240 // Average interval between major collections to be used
241 // in calculating the decaying major GC cost. An overestimate 241 // in calculating the decaying major gc cost. An overestimate
242 // of this time would be a conservative estimate because 242 // of this time would be a conservative estimate because
243 // this time is used to decide if the major GC cost 243 // this time is used to decide if the major GC cost
244 // should be decayed (i.e., if the time since the last 244 // should be decayed (i.e., if the time since the last
245 // major GC is long compared to the time returned here, 245 // major gc is long compared to the time returned here,
246 // then the major GC cost will be decayed). See the 246 // then the major GC cost will be decayed). See the
247 // implementations for the specifics. 247 // implementations for the specifics.
248 virtual double major_gc_interval_average_for_decay() const { 248 virtual double major_gc_interval_average_for_decay() const {
249 return _avg_major_interval->average(); 249 return _avg_major_interval->average();
250 } 250 }
251 251
252 // Return the cost of the GC where the major GC cost 252 // Return the cost of the GC where the major gc cost
253 // has been decayed based on the time since the last 253 // has been decayed based on the time since the last
254 // major collection. 254 // major collection.
255 double decaying_gc_cost() const; 255 double decaying_gc_cost() const;
256 256
257 // Decay the major GC cost. Use this only for decisions on 257 // Decay the major gc cost. Use this only for decisions on
258 // whether to adjust, not to determine by how much to adjust. 258 // whether to adjust, not to determine by how much to adjust.
259 // This approximation is crude and may not be good enough for the 259 // This approximation is crude and may not be good enough for the
260 // latter. 260 // latter.
261 double decaying_major_gc_cost() const; 261 double decaying_major_gc_cost() const;
262 262