1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.hpp Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,545 @@ 1.4 +/* 1.5 + * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +#ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_ADAPTIVESIZEPOLICY_HPP 1.29 +#define SHARE_VM_GC_IMPLEMENTATION_SHARED_ADAPTIVESIZEPOLICY_HPP 1.30 + 1.31 +#include "gc_implementation/shared/gcUtil.hpp" 1.32 +#include "gc_interface/collectedHeap.hpp" 1.33 +#include "gc_interface/gcCause.hpp" 1.34 +#include "memory/allocation.hpp" 1.35 +#include "memory/universe.hpp" 1.36 + 1.37 +// This class keeps statistical information and computes the 1.38 +// size of the heap. 1.39 + 1.40 +// Forward decls 1.41 +class elapsedTimer; 1.42 +class CollectorPolicy; 1.43 + 1.44 +class AdaptiveSizePolicy : public CHeapObj<mtGC> { 1.45 + friend class GCAdaptivePolicyCounters; 1.46 + friend class PSGCAdaptivePolicyCounters; 1.47 + friend class CMSGCAdaptivePolicyCounters; 1.48 + protected: 1.49 + 1.50 + enum GCPolicyKind { 1.51 + _gc_adaptive_size_policy, 1.52 + _gc_ps_adaptive_size_policy, 1.53 + _gc_cms_adaptive_size_policy 1.54 + }; 1.55 + virtual GCPolicyKind kind() const { return _gc_adaptive_size_policy; } 1.56 + 1.57 + enum SizePolicyTrueValues { 1.58 + decrease_old_gen_for_throughput_true = -7, 1.59 + decrease_young_gen_for_througput_true = -6, 1.60 + 1.61 + increase_old_gen_for_min_pauses_true = -5, 1.62 + decrease_old_gen_for_min_pauses_true = -4, 1.63 + decrease_young_gen_for_maj_pauses_true = -3, 1.64 + increase_young_gen_for_min_pauses_true = -2, 1.65 + increase_old_gen_for_maj_pauses_true = -1, 1.66 + 1.67 + decrease_young_gen_for_min_pauses_true = 1, 1.68 + decrease_old_gen_for_maj_pauses_true = 2, 1.69 + increase_young_gen_for_maj_pauses_true = 3, 1.70 + 1.71 + increase_old_gen_for_throughput_true = 4, 1.72 + increase_young_gen_for_througput_true = 5, 1.73 + 1.74 + decrease_young_gen_for_footprint_true = 6, 1.75 + decrease_old_gen_for_footprint_true = 7, 1.76 + decide_at_full_gc_true = 8 1.77 + }; 1.78 + 1.79 + // Goal for the fraction of the total time during which application 1.80 + // threads run. 1.81 + const double _throughput_goal; 1.82 + 1.83 + // Last calculated sizes, in bytes, and aligned 1.84 + size_t _eden_size; // calculated eden free space in bytes 1.85 + size_t _promo_size; // calculated cms gen free space in bytes 1.86 + 1.87 + size_t _survivor_size; // calculated survivor size in bytes 1.88 + 1.89 + // This is a hint for the heap: we've detected that gc times 1.90 + // are taking longer than GCTimeLimit allows. 1.91 + bool _gc_overhead_limit_exceeded; 1.92 + // Use for diagnostics only. If UseGCOverheadLimit is false, 1.93 + // this variable is still set. 1.94 + bool _print_gc_overhead_limit_would_be_exceeded; 1.95 + // Count of consecutive GC that have exceeded the 1.96 + // GC time limit criterion. 1.97 + uint _gc_overhead_limit_count; 1.98 + // This flag signals that GCTimeLimit is being exceeded 1.99 + // but may not have done so for the required number of consequetive 1.100 + // collections. 1.101 + 1.102 + // Minor collection timers used to determine both 1.103 + // pause and interval times for collections. 1.104 + static elapsedTimer _minor_timer; 1.105 + 1.106 + // Major collection timers, used to determine both 1.107 + // pause and interval times for collections 1.108 + static elapsedTimer _major_timer; 1.109 + 1.110 + // Time statistics 1.111 + AdaptivePaddedAverage* _avg_minor_pause; 1.112 + AdaptiveWeightedAverage* _avg_minor_interval; 1.113 + AdaptiveWeightedAverage* _avg_minor_gc_cost; 1.114 + 1.115 + AdaptiveWeightedAverage* _avg_major_interval; 1.116 + AdaptiveWeightedAverage* _avg_major_gc_cost; 1.117 + 1.118 + // Footprint statistics 1.119 + AdaptiveWeightedAverage* _avg_young_live; 1.120 + AdaptiveWeightedAverage* _avg_eden_live; 1.121 + AdaptiveWeightedAverage* _avg_old_live; 1.122 + 1.123 + // Statistics for survivor space calculation for young generation 1.124 + AdaptivePaddedAverage* _avg_survived; 1.125 + 1.126 + // Objects that have been directly allocated in the old generation. 1.127 + AdaptivePaddedNoZeroDevAverage* _avg_pretenured; 1.128 + 1.129 + // Variable for estimating the major and minor pause times. 1.130 + // These variables represent linear least-squares fits of 1.131 + // the data. 1.132 + // minor pause time vs. old gen size 1.133 + LinearLeastSquareFit* _minor_pause_old_estimator; 1.134 + // minor pause time vs. young gen size 1.135 + LinearLeastSquareFit* _minor_pause_young_estimator; 1.136 + 1.137 + // Variables for estimating the major and minor collection costs 1.138 + // minor collection time vs. young gen size 1.139 + LinearLeastSquareFit* _minor_collection_estimator; 1.140 + // major collection time vs. cms gen size 1.141 + LinearLeastSquareFit* _major_collection_estimator; 1.142 + 1.143 + // These record the most recent collection times. They 1.144 + // are available as an alternative to using the averages 1.145 + // for making ergonomic decisions. 1.146 + double _latest_minor_mutator_interval_seconds; 1.147 + 1.148 + // Allowed difference between major and minor gc times, used 1.149 + // for computing tenuring_threshold. 1.150 + const double _threshold_tolerance_percent; 1.151 + 1.152 + const double _gc_pause_goal_sec; // goal for maximum gc pause 1.153 + 1.154 + // Flag indicating that the adaptive policy is ready to use 1.155 + bool _young_gen_policy_is_ready; 1.156 + 1.157 + // decrease/increase the young generation for minor pause time 1.158 + int _change_young_gen_for_min_pauses; 1.159 + 1.160 + // decrease/increase the old generation for major pause time 1.161 + int _change_old_gen_for_maj_pauses; 1.162 + 1.163 + // change old geneneration for throughput 1.164 + int _change_old_gen_for_throughput; 1.165 + 1.166 + // change young generation for throughput 1.167 + int _change_young_gen_for_throughput; 1.168 + 1.169 + // Flag indicating that the policy would 1.170 + // increase the tenuring threshold because of the total major gc cost 1.171 + // is greater than the total minor gc cost 1.172 + bool _increment_tenuring_threshold_for_gc_cost; 1.173 + // decrease the tenuring threshold because of the the total minor gc 1.174 + // cost is greater than the total major gc cost 1.175 + bool _decrement_tenuring_threshold_for_gc_cost; 1.176 + // decrease due to survivor size limit 1.177 + bool _decrement_tenuring_threshold_for_survivor_limit; 1.178 + 1.179 + // decrease generation sizes for footprint 1.180 + int _decrease_for_footprint; 1.181 + 1.182 + // Set if the ergonomic decisions were made at a full GC. 1.183 + int _decide_at_full_gc; 1.184 + 1.185 + // Changing the generation sizing depends on the data that is 1.186 + // gathered about the effects of changes on the pause times and 1.187 + // throughput. These variable count the number of data points 1.188 + // gathered. The policy may use these counters as a threshhold 1.189 + // for reliable data. 1.190 + julong _young_gen_change_for_minor_throughput; 1.191 + julong _old_gen_change_for_major_throughput; 1.192 + 1.193 + static const uint GCWorkersPerJavaThread = 2; 1.194 + 1.195 + // Accessors 1.196 + 1.197 + double gc_pause_goal_sec() const { return _gc_pause_goal_sec; } 1.198 + // The value returned is unitless: it's the proportion of time 1.199 + // spent in a particular collection type. 1.200 + // An interval time will be 0.0 if a collection type hasn't occurred yet. 1.201 + // The 1.4.2 implementation put a floor on the values of major_gc_cost 1.202 + // and minor_gc_cost. This was useful because of the way major_gc_cost 1.203 + // and minor_gc_cost was used in calculating the sizes of the generations. 1.204 + // Do not use a floor in this implementation because any finite value 1.205 + // will put a limit on the throughput that can be achieved and any 1.206 + // throughput goal above that limit will drive the generations sizes 1.207 + // to extremes. 1.208 + double major_gc_cost() const { 1.209 + return MAX2(0.0F, _avg_major_gc_cost->average()); 1.210 + } 1.211 + 1.212 + // The value returned is unitless: it's the proportion of time 1.213 + // spent in a particular collection type. 1.214 + // An interval time will be 0.0 if a collection type hasn't occurred yet. 1.215 + // The 1.4.2 implementation put a floor on the values of major_gc_cost 1.216 + // and minor_gc_cost. This was useful because of the way major_gc_cost 1.217 + // and minor_gc_cost was used in calculating the sizes of the generations. 1.218 + // Do not use a floor in this implementation because any finite value 1.219 + // will put a limit on the throughput that can be achieved and any 1.220 + // throughput goal above that limit will drive the generations sizes 1.221 + // to extremes. 1.222 + 1.223 + double minor_gc_cost() const { 1.224 + return MAX2(0.0F, _avg_minor_gc_cost->average()); 1.225 + } 1.226 + 1.227 + // Because we're dealing with averages, gc_cost() can be 1.228 + // larger than 1.0 if just the sum of the minor cost the 1.229 + // the major cost is used. Worse than that is the 1.230 + // fact that the minor cost and the major cost each 1.231 + // tend toward 1.0 in the extreme of high gc costs. 1.232 + // Limit the value of gc_cost to 1.0 so that the mutator 1.233 + // cost stays non-negative. 1.234 + virtual double gc_cost() const { 1.235 + double result = MIN2(1.0, minor_gc_cost() + major_gc_cost()); 1.236 + assert(result >= 0.0, "Both minor and major costs are non-negative"); 1.237 + return result; 1.238 + } 1.239 + 1.240 + // Elapsed time since the last major collection. 1.241 + virtual double time_since_major_gc() const; 1.242 + 1.243 + // Average interval between major collections to be used 1.244 + // in calculating the decaying major gc cost. An overestimate 1.245 + // of this time would be a conservative estimate because 1.246 + // this time is used to decide if the major GC cost 1.247 + // should be decayed (i.e., if the time since the last 1.248 + // major gc is long compared to the time returned here, 1.249 + // then the major GC cost will be decayed). See the 1.250 + // implementations for the specifics. 1.251 + virtual double major_gc_interval_average_for_decay() const { 1.252 + return _avg_major_interval->average(); 1.253 + } 1.254 + 1.255 + // Return the cost of the GC where the major gc cost 1.256 + // has been decayed based on the time since the last 1.257 + // major collection. 1.258 + double decaying_gc_cost() const; 1.259 + 1.260 + // Decay the major gc cost. Use this only for decisions on 1.261 + // whether to adjust, not to determine by how much to adjust. 1.262 + // This approximation is crude and may not be good enough for the 1.263 + // latter. 1.264 + double decaying_major_gc_cost() const; 1.265 + 1.266 + // Return the mutator cost using the decayed 1.267 + // GC cost. 1.268 + double adjusted_mutator_cost() const { 1.269 + double result = 1.0 - decaying_gc_cost(); 1.270 + assert(result >= 0.0, "adjusted mutator cost calculation is incorrect"); 1.271 + return result; 1.272 + } 1.273 + 1.274 + virtual double mutator_cost() const { 1.275 + double result = 1.0 - gc_cost(); 1.276 + assert(result >= 0.0, "mutator cost calculation is incorrect"); 1.277 + return result; 1.278 + } 1.279 + 1.280 + 1.281 + bool young_gen_policy_is_ready() { return _young_gen_policy_is_ready; } 1.282 + 1.283 + void update_minor_pause_young_estimator(double minor_pause_in_ms); 1.284 + virtual void update_minor_pause_old_estimator(double minor_pause_in_ms) { 1.285 + // This is not meaningful for all policies but needs to be present 1.286 + // to use minor_collection_end() in its current form. 1.287 + } 1.288 + 1.289 + virtual size_t eden_increment(size_t cur_eden); 1.290 + virtual size_t eden_increment(size_t cur_eden, uint percent_change); 1.291 + virtual size_t eden_decrement(size_t cur_eden); 1.292 + virtual size_t promo_increment(size_t cur_eden); 1.293 + virtual size_t promo_increment(size_t cur_eden, uint percent_change); 1.294 + virtual size_t promo_decrement(size_t cur_eden); 1.295 + 1.296 + virtual void clear_generation_free_space_flags(); 1.297 + 1.298 + int change_old_gen_for_throughput() const { 1.299 + return _change_old_gen_for_throughput; 1.300 + } 1.301 + void set_change_old_gen_for_throughput(int v) { 1.302 + _change_old_gen_for_throughput = v; 1.303 + } 1.304 + int change_young_gen_for_throughput() const { 1.305 + return _change_young_gen_for_throughput; 1.306 + } 1.307 + void set_change_young_gen_for_throughput(int v) { 1.308 + _change_young_gen_for_throughput = v; 1.309 + } 1.310 + 1.311 + int change_old_gen_for_maj_pauses() const { 1.312 + return _change_old_gen_for_maj_pauses; 1.313 + } 1.314 + void set_change_old_gen_for_maj_pauses(int v) { 1.315 + _change_old_gen_for_maj_pauses = v; 1.316 + } 1.317 + 1.318 + bool decrement_tenuring_threshold_for_gc_cost() const { 1.319 + return _decrement_tenuring_threshold_for_gc_cost; 1.320 + } 1.321 + void set_decrement_tenuring_threshold_for_gc_cost(bool v) { 1.322 + _decrement_tenuring_threshold_for_gc_cost = v; 1.323 + } 1.324 + bool increment_tenuring_threshold_for_gc_cost() const { 1.325 + return _increment_tenuring_threshold_for_gc_cost; 1.326 + } 1.327 + void set_increment_tenuring_threshold_for_gc_cost(bool v) { 1.328 + _increment_tenuring_threshold_for_gc_cost = v; 1.329 + } 1.330 + bool decrement_tenuring_threshold_for_survivor_limit() const { 1.331 + return _decrement_tenuring_threshold_for_survivor_limit; 1.332 + } 1.333 + void set_decrement_tenuring_threshold_for_survivor_limit(bool v) { 1.334 + _decrement_tenuring_threshold_for_survivor_limit = v; 1.335 + } 1.336 + // Return true if the policy suggested a change. 1.337 + bool tenuring_threshold_change() const; 1.338 + 1.339 + static bool _debug_perturbation; 1.340 + 1.341 + public: 1.342 + AdaptiveSizePolicy(size_t init_eden_size, 1.343 + size_t init_promo_size, 1.344 + size_t init_survivor_size, 1.345 + double gc_pause_goal_sec, 1.346 + uint gc_cost_ratio); 1.347 + 1.348 + // Return number default GC threads to use in the next GC. 1.349 + static int calc_default_active_workers(uintx total_workers, 1.350 + const uintx min_workers, 1.351 + uintx active_workers, 1.352 + uintx application_workers); 1.353 + 1.354 + // Return number of GC threads to use in the next GC. 1.355 + // This is called sparingly so as not to change the 1.356 + // number of GC workers gratuitously. 1.357 + // For ParNew collections 1.358 + // For PS scavenge and ParOld collections 1.359 + // For G1 evacuation pauses (subject to update) 1.360 + // Other collection phases inherit the number of 1.361 + // GC workers from the calls above. For example, 1.362 + // a CMS parallel remark uses the same number of GC 1.363 + // workers as the most recent ParNew collection. 1.364 + static int calc_active_workers(uintx total_workers, 1.365 + uintx active_workers, 1.366 + uintx application_workers); 1.367 + 1.368 + // Return number of GC threads to use in the next concurrent GC phase. 1.369 + static int calc_active_conc_workers(uintx total_workers, 1.370 + uintx active_workers, 1.371 + uintx application_workers); 1.372 + 1.373 + bool is_gc_cms_adaptive_size_policy() { 1.374 + return kind() == _gc_cms_adaptive_size_policy; 1.375 + } 1.376 + bool is_gc_ps_adaptive_size_policy() { 1.377 + return kind() == _gc_ps_adaptive_size_policy; 1.378 + } 1.379 + 1.380 + AdaptivePaddedAverage* avg_minor_pause() const { return _avg_minor_pause; } 1.381 + AdaptiveWeightedAverage* avg_minor_interval() const { 1.382 + return _avg_minor_interval; 1.383 + } 1.384 + AdaptiveWeightedAverage* avg_minor_gc_cost() const { 1.385 + return _avg_minor_gc_cost; 1.386 + } 1.387 + 1.388 + AdaptiveWeightedAverage* avg_major_gc_cost() const { 1.389 + return _avg_major_gc_cost; 1.390 + } 1.391 + 1.392 + AdaptiveWeightedAverage* avg_young_live() const { return _avg_young_live; } 1.393 + AdaptiveWeightedAverage* avg_eden_live() const { return _avg_eden_live; } 1.394 + AdaptiveWeightedAverage* avg_old_live() const { return _avg_old_live; } 1.395 + 1.396 + AdaptivePaddedAverage* avg_survived() const { return _avg_survived; } 1.397 + AdaptivePaddedNoZeroDevAverage* avg_pretenured() { return _avg_pretenured; } 1.398 + 1.399 + // Methods indicating events of interest to the adaptive size policy, 1.400 + // called by GC algorithms. It is the responsibility of users of this 1.401 + // policy to call these methods at the correct times! 1.402 + virtual void minor_collection_begin(); 1.403 + virtual void minor_collection_end(GCCause::Cause gc_cause); 1.404 + virtual LinearLeastSquareFit* minor_pause_old_estimator() const { 1.405 + return _minor_pause_old_estimator; 1.406 + } 1.407 + 1.408 + LinearLeastSquareFit* minor_pause_young_estimator() { 1.409 + return _minor_pause_young_estimator; 1.410 + } 1.411 + LinearLeastSquareFit* minor_collection_estimator() { 1.412 + return _minor_collection_estimator; 1.413 + } 1.414 + 1.415 + LinearLeastSquareFit* major_collection_estimator() { 1.416 + return _major_collection_estimator; 1.417 + } 1.418 + 1.419 + float minor_pause_young_slope() { 1.420 + return _minor_pause_young_estimator->slope(); 1.421 + } 1.422 + 1.423 + float minor_collection_slope() { return _minor_collection_estimator->slope();} 1.424 + float major_collection_slope() { return _major_collection_estimator->slope();} 1.425 + 1.426 + float minor_pause_old_slope() { 1.427 + return _minor_pause_old_estimator->slope(); 1.428 + } 1.429 + 1.430 + void set_eden_size(size_t new_size) { 1.431 + _eden_size = new_size; 1.432 + } 1.433 + void set_survivor_size(size_t new_size) { 1.434 + _survivor_size = new_size; 1.435 + } 1.436 + 1.437 + size_t calculated_eden_size_in_bytes() const { 1.438 + return _eden_size; 1.439 + } 1.440 + 1.441 + size_t calculated_promo_size_in_bytes() const { 1.442 + return _promo_size; 1.443 + } 1.444 + 1.445 + size_t calculated_survivor_size_in_bytes() const { 1.446 + return _survivor_size; 1.447 + } 1.448 + 1.449 + // This is a hint for the heap: we've detected that gc times 1.450 + // are taking longer than GCTimeLimit allows. 1.451 + // Most heaps will choose to throw an OutOfMemoryError when 1.452 + // this occurs but it is up to the heap to request this information 1.453 + // of the policy 1.454 + bool gc_overhead_limit_exceeded() { 1.455 + return _gc_overhead_limit_exceeded; 1.456 + } 1.457 + void set_gc_overhead_limit_exceeded(bool v) { 1.458 + _gc_overhead_limit_exceeded = v; 1.459 + } 1.460 + 1.461 + // Tests conditions indicate the GC overhead limit is being approached. 1.462 + bool gc_overhead_limit_near() { 1.463 + return gc_overhead_limit_count() >= 1.464 + (AdaptiveSizePolicyGCTimeLimitThreshold - 1); 1.465 + } 1.466 + uint gc_overhead_limit_count() { return _gc_overhead_limit_count; } 1.467 + void reset_gc_overhead_limit_count() { _gc_overhead_limit_count = 0; } 1.468 + void inc_gc_overhead_limit_count() { _gc_overhead_limit_count++; } 1.469 + // accessors for flags recording the decisions to resize the 1.470 + // generations to meet the pause goal. 1.471 + 1.472 + int change_young_gen_for_min_pauses() const { 1.473 + return _change_young_gen_for_min_pauses; 1.474 + } 1.475 + void set_change_young_gen_for_min_pauses(int v) { 1.476 + _change_young_gen_for_min_pauses = v; 1.477 + } 1.478 + void set_decrease_for_footprint(int v) { _decrease_for_footprint = v; } 1.479 + int decrease_for_footprint() const { return _decrease_for_footprint; } 1.480 + int decide_at_full_gc() { return _decide_at_full_gc; } 1.481 + void set_decide_at_full_gc(int v) { _decide_at_full_gc = v; } 1.482 + 1.483 + // Check the conditions for an out-of-memory due to excessive GC time. 1.484 + // Set _gc_overhead_limit_exceeded if all the conditions have been met. 1.485 + void check_gc_overhead_limit(size_t young_live, 1.486 + size_t eden_live, 1.487 + size_t max_old_gen_size, 1.488 + size_t max_eden_size, 1.489 + bool is_full_gc, 1.490 + GCCause::Cause gc_cause, 1.491 + CollectorPolicy* collector_policy); 1.492 + 1.493 + // Printing support 1.494 + virtual bool print_adaptive_size_policy_on(outputStream* st) const; 1.495 + bool print_adaptive_size_policy_on(outputStream* st, 1.496 + uint tenuring_threshold) const; 1.497 +}; 1.498 + 1.499 +// Class that can be used to print information about the 1.500 +// adaptive size policy at intervals specified by 1.501 +// AdaptiveSizePolicyOutputInterval. Only print information 1.502 +// if an adaptive size policy is in use. 1.503 +class AdaptiveSizePolicyOutput : StackObj { 1.504 + AdaptiveSizePolicy* _size_policy; 1.505 + bool _do_print; 1.506 + bool print_test(uint count) { 1.507 + // A count of zero is a special value that indicates that the 1.508 + // interval test should be ignored. An interval is of zero is 1.509 + // a special value that indicates that the interval test should 1.510 + // always fail (never do the print based on the interval test). 1.511 + return PrintGCDetails && 1.512 + UseAdaptiveSizePolicy && 1.513 + (UseParallelGC || UseConcMarkSweepGC) && 1.514 + (AdaptiveSizePolicyOutputInterval > 0) && 1.515 + ((count == 0) || 1.516 + ((count % AdaptiveSizePolicyOutputInterval) == 0)); 1.517 + } 1.518 + public: 1.519 + // The special value of a zero count can be used to ignore 1.520 + // the count test. 1.521 + AdaptiveSizePolicyOutput(uint count) { 1.522 + if (UseAdaptiveSizePolicy && (AdaptiveSizePolicyOutputInterval > 0)) { 1.523 + CollectedHeap* heap = Universe::heap(); 1.524 + _size_policy = heap->size_policy(); 1.525 + _do_print = print_test(count); 1.526 + } else { 1.527 + _size_policy = NULL; 1.528 + _do_print = false; 1.529 + } 1.530 + } 1.531 + AdaptiveSizePolicyOutput(AdaptiveSizePolicy* size_policy, 1.532 + uint count) : 1.533 + _size_policy(size_policy) { 1.534 + if (UseAdaptiveSizePolicy && (AdaptiveSizePolicyOutputInterval > 0)) { 1.535 + _do_print = print_test(count); 1.536 + } else { 1.537 + _do_print = false; 1.538 + } 1.539 + } 1.540 + ~AdaptiveSizePolicyOutput() { 1.541 + if (_do_print) { 1.542 + assert(UseAdaptiveSizePolicy, "Should not be in use"); 1.543 + _size_policy->print_adaptive_size_policy_on(gclog_or_tty); 1.544 + } 1.545 + } 1.546 +}; 1.547 + 1.548 +#endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_ADAPTIVESIZEPOLICY_HPP