src/share/vm/gc_implementation/shared/adaptiveSizePolicy.hpp

Sat, 27 Sep 2008 00:33:13 -0700

author
iveresov
date
Sat, 27 Sep 2008 00:33:13 -0700
changeset 808
06df86c2ec37
parent 435
a61af66fc99e
child 1822
0bfd3fb24150
permissions
-rw-r--r--

6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing
Summary: Treat a chuck where the allocation has failed as fully used.
Reviewed-by: ysr

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.
duke@435 27
duke@435 28 // Forward decls
duke@435 29 class elapsedTimer;
duke@435 30
duke@435 31 class AdaptiveSizePolicy : public CHeapObj {
duke@435 32 friend class GCAdaptivePolicyCounters;
duke@435 33 friend class PSGCAdaptivePolicyCounters;
duke@435 34 friend class CMSGCAdaptivePolicyCounters;
duke@435 35 protected:
duke@435 36
duke@435 37 enum GCPolicyKind {
duke@435 38 _gc_adaptive_size_policy,
duke@435 39 _gc_ps_adaptive_size_policy,
duke@435 40 _gc_cms_adaptive_size_policy
duke@435 41 };
duke@435 42 virtual GCPolicyKind kind() const { return _gc_adaptive_size_policy; }
duke@435 43
duke@435 44 enum SizePolicyTrueValues {
duke@435 45 decrease_old_gen_for_throughput_true = -7,
duke@435 46 decrease_young_gen_for_througput_true = -6,
duke@435 47
duke@435 48 increase_old_gen_for_min_pauses_true = -5,
duke@435 49 decrease_old_gen_for_min_pauses_true = -4,
duke@435 50 decrease_young_gen_for_maj_pauses_true = -3,
duke@435 51 increase_young_gen_for_min_pauses_true = -2,
duke@435 52 increase_old_gen_for_maj_pauses_true = -1,
duke@435 53
duke@435 54 decrease_young_gen_for_min_pauses_true = 1,
duke@435 55 decrease_old_gen_for_maj_pauses_true = 2,
duke@435 56 increase_young_gen_for_maj_pauses_true = 3,
duke@435 57
duke@435 58 increase_old_gen_for_throughput_true = 4,
duke@435 59 increase_young_gen_for_througput_true = 5,
duke@435 60
duke@435 61 decrease_young_gen_for_footprint_true = 6,
duke@435 62 decrease_old_gen_for_footprint_true = 7,
duke@435 63 decide_at_full_gc_true = 8
duke@435 64 };
duke@435 65
duke@435 66 // Goal for the fraction of the total time during which application
duke@435 67 // threads run.
duke@435 68 const double _throughput_goal;
duke@435 69
duke@435 70 // Last calculated sizes, in bytes, and aligned
duke@435 71 size_t _eden_size; // calculated eden free space in bytes
duke@435 72 size_t _promo_size; // calculated cms gen free space in bytes
duke@435 73
duke@435 74 size_t _survivor_size; // calculated survivor size in bytes
duke@435 75
duke@435 76 // This is a hint for the heap: we've detected that gc times
duke@435 77 // are taking longer than GCTimeLimit allows.
duke@435 78 bool _gc_time_limit_exceeded;
duke@435 79 // Use for diagnostics only. If UseGCTimeLimit is false,
duke@435 80 // this variable is still set.
duke@435 81 bool _print_gc_time_limit_would_be_exceeded;
duke@435 82 // Count of consecutive GC that have exceeded the
duke@435 83 // GC time limit criterion.
duke@435 84 uint _gc_time_limit_count;
duke@435 85
duke@435 86 // Minor collection timers used to determine both
duke@435 87 // pause and interval times for collections.
duke@435 88 static elapsedTimer _minor_timer;
duke@435 89
duke@435 90 // Major collection timers, used to determine both
duke@435 91 // pause and interval times for collections
duke@435 92 static elapsedTimer _major_timer;
duke@435 93
duke@435 94 // Time statistics
duke@435 95 AdaptivePaddedAverage* _avg_minor_pause;
duke@435 96 AdaptiveWeightedAverage* _avg_minor_interval;
duke@435 97 AdaptiveWeightedAverage* _avg_minor_gc_cost;
duke@435 98
duke@435 99 AdaptiveWeightedAverage* _avg_major_interval;
duke@435 100 AdaptiveWeightedAverage* _avg_major_gc_cost;
duke@435 101
duke@435 102 // Footprint statistics
duke@435 103 AdaptiveWeightedAverage* _avg_young_live;
duke@435 104 AdaptiveWeightedAverage* _avg_eden_live;
duke@435 105 AdaptiveWeightedAverage* _avg_old_live;
duke@435 106
duke@435 107 // Statistics for survivor space calculation for young generation
duke@435 108 AdaptivePaddedAverage* _avg_survived;
duke@435 109
duke@435 110 // Objects that have been directly allocated in the old generation.
duke@435 111 AdaptivePaddedNoZeroDevAverage* _avg_pretenured;
duke@435 112
duke@435 113 // Variable for estimating the major and minor pause times.
duke@435 114 // These variables represent linear least-squares fits of
duke@435 115 // the data.
duke@435 116 // minor pause time vs. old gen size
duke@435 117 LinearLeastSquareFit* _minor_pause_old_estimator;
duke@435 118 // minor pause time vs. young gen size
duke@435 119 LinearLeastSquareFit* _minor_pause_young_estimator;
duke@435 120
duke@435 121 // Variables for estimating the major and minor collection costs
duke@435 122 // minor collection time vs. young gen size
duke@435 123 LinearLeastSquareFit* _minor_collection_estimator;
duke@435 124 // major collection time vs. cms gen size
duke@435 125 LinearLeastSquareFit* _major_collection_estimator;
duke@435 126
duke@435 127 // These record the most recent collection times. They
duke@435 128 // are available as an alternative to using the averages
duke@435 129 // for making ergonomic decisions.
duke@435 130 double _latest_minor_mutator_interval_seconds;
duke@435 131
duke@435 132 // Allowed difference between major and minor gc times, used
duke@435 133 // for computing tenuring_threshold.
duke@435 134 const double _threshold_tolerance_percent;
duke@435 135
duke@435 136 const double _gc_pause_goal_sec; // goal for maximum gc pause
duke@435 137
duke@435 138 // Flag indicating that the adaptive policy is ready to use
duke@435 139 bool _young_gen_policy_is_ready;
duke@435 140
duke@435 141 // decrease/increase the young generation for minor pause time
duke@435 142 int _change_young_gen_for_min_pauses;
duke@435 143
duke@435 144 // decrease/increase the old generation for major pause time
duke@435 145 int _change_old_gen_for_maj_pauses;
duke@435 146
duke@435 147 // change old geneneration for throughput
duke@435 148 int _change_old_gen_for_throughput;
duke@435 149
duke@435 150 // change young generation for throughput
duke@435 151 int _change_young_gen_for_throughput;
duke@435 152
duke@435 153 // Flag indicating that the policy would
duke@435 154 // increase the tenuring threshold because of the total major gc cost
duke@435 155 // is greater than the total minor gc cost
duke@435 156 bool _increment_tenuring_threshold_for_gc_cost;
duke@435 157 // decrease the tenuring threshold because of the the total minor gc
duke@435 158 // cost is greater than the total major gc cost
duke@435 159 bool _decrement_tenuring_threshold_for_gc_cost;
duke@435 160 // decrease due to survivor size limit
duke@435 161 bool _decrement_tenuring_threshold_for_survivor_limit;
duke@435 162
duke@435 163 // decrease generation sizes for footprint
duke@435 164 int _decrease_for_footprint;
duke@435 165
duke@435 166 // Set if the ergonomic decisions were made at a full GC.
duke@435 167 int _decide_at_full_gc;
duke@435 168
duke@435 169 // Changing the generation sizing depends on the data that is
duke@435 170 // gathered about the effects of changes on the pause times and
duke@435 171 // throughput. These variable count the number of data points
duke@435 172 // gathered. The policy may use these counters as a threshhold
duke@435 173 // for reliable data.
duke@435 174 julong _young_gen_change_for_minor_throughput;
duke@435 175 julong _old_gen_change_for_major_throughput;
duke@435 176
duke@435 177 // Accessors
duke@435 178
duke@435 179 double gc_pause_goal_sec() const { return _gc_pause_goal_sec; }
duke@435 180 // The value returned is unitless: it's the proportion of time
duke@435 181 // spent in a particular collection type.
duke@435 182 // An interval time will be 0.0 if a collection type hasn't occurred yet.
duke@435 183 // The 1.4.2 implementation put a floor on the values of major_gc_cost
duke@435 184 // and minor_gc_cost. This was useful because of the way major_gc_cost
duke@435 185 // and minor_gc_cost was used in calculating the sizes of the generations.
duke@435 186 // Do not use a floor in this implementation because any finite value
duke@435 187 // will put a limit on the throughput that can be achieved and any
duke@435 188 // throughput goal above that limit will drive the generations sizes
duke@435 189 // to extremes.
duke@435 190 double major_gc_cost() const {
duke@435 191 return MAX2(0.0F, _avg_major_gc_cost->average());
duke@435 192 }
duke@435 193
duke@435 194 // The value returned is unitless: it's the proportion of time
duke@435 195 // spent in a particular collection type.
duke@435 196 // An interval time will be 0.0 if a collection type hasn't occurred yet.
duke@435 197 // The 1.4.2 implementation put a floor on the values of major_gc_cost
duke@435 198 // and minor_gc_cost. This was useful because of the way major_gc_cost
duke@435 199 // and minor_gc_cost was used in calculating the sizes of the generations.
duke@435 200 // Do not use a floor in this implementation because any finite value
duke@435 201 // will put a limit on the throughput that can be achieved and any
duke@435 202 // throughput goal above that limit will drive the generations sizes
duke@435 203 // to extremes.
duke@435 204
duke@435 205 double minor_gc_cost() const {
duke@435 206 return MAX2(0.0F, _avg_minor_gc_cost->average());
duke@435 207 }
duke@435 208
duke@435 209 // Because we're dealing with averages, gc_cost() can be
duke@435 210 // larger than 1.0 if just the sum of the minor cost the
duke@435 211 // the major cost is used. Worse than that is the
duke@435 212 // fact that the minor cost and the major cost each
duke@435 213 // tend toward 1.0 in the extreme of high gc costs.
duke@435 214 // Limit the value of gc_cost to 1.0 so that the mutator
duke@435 215 // cost stays non-negative.
duke@435 216 virtual double gc_cost() const {
duke@435 217 double result = MIN2(1.0, minor_gc_cost() + major_gc_cost());
duke@435 218 assert(result >= 0.0, "Both minor and major costs are non-negative");
duke@435 219 return result;
duke@435 220 }
duke@435 221
duke@435 222 // Elapsed time since the last major collection.
duke@435 223 virtual double time_since_major_gc() const;
duke@435 224
duke@435 225 // Average interval between major collections to be used
duke@435 226 // in calculating the decaying major gc cost. An overestimate
duke@435 227 // of this time would be a conservative estimate because
duke@435 228 // this time is used to decide if the major GC cost
duke@435 229 // should be decayed (i.e., if the time since the last
duke@435 230 // major gc is long compared to the time returned here,
duke@435 231 // then the major GC cost will be decayed). See the
duke@435 232 // implementations for the specifics.
duke@435 233 virtual double major_gc_interval_average_for_decay() const {
duke@435 234 return _avg_major_interval->average();
duke@435 235 }
duke@435 236
duke@435 237 // Return the cost of the GC where the major gc cost
duke@435 238 // has been decayed based on the time since the last
duke@435 239 // major collection.
duke@435 240 double decaying_gc_cost() const;
duke@435 241
duke@435 242 // Decay the major gc cost. Use this only for decisions on
duke@435 243 // whether to adjust, not to determine by how much to adjust.
duke@435 244 // This approximation is crude and may not be good enough for the
duke@435 245 // latter.
duke@435 246 double decaying_major_gc_cost() const;
duke@435 247
duke@435 248 // Return the mutator cost using the decayed
duke@435 249 // GC cost.
duke@435 250 double adjusted_mutator_cost() const {
duke@435 251 double result = 1.0 - decaying_gc_cost();
duke@435 252 assert(result >= 0.0, "adjusted mutator cost calculation is incorrect");
duke@435 253 return result;
duke@435 254 }
duke@435 255
duke@435 256 virtual double mutator_cost() const {
duke@435 257 double result = 1.0 - gc_cost();
duke@435 258 assert(result >= 0.0, "mutator cost calculation is incorrect");
duke@435 259 return result;
duke@435 260 }
duke@435 261
duke@435 262
duke@435 263 bool young_gen_policy_is_ready() { return _young_gen_policy_is_ready; }
duke@435 264
duke@435 265 void update_minor_pause_young_estimator(double minor_pause_in_ms);
duke@435 266 virtual void update_minor_pause_old_estimator(double minor_pause_in_ms) {
duke@435 267 // This is not meaningful for all policies but needs to be present
duke@435 268 // to use minor_collection_end() in its current form.
duke@435 269 }
duke@435 270
duke@435 271 virtual size_t eden_increment(size_t cur_eden);
duke@435 272 virtual size_t eden_increment(size_t cur_eden, uint percent_change);
duke@435 273 virtual size_t eden_decrement(size_t cur_eden);
duke@435 274 virtual size_t promo_increment(size_t cur_eden);
duke@435 275 virtual size_t promo_increment(size_t cur_eden, uint percent_change);
duke@435 276 virtual size_t promo_decrement(size_t cur_eden);
duke@435 277
duke@435 278 virtual void clear_generation_free_space_flags();
duke@435 279
duke@435 280 int change_old_gen_for_throughput() const {
duke@435 281 return _change_old_gen_for_throughput;
duke@435 282 }
duke@435 283 void set_change_old_gen_for_throughput(int v) {
duke@435 284 _change_old_gen_for_throughput = v;
duke@435 285 }
duke@435 286 int change_young_gen_for_throughput() const {
duke@435 287 return _change_young_gen_for_throughput;
duke@435 288 }
duke@435 289 void set_change_young_gen_for_throughput(int v) {
duke@435 290 _change_young_gen_for_throughput = v;
duke@435 291 }
duke@435 292
duke@435 293 int change_old_gen_for_maj_pauses() const {
duke@435 294 return _change_old_gen_for_maj_pauses;
duke@435 295 }
duke@435 296 void set_change_old_gen_for_maj_pauses(int v) {
duke@435 297 _change_old_gen_for_maj_pauses = v;
duke@435 298 }
duke@435 299
duke@435 300 bool decrement_tenuring_threshold_for_gc_cost() const {
duke@435 301 return _decrement_tenuring_threshold_for_gc_cost;
duke@435 302 }
duke@435 303 void set_decrement_tenuring_threshold_for_gc_cost(bool v) {
duke@435 304 _decrement_tenuring_threshold_for_gc_cost = v;
duke@435 305 }
duke@435 306 bool increment_tenuring_threshold_for_gc_cost() const {
duke@435 307 return _increment_tenuring_threshold_for_gc_cost;
duke@435 308 }
duke@435 309 void set_increment_tenuring_threshold_for_gc_cost(bool v) {
duke@435 310 _increment_tenuring_threshold_for_gc_cost = v;
duke@435 311 }
duke@435 312 bool decrement_tenuring_threshold_for_survivor_limit() const {
duke@435 313 return _decrement_tenuring_threshold_for_survivor_limit;
duke@435 314 }
duke@435 315 void set_decrement_tenuring_threshold_for_survivor_limit(bool v) {
duke@435 316 _decrement_tenuring_threshold_for_survivor_limit = v;
duke@435 317 }
duke@435 318 // Return true if the policy suggested a change.
duke@435 319 bool tenuring_threshold_change() const;
duke@435 320
duke@435 321 public:
duke@435 322 AdaptiveSizePolicy(size_t init_eden_size,
duke@435 323 size_t init_promo_size,
duke@435 324 size_t init_survivor_size,
duke@435 325 double gc_pause_goal_sec,
duke@435 326 uint gc_cost_ratio);
duke@435 327
duke@435 328 bool is_gc_cms_adaptive_size_policy() {
duke@435 329 return kind() == _gc_cms_adaptive_size_policy;
duke@435 330 }
duke@435 331 bool is_gc_ps_adaptive_size_policy() {
duke@435 332 return kind() == _gc_ps_adaptive_size_policy;
duke@435 333 }
duke@435 334
duke@435 335 AdaptivePaddedAverage* avg_minor_pause() const { return _avg_minor_pause; }
duke@435 336 AdaptiveWeightedAverage* avg_minor_interval() const {
duke@435 337 return _avg_minor_interval;
duke@435 338 }
duke@435 339 AdaptiveWeightedAverage* avg_minor_gc_cost() const {
duke@435 340 return _avg_minor_gc_cost;
duke@435 341 }
duke@435 342
duke@435 343 AdaptiveWeightedAverage* avg_major_gc_cost() const {
duke@435 344 return _avg_major_gc_cost;
duke@435 345 }
duke@435 346
duke@435 347 AdaptiveWeightedAverage* avg_young_live() const { return _avg_young_live; }
duke@435 348 AdaptiveWeightedAverage* avg_eden_live() const { return _avg_eden_live; }
duke@435 349 AdaptiveWeightedAverage* avg_old_live() const { return _avg_old_live; }
duke@435 350
duke@435 351 AdaptivePaddedAverage* avg_survived() const { return _avg_survived; }
duke@435 352 AdaptivePaddedNoZeroDevAverage* avg_pretenured() { return _avg_pretenured; }
duke@435 353
duke@435 354 // Methods indicating events of interest to the adaptive size policy,
duke@435 355 // called by GC algorithms. It is the responsibility of users of this
duke@435 356 // policy to call these methods at the correct times!
duke@435 357 virtual void minor_collection_begin();
duke@435 358 virtual void minor_collection_end(GCCause::Cause gc_cause);
duke@435 359 virtual LinearLeastSquareFit* minor_pause_old_estimator() const {
duke@435 360 return _minor_pause_old_estimator;
duke@435 361 }
duke@435 362
duke@435 363 LinearLeastSquareFit* minor_pause_young_estimator() {
duke@435 364 return _minor_pause_young_estimator;
duke@435 365 }
duke@435 366 LinearLeastSquareFit* minor_collection_estimator() {
duke@435 367 return _minor_collection_estimator;
duke@435 368 }
duke@435 369
duke@435 370 LinearLeastSquareFit* major_collection_estimator() {
duke@435 371 return _major_collection_estimator;
duke@435 372 }
duke@435 373
duke@435 374 float minor_pause_young_slope() {
duke@435 375 return _minor_pause_young_estimator->slope();
duke@435 376 }
duke@435 377
duke@435 378 float minor_collection_slope() { return _minor_collection_estimator->slope();}
duke@435 379 float major_collection_slope() { return _major_collection_estimator->slope();}
duke@435 380
duke@435 381 float minor_pause_old_slope() {
duke@435 382 return _minor_pause_old_estimator->slope();
duke@435 383 }
duke@435 384
duke@435 385 void set_eden_size(size_t new_size) {
duke@435 386 _eden_size = new_size;
duke@435 387 }
duke@435 388 void set_survivor_size(size_t new_size) {
duke@435 389 _survivor_size = new_size;
duke@435 390 }
duke@435 391
duke@435 392 size_t calculated_eden_size_in_bytes() const {
duke@435 393 return _eden_size;
duke@435 394 }
duke@435 395
duke@435 396 size_t calculated_promo_size_in_bytes() const {
duke@435 397 return _promo_size;
duke@435 398 }
duke@435 399
duke@435 400 size_t calculated_survivor_size_in_bytes() const {
duke@435 401 return _survivor_size;
duke@435 402 }
duke@435 403
duke@435 404 // This is a hint for the heap: we've detected that gc times
duke@435 405 // are taking longer than GCTimeLimit allows.
duke@435 406 // Most heaps will choose to throw an OutOfMemoryError when
duke@435 407 // this occurs but it is up to the heap to request this information
duke@435 408 // of the policy
duke@435 409 bool gc_time_limit_exceeded() {
duke@435 410 return _gc_time_limit_exceeded;
duke@435 411 }
duke@435 412 void set_gc_time_limit_exceeded(bool v) {
duke@435 413 _gc_time_limit_exceeded = v;
duke@435 414 }
duke@435 415 bool print_gc_time_limit_would_be_exceeded() {
duke@435 416 return _print_gc_time_limit_would_be_exceeded;
duke@435 417 }
duke@435 418 void set_print_gc_time_limit_would_be_exceeded(bool v) {
duke@435 419 _print_gc_time_limit_would_be_exceeded = v;
duke@435 420 }
duke@435 421
duke@435 422 uint gc_time_limit_count() { return _gc_time_limit_count; }
duke@435 423 void reset_gc_time_limit_count() { _gc_time_limit_count = 0; }
duke@435 424 void inc_gc_time_limit_count() { _gc_time_limit_count++; }
duke@435 425 // accessors for flags recording the decisions to resize the
duke@435 426 // generations to meet the pause goal.
duke@435 427
duke@435 428 int change_young_gen_for_min_pauses() const {
duke@435 429 return _change_young_gen_for_min_pauses;
duke@435 430 }
duke@435 431 void set_change_young_gen_for_min_pauses(int v) {
duke@435 432 _change_young_gen_for_min_pauses = v;
duke@435 433 }
duke@435 434 void set_decrease_for_footprint(int v) { _decrease_for_footprint = v; }
duke@435 435 int decrease_for_footprint() const { return _decrease_for_footprint; }
duke@435 436 int decide_at_full_gc() { return _decide_at_full_gc; }
duke@435 437 void set_decide_at_full_gc(int v) { _decide_at_full_gc = v; }
duke@435 438
duke@435 439 // Printing support
duke@435 440 virtual bool print_adaptive_size_policy_on(outputStream* st) const;
duke@435 441 bool print_adaptive_size_policy_on(outputStream* st, int
duke@435 442 tenuring_threshold) const;
duke@435 443 };
duke@435 444
duke@435 445 // Class that can be used to print information about the
duke@435 446 // adaptive size policy at intervals specified by
duke@435 447 // AdaptiveSizePolicyOutputInterval. Only print information
duke@435 448 // if an adaptive size policy is in use.
duke@435 449 class AdaptiveSizePolicyOutput : StackObj {
duke@435 450 AdaptiveSizePolicy* _size_policy;
duke@435 451 bool _do_print;
duke@435 452 bool print_test(uint count) {
duke@435 453 // A count of zero is a special value that indicates that the
duke@435 454 // interval test should be ignored. An interval is of zero is
duke@435 455 // a special value that indicates that the interval test should
duke@435 456 // always fail (never do the print based on the interval test).
duke@435 457 return PrintGCDetails &&
duke@435 458 UseAdaptiveSizePolicy &&
duke@435 459 (UseParallelGC || UseConcMarkSweepGC) &&
duke@435 460 (AdaptiveSizePolicyOutputInterval > 0) &&
duke@435 461 ((count == 0) ||
duke@435 462 ((count % AdaptiveSizePolicyOutputInterval) == 0));
duke@435 463 }
duke@435 464 public:
duke@435 465 // The special value of a zero count can be used to ignore
duke@435 466 // the count test.
duke@435 467 AdaptiveSizePolicyOutput(uint count) {
duke@435 468 if (UseAdaptiveSizePolicy && (AdaptiveSizePolicyOutputInterval > 0)) {
duke@435 469 CollectedHeap* heap = Universe::heap();
duke@435 470 _size_policy = heap->size_policy();
duke@435 471 _do_print = print_test(count);
duke@435 472 } else {
duke@435 473 _size_policy = NULL;
duke@435 474 _do_print = false;
duke@435 475 }
duke@435 476 }
duke@435 477 AdaptiveSizePolicyOutput(AdaptiveSizePolicy* size_policy,
duke@435 478 uint count) :
duke@435 479 _size_policy(size_policy) {
duke@435 480 if (UseAdaptiveSizePolicy && (AdaptiveSizePolicyOutputInterval > 0)) {
duke@435 481 _do_print = print_test(count);
duke@435 482 } else {
duke@435 483 _do_print = false;
duke@435 484 }
duke@435 485 }
duke@435 486 ~AdaptiveSizePolicyOutput() {
duke@435 487 if (_do_print) {
duke@435 488 assert(UseAdaptiveSizePolicy, "Should not be in use");
duke@435 489 _size_policy->print_adaptive_size_policy_on(gclog_or_tty);
duke@435 490 }
duke@435 491 }
duke@435 492 };

mercurial