Wed, 23 Sep 2009 23:56:15 -0700
Merge
duke@435 | 1 | /* |
duke@435 | 2 | * Copyright 2004-2006 Sun Microsystems, Inc. All Rights Reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
duke@435 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | * have any questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | // This class keeps statistical information and computes the |
duke@435 | 26 | // size of the heap for the concurrent mark sweep collector. |
duke@435 | 27 | // |
duke@435 | 28 | // Cost for garbage collector include cost for |
duke@435 | 29 | // minor collection |
duke@435 | 30 | // concurrent collection |
duke@435 | 31 | // stop-the-world component |
duke@435 | 32 | // concurrent component |
duke@435 | 33 | // major compacting collection |
duke@435 | 34 | // uses decaying cost |
duke@435 | 35 | |
duke@435 | 36 | // Forward decls |
duke@435 | 37 | class elapsedTimer; |
duke@435 | 38 | |
duke@435 | 39 | class CMSAdaptiveSizePolicy : public AdaptiveSizePolicy { |
duke@435 | 40 | friend class CMSGCAdaptivePolicyCounters; |
duke@435 | 41 | friend class CMSCollector; |
duke@435 | 42 | private: |
duke@435 | 43 | |
duke@435 | 44 | // Total number of processors available |
duke@435 | 45 | int _processor_count; |
duke@435 | 46 | // Number of processors used by the concurrent phases of GC |
duke@435 | 47 | // This number is assumed to be the same for all concurrent |
duke@435 | 48 | // phases. |
duke@435 | 49 | int _concurrent_processor_count; |
duke@435 | 50 | |
duke@435 | 51 | // Time that the mutators run exclusive of a particular |
duke@435 | 52 | // phase. For example, the time the mutators run excluding |
duke@435 | 53 | // the time during which the cms collector runs concurrently |
duke@435 | 54 | // with the mutators. |
duke@435 | 55 | // Between end of most recent cms reset and start of initial mark |
duke@435 | 56 | // This may be redundant |
duke@435 | 57 | double _latest_cms_reset_end_to_initial_mark_start_secs; |
duke@435 | 58 | // Between end of the most recent initial mark and start of remark |
duke@435 | 59 | double _latest_cms_initial_mark_end_to_remark_start_secs; |
duke@435 | 60 | // Between end of most recent collection and start of |
duke@435 | 61 | // a concurrent collection |
duke@435 | 62 | double _latest_cms_collection_end_to_collection_start_secs; |
duke@435 | 63 | // Times of the concurrent phases of the most recent |
duke@435 | 64 | // concurrent collection |
duke@435 | 65 | double _latest_cms_concurrent_marking_time_secs; |
duke@435 | 66 | double _latest_cms_concurrent_precleaning_time_secs; |
duke@435 | 67 | double _latest_cms_concurrent_sweeping_time_secs; |
duke@435 | 68 | // Between end of most recent STW MSC and start of next STW MSC |
duke@435 | 69 | double _latest_cms_msc_end_to_msc_start_time_secs; |
duke@435 | 70 | // Between end of most recent MS and start of next MS |
duke@435 | 71 | // This does not include any time spent during a concurrent |
duke@435 | 72 | // collection. |
duke@435 | 73 | double _latest_cms_ms_end_to_ms_start; |
duke@435 | 74 | // Between start and end of the initial mark of the most recent |
duke@435 | 75 | // concurrent collection. |
duke@435 | 76 | double _latest_cms_initial_mark_start_to_end_time_secs; |
duke@435 | 77 | // Between start and end of the remark phase of the most recent |
duke@435 | 78 | // concurrent collection |
duke@435 | 79 | double _latest_cms_remark_start_to_end_time_secs; |
duke@435 | 80 | // Between start and end of the most recent MS STW marking phase |
duke@435 | 81 | double _latest_cms_ms_marking_start_to_end_time_secs; |
duke@435 | 82 | |
duke@435 | 83 | // Pause time timers |
duke@435 | 84 | static elapsedTimer _STW_timer; |
duke@435 | 85 | // Concurrent collection timer. Used for total of all concurrent phases |
duke@435 | 86 | // during 1 collection cycle. |
duke@435 | 87 | static elapsedTimer _concurrent_timer; |
duke@435 | 88 | |
duke@435 | 89 | // When the size of the generation is changed, the size |
duke@435 | 90 | // of the change will rounded up or down (depending on the |
duke@435 | 91 | // type of change) by this value. |
duke@435 | 92 | size_t _generation_alignment; |
duke@435 | 93 | |
duke@435 | 94 | // If this variable is true, the size of the young generation |
duke@435 | 95 | // may be changed in order to reduce the pause(s) of the |
duke@435 | 96 | // collection of the tenured generation in order to meet the |
duke@435 | 97 | // pause time goal. It is common to change the size of the |
duke@435 | 98 | // tenured generation in order to meet the pause time goal |
duke@435 | 99 | // for the tenured generation. With the CMS collector for |
duke@435 | 100 | // the tenured generation, the size of the young generation |
duke@435 | 101 | // can have an significant affect on the pause times for collecting the |
duke@435 | 102 | // tenured generation. |
duke@435 | 103 | // This is a duplicate of a variable in PSAdaptiveSizePolicy. It |
duke@435 | 104 | // is duplicated because it is not clear that it is general enough |
duke@435 | 105 | // to go into AdaptiveSizePolicy. |
duke@435 | 106 | int _change_young_gen_for_maj_pauses; |
duke@435 | 107 | |
duke@435 | 108 | // Variable that is set to true after a collection. |
duke@435 | 109 | bool _first_after_collection; |
duke@435 | 110 | |
duke@435 | 111 | // Fraction of collections that are of each type |
duke@435 | 112 | double concurrent_fraction() const; |
duke@435 | 113 | double STW_msc_fraction() const; |
duke@435 | 114 | double STW_ms_fraction() const; |
duke@435 | 115 | |
duke@435 | 116 | // This call cannot be put into the epilogue as long as some |
duke@435 | 117 | // of the counters can be set during concurrent phases. |
duke@435 | 118 | virtual void clear_generation_free_space_flags(); |
duke@435 | 119 | |
duke@435 | 120 | void set_first_after_collection() { _first_after_collection = true; } |
duke@435 | 121 | |
duke@435 | 122 | protected: |
duke@435 | 123 | // Average of the sum of the concurrent times for |
duke@435 | 124 | // one collection in seconds. |
duke@435 | 125 | AdaptiveWeightedAverage* _avg_concurrent_time; |
duke@435 | 126 | // Average time between concurrent collections in seconds. |
duke@435 | 127 | AdaptiveWeightedAverage* _avg_concurrent_interval; |
duke@435 | 128 | // Average cost of the concurrent part of a collection |
duke@435 | 129 | // in seconds. |
duke@435 | 130 | AdaptiveWeightedAverage* _avg_concurrent_gc_cost; |
duke@435 | 131 | |
duke@435 | 132 | // Average of the initial pause of a concurrent collection in seconds. |
duke@435 | 133 | AdaptivePaddedAverage* _avg_initial_pause; |
duke@435 | 134 | // Average of the remark pause of a concurrent collection in seconds. |
duke@435 | 135 | AdaptivePaddedAverage* _avg_remark_pause; |
duke@435 | 136 | |
duke@435 | 137 | // Average of the stop-the-world (STW) (initial mark + remark) |
duke@435 | 138 | // times in seconds for concurrent collections. |
duke@435 | 139 | AdaptiveWeightedAverage* _avg_cms_STW_time; |
duke@435 | 140 | // Average of the STW collection cost for concurrent collections. |
duke@435 | 141 | AdaptiveWeightedAverage* _avg_cms_STW_gc_cost; |
duke@435 | 142 | |
duke@435 | 143 | // Average of the bytes free at the start of the sweep. |
duke@435 | 144 | AdaptiveWeightedAverage* _avg_cms_free_at_sweep; |
duke@435 | 145 | // Average of the bytes free at the end of the collection. |
duke@435 | 146 | AdaptiveWeightedAverage* _avg_cms_free; |
duke@435 | 147 | // Average of the bytes promoted between cms collections. |
duke@435 | 148 | AdaptiveWeightedAverage* _avg_cms_promo; |
duke@435 | 149 | |
duke@435 | 150 | // stop-the-world (STW) mark-sweep-compact |
duke@435 | 151 | // Average of the pause time in seconds for STW mark-sweep-compact |
duke@435 | 152 | // collections. |
duke@435 | 153 | AdaptiveWeightedAverage* _avg_msc_pause; |
duke@435 | 154 | // Average of the interval in seconds between STW mark-sweep-compact |
duke@435 | 155 | // collections. |
duke@435 | 156 | AdaptiveWeightedAverage* _avg_msc_interval; |
duke@435 | 157 | // Average of the collection costs for STW mark-sweep-compact |
duke@435 | 158 | // collections. |
duke@435 | 159 | AdaptiveWeightedAverage* _avg_msc_gc_cost; |
duke@435 | 160 | |
duke@435 | 161 | // Averages for mark-sweep collections. |
duke@435 | 162 | // The collection may have started as a background collection |
duke@435 | 163 | // that completes in a stop-the-world (STW) collection. |
duke@435 | 164 | // Average of the pause time in seconds for mark-sweep |
duke@435 | 165 | // collections. |
duke@435 | 166 | AdaptiveWeightedAverage* _avg_ms_pause; |
duke@435 | 167 | // Average of the interval in seconds between mark-sweep |
duke@435 | 168 | // collections. |
duke@435 | 169 | AdaptiveWeightedAverage* _avg_ms_interval; |
duke@435 | 170 | // Average of the collection costs for mark-sweep |
duke@435 | 171 | // collections. |
duke@435 | 172 | AdaptiveWeightedAverage* _avg_ms_gc_cost; |
duke@435 | 173 | |
duke@435 | 174 | // These variables contain a linear fit of |
duke@435 | 175 | // a generation size as the independent variable |
duke@435 | 176 | // and a pause time as the dependent variable. |
duke@435 | 177 | // For example _remark_pause_old_estimator |
duke@435 | 178 | // is a fit of the old generation size as the |
duke@435 | 179 | // independent variable and the remark pause |
duke@435 | 180 | // as the dependent variable. |
duke@435 | 181 | // remark pause time vs. cms gen size |
duke@435 | 182 | LinearLeastSquareFit* _remark_pause_old_estimator; |
duke@435 | 183 | // initial pause time vs. cms gen size |
duke@435 | 184 | LinearLeastSquareFit* _initial_pause_old_estimator; |
duke@435 | 185 | // remark pause time vs. young gen size |
duke@435 | 186 | LinearLeastSquareFit* _remark_pause_young_estimator; |
duke@435 | 187 | // initial pause time vs. young gen size |
duke@435 | 188 | LinearLeastSquareFit* _initial_pause_young_estimator; |
duke@435 | 189 | |
duke@435 | 190 | // Accessors |
duke@435 | 191 | int processor_count() const { return _processor_count; } |
duke@435 | 192 | int concurrent_processor_count() const { return _concurrent_processor_count; } |
duke@435 | 193 | |
duke@435 | 194 | AdaptiveWeightedAverage* avg_concurrent_time() const { |
duke@435 | 195 | return _avg_concurrent_time; |
duke@435 | 196 | } |
duke@435 | 197 | |
duke@435 | 198 | AdaptiveWeightedAverage* avg_concurrent_interval() const { |
duke@435 | 199 | return _avg_concurrent_interval; |
duke@435 | 200 | } |
duke@435 | 201 | |
duke@435 | 202 | AdaptiveWeightedAverage* avg_concurrent_gc_cost() const { |
duke@435 | 203 | return _avg_concurrent_gc_cost; |
duke@435 | 204 | } |
duke@435 | 205 | |
duke@435 | 206 | AdaptiveWeightedAverage* avg_cms_STW_time() const { |
duke@435 | 207 | return _avg_cms_STW_time; |
duke@435 | 208 | } |
duke@435 | 209 | |
duke@435 | 210 | AdaptiveWeightedAverage* avg_cms_STW_gc_cost() const { |
duke@435 | 211 | return _avg_cms_STW_gc_cost; |
duke@435 | 212 | } |
duke@435 | 213 | |
duke@435 | 214 | AdaptivePaddedAverage* avg_initial_pause() const { |
duke@435 | 215 | return _avg_initial_pause; |
duke@435 | 216 | } |
duke@435 | 217 | |
duke@435 | 218 | AdaptivePaddedAverage* avg_remark_pause() const { |
duke@435 | 219 | return _avg_remark_pause; |
duke@435 | 220 | } |
duke@435 | 221 | |
duke@435 | 222 | AdaptiveWeightedAverage* avg_cms_free() const { |
duke@435 | 223 | return _avg_cms_free; |
duke@435 | 224 | } |
duke@435 | 225 | |
duke@435 | 226 | AdaptiveWeightedAverage* avg_cms_free_at_sweep() const { |
duke@435 | 227 | return _avg_cms_free_at_sweep; |
duke@435 | 228 | } |
duke@435 | 229 | |
duke@435 | 230 | AdaptiveWeightedAverage* avg_msc_pause() const { |
duke@435 | 231 | return _avg_msc_pause; |
duke@435 | 232 | } |
duke@435 | 233 | |
duke@435 | 234 | AdaptiveWeightedAverage* avg_msc_interval() const { |
duke@435 | 235 | return _avg_msc_interval; |
duke@435 | 236 | } |
duke@435 | 237 | |
duke@435 | 238 | AdaptiveWeightedAverage* avg_msc_gc_cost() const { |
duke@435 | 239 | return _avg_msc_gc_cost; |
duke@435 | 240 | } |
duke@435 | 241 | |
duke@435 | 242 | AdaptiveWeightedAverage* avg_ms_pause() const { |
duke@435 | 243 | return _avg_ms_pause; |
duke@435 | 244 | } |
duke@435 | 245 | |
duke@435 | 246 | AdaptiveWeightedAverage* avg_ms_interval() const { |
duke@435 | 247 | return _avg_ms_interval; |
duke@435 | 248 | } |
duke@435 | 249 | |
duke@435 | 250 | AdaptiveWeightedAverage* avg_ms_gc_cost() const { |
duke@435 | 251 | return _avg_ms_gc_cost; |
duke@435 | 252 | } |
duke@435 | 253 | |
duke@435 | 254 | LinearLeastSquareFit* remark_pause_old_estimator() { |
duke@435 | 255 | return _remark_pause_old_estimator; |
duke@435 | 256 | } |
duke@435 | 257 | LinearLeastSquareFit* initial_pause_old_estimator() { |
duke@435 | 258 | return _initial_pause_old_estimator; |
duke@435 | 259 | } |
duke@435 | 260 | LinearLeastSquareFit* remark_pause_young_estimator() { |
duke@435 | 261 | return _remark_pause_young_estimator; |
duke@435 | 262 | } |
duke@435 | 263 | LinearLeastSquareFit* initial_pause_young_estimator() { |
duke@435 | 264 | return _initial_pause_young_estimator; |
duke@435 | 265 | } |
duke@435 | 266 | |
duke@435 | 267 | // These *slope() methods return the slope |
duke@435 | 268 | // m for the linear fit of an independent |
duke@435 | 269 | // variable vs. a dependent variable. For |
duke@435 | 270 | // example |
duke@435 | 271 | // remark_pause = m * old_generation_size + c |
duke@435 | 272 | // These may be used to determine if an |
duke@435 | 273 | // adjustment should be made to achieve a goal. |
duke@435 | 274 | // For example, if remark_pause_old_slope() is |
duke@435 | 275 | // positive, a reduction of the old generation |
duke@435 | 276 | // size has on average resulted in the reduction |
duke@435 | 277 | // of the remark pause. |
duke@435 | 278 | float remark_pause_old_slope() { |
duke@435 | 279 | return _remark_pause_old_estimator->slope(); |
duke@435 | 280 | } |
duke@435 | 281 | |
duke@435 | 282 | float initial_pause_old_slope() { |
duke@435 | 283 | return _initial_pause_old_estimator->slope(); |
duke@435 | 284 | } |
duke@435 | 285 | |
duke@435 | 286 | float remark_pause_young_slope() { |
duke@435 | 287 | return _remark_pause_young_estimator->slope(); |
duke@435 | 288 | } |
duke@435 | 289 | |
duke@435 | 290 | float initial_pause_young_slope() { |
duke@435 | 291 | return _initial_pause_young_estimator->slope(); |
duke@435 | 292 | } |
duke@435 | 293 | |
duke@435 | 294 | // Update estimators |
duke@435 | 295 | void update_minor_pause_old_estimator(double minor_pause_in_ms); |
duke@435 | 296 | |
duke@435 | 297 | // Fraction of processors used by the concurrent phases. |
duke@435 | 298 | double concurrent_processor_fraction(); |
duke@435 | 299 | |
duke@435 | 300 | // Returns the total times for the concurrent part of the |
duke@435 | 301 | // latest collection in seconds. |
duke@435 | 302 | double concurrent_collection_time(); |
duke@435 | 303 | |
duke@435 | 304 | // Return the total times for the concurrent part of the |
duke@435 | 305 | // latest collection in seconds where the times of the various |
duke@435 | 306 | // concurrent phases are scaled by the processor fraction used |
duke@435 | 307 | // during the phase. |
duke@435 | 308 | double scaled_concurrent_collection_time(); |
duke@435 | 309 | |
duke@435 | 310 | // Dimensionless concurrent GC cost for all the concurrent phases. |
duke@435 | 311 | double concurrent_collection_cost(double interval_in_seconds); |
duke@435 | 312 | |
duke@435 | 313 | // Dimensionless GC cost |
duke@435 | 314 | double collection_cost(double pause_in_seconds, double interval_in_seconds); |
duke@435 | 315 | |
duke@435 | 316 | virtual GCPolicyKind kind() const { return _gc_cms_adaptive_size_policy; } |
duke@435 | 317 | |
duke@435 | 318 | virtual double time_since_major_gc() const; |
duke@435 | 319 | |
duke@435 | 320 | // This returns the maximum average for the concurrent, ms, and |
duke@435 | 321 | // msc collections. This is meant to be used for the calculation |
duke@435 | 322 | // of the decayed major gc cost and is not in general the |
duke@435 | 323 | // average of all the different types of major collections. |
duke@435 | 324 | virtual double major_gc_interval_average_for_decay() const; |
duke@435 | 325 | |
duke@435 | 326 | public: |
duke@435 | 327 | CMSAdaptiveSizePolicy(size_t init_eden_size, |
duke@435 | 328 | size_t init_promo_size, |
duke@435 | 329 | size_t init_survivor_size, |
duke@435 | 330 | double max_gc_minor_pause_sec, |
duke@435 | 331 | double max_gc_pause_sec, |
duke@435 | 332 | uint gc_cost_ratio); |
duke@435 | 333 | |
duke@435 | 334 | // The timers for the stop-the-world phases measure a total |
duke@435 | 335 | // stop-the-world time. The timer is started and stopped |
duke@435 | 336 | // for each phase but is only reset after the final checkpoint. |
duke@435 | 337 | void checkpoint_roots_initial_begin(); |
duke@435 | 338 | void checkpoint_roots_initial_end(GCCause::Cause gc_cause); |
duke@435 | 339 | void checkpoint_roots_final_begin(); |
duke@435 | 340 | void checkpoint_roots_final_end(GCCause::Cause gc_cause); |
duke@435 | 341 | |
duke@435 | 342 | // Methods for gathering information about the |
duke@435 | 343 | // concurrent marking phase of the collection. |
duke@435 | 344 | // Records the mutator times and |
duke@435 | 345 | // resets the concurrent timer. |
duke@435 | 346 | void concurrent_marking_begin(); |
duke@435 | 347 | // Resets concurrent phase timer in the begin methods and |
duke@435 | 348 | // saves the time for a phase in the end methods. |
duke@435 | 349 | void concurrent_marking_end(); |
duke@435 | 350 | void concurrent_sweeping_begin(); |
duke@435 | 351 | void concurrent_sweeping_end(); |
duke@435 | 352 | // Similar to the above (e.g., concurrent_marking_end()) and |
duke@435 | 353 | // is used for both the precleaning an abortable precleaing |
duke@435 | 354 | // phases. |
duke@435 | 355 | void concurrent_precleaning_begin(); |
duke@435 | 356 | void concurrent_precleaning_end(); |
duke@435 | 357 | // Stops the concurrent phases time. Gathers |
duke@435 | 358 | // information and resets the timer. |
duke@435 | 359 | void concurrent_phases_end(GCCause::Cause gc_cause, |
duke@435 | 360 | size_t cur_eden, |
duke@435 | 361 | size_t cur_promo); |
duke@435 | 362 | |
duke@435 | 363 | // Methods for gather information about STW Mark-Sweep-Compact |
duke@435 | 364 | void msc_collection_begin(); |
duke@435 | 365 | void msc_collection_end(GCCause::Cause gc_cause); |
duke@435 | 366 | |
duke@435 | 367 | // Methods for gather information about Mark-Sweep done |
duke@435 | 368 | // in the foreground. |
duke@435 | 369 | void ms_collection_begin(); |
duke@435 | 370 | void ms_collection_end(GCCause::Cause gc_cause); |
duke@435 | 371 | |
duke@435 | 372 | // Cost for a mark-sweep tenured gen collection done in the foreground |
duke@435 | 373 | double ms_gc_cost() const { |
duke@435 | 374 | return MAX2(0.0F, _avg_ms_gc_cost->average()); |
duke@435 | 375 | } |
duke@435 | 376 | |
duke@435 | 377 | // Cost of collecting the tenured generation. Includes |
duke@435 | 378 | // concurrent collection and STW collection costs |
duke@435 | 379 | double cms_gc_cost() const; |
duke@435 | 380 | |
duke@435 | 381 | // Cost of STW mark-sweep-compact tenured gen collection. |
duke@435 | 382 | double msc_gc_cost() const { |
duke@435 | 383 | return MAX2(0.0F, _avg_msc_gc_cost->average()); |
duke@435 | 384 | } |
duke@435 | 385 | |
duke@435 | 386 | // |
duke@435 | 387 | double compacting_gc_cost() const { |
duke@435 | 388 | double result = MIN2(1.0, minor_gc_cost() + msc_gc_cost()); |
duke@435 | 389 | assert(result >= 0.0, "Both minor and major costs are non-negative"); |
duke@435 | 390 | return result; |
duke@435 | 391 | } |
duke@435 | 392 | |
duke@435 | 393 | // Restarts the concurrent phases timer. |
duke@435 | 394 | void concurrent_phases_resume(); |
duke@435 | 395 | |
twisti@1040 | 396 | // Time beginning and end of the marking phase for |
duke@435 | 397 | // a synchronous MS collection. A MS collection |
duke@435 | 398 | // that finishes in the foreground can have started |
duke@435 | 399 | // in the background. These methods capture the |
duke@435 | 400 | // completion of the marking (after the initial |
duke@435 | 401 | // marking) that is done in the foreground. |
duke@435 | 402 | void ms_collection_marking_begin(); |
duke@435 | 403 | void ms_collection_marking_end(GCCause::Cause gc_cause); |
duke@435 | 404 | |
duke@435 | 405 | static elapsedTimer* concurrent_timer_ptr() { |
duke@435 | 406 | return &_concurrent_timer; |
duke@435 | 407 | } |
duke@435 | 408 | |
duke@435 | 409 | AdaptiveWeightedAverage* avg_cms_promo() const { |
duke@435 | 410 | return _avg_cms_promo; |
duke@435 | 411 | } |
duke@435 | 412 | |
duke@435 | 413 | int change_young_gen_for_maj_pauses() { |
duke@435 | 414 | return _change_young_gen_for_maj_pauses; |
duke@435 | 415 | } |
duke@435 | 416 | void set_change_young_gen_for_maj_pauses(int v) { |
duke@435 | 417 | _change_young_gen_for_maj_pauses = v; |
duke@435 | 418 | } |
duke@435 | 419 | |
duke@435 | 420 | void clear_internal_time_intervals(); |
duke@435 | 421 | |
duke@435 | 422 | |
duke@435 | 423 | // Either calculated_promo_size_in_bytes() or promo_size() |
duke@435 | 424 | // should be deleted. |
duke@435 | 425 | size_t promo_size() { return _promo_size; } |
duke@435 | 426 | void set_promo_size(size_t v) { _promo_size = v; } |
duke@435 | 427 | |
duke@435 | 428 | // Cost of GC for all types of collections. |
duke@435 | 429 | virtual double gc_cost() const; |
duke@435 | 430 | |
duke@435 | 431 | size_t generation_alignment() { return _generation_alignment; } |
duke@435 | 432 | |
duke@435 | 433 | virtual void compute_young_generation_free_space(size_t cur_eden, |
duke@435 | 434 | size_t max_eden_size); |
duke@435 | 435 | // Calculates new survivor space size; returns a new tenuring threshold |
duke@435 | 436 | // value. Stores new survivor size in _survivor_size. |
duke@435 | 437 | virtual int compute_survivor_space_size_and_threshold( |
duke@435 | 438 | bool is_survivor_overflow, |
duke@435 | 439 | int tenuring_threshold, |
duke@435 | 440 | size_t survivor_limit); |
duke@435 | 441 | |
duke@435 | 442 | virtual void compute_tenured_generation_free_space(size_t cur_tenured_free, |
duke@435 | 443 | size_t max_tenured_available, |
duke@435 | 444 | size_t cur_eden); |
duke@435 | 445 | |
duke@435 | 446 | size_t eden_decrement_aligned_down(size_t cur_eden); |
duke@435 | 447 | size_t eden_increment_aligned_up(size_t cur_eden); |
duke@435 | 448 | |
duke@435 | 449 | size_t adjust_eden_for_pause_time(size_t cur_eden); |
duke@435 | 450 | size_t adjust_eden_for_throughput(size_t cur_eden); |
duke@435 | 451 | size_t adjust_eden_for_footprint(size_t cur_eden); |
duke@435 | 452 | |
duke@435 | 453 | size_t promo_decrement_aligned_down(size_t cur_promo); |
duke@435 | 454 | size_t promo_increment_aligned_up(size_t cur_promo); |
duke@435 | 455 | |
duke@435 | 456 | size_t adjust_promo_for_pause_time(size_t cur_promo); |
duke@435 | 457 | size_t adjust_promo_for_throughput(size_t cur_promo); |
duke@435 | 458 | size_t adjust_promo_for_footprint(size_t cur_promo, size_t cur_eden); |
duke@435 | 459 | |
duke@435 | 460 | // Scale down the input size by the ratio of the cost to collect the |
duke@435 | 461 | // generation to the total GC cost. |
duke@435 | 462 | size_t scale_by_gen_gc_cost(size_t base_change, double gen_gc_cost); |
duke@435 | 463 | |
duke@435 | 464 | // Return the value and clear it. |
duke@435 | 465 | bool get_and_clear_first_after_collection(); |
duke@435 | 466 | |
duke@435 | 467 | // Printing support |
duke@435 | 468 | virtual bool print_adaptive_size_policy_on(outputStream* st) const; |
duke@435 | 469 | }; |