Mercurial > hg > truffle
annotate src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp @ 13422:55dd6e77b399
8028624: [TESTBUG] compiler/intrinsics/mathexact/DecExactLTest executes DecExactITest
Reviewed-by: kvn, twisti
author | rbackman |
---|---|
date | Fri, 22 Nov 2013 15:26:37 +0100 |
parents | 8f07aa079343 |
children | 63a4eb8bcd23 a034dc5e910b |
rev | line source |
---|---|
0 | 1 /* |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1387
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1387
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1387
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "gc_implementation/parallelScavenge/psAdaptiveSizePolicy.hpp" | |
27 #include "gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.hpp" | |
28 #include "gc_implementation/parallelScavenge/psScavenge.hpp" | |
29 #include "gc_implementation/shared/gcPolicyCounters.hpp" | |
30 #include "gc_interface/gcCause.hpp" | |
31 #include "memory/collectorPolicy.hpp" | |
32 #include "runtime/timer.hpp" | |
33 #include "utilities/top.hpp" | |
0 | 34 |
35 #include <math.h> | |
36 | |
37 PSAdaptiveSizePolicy::PSAdaptiveSizePolicy(size_t init_eden_size, | |
38 size_t init_promo_size, | |
39 size_t init_survivor_size, | |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
40 size_t space_alignment, |
0 | 41 double gc_pause_goal_sec, |
42 double gc_minor_pause_goal_sec, | |
43 uint gc_cost_ratio) : | |
44 AdaptiveSizePolicy(init_eden_size, | |
45 init_promo_size, | |
46 init_survivor_size, | |
47 gc_pause_goal_sec, | |
48 gc_cost_ratio), | |
13059
46d7652b223c
8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents:
12351
diff
changeset
|
49 _collection_cost_margin_fraction(AdaptiveSizePolicyCollectionCostMargin / 100.0), |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
50 _space_alignment(space_alignment), |
0 | 51 _live_at_last_full_gc(init_promo_size), |
52 _gc_minor_pause_goal_sec(gc_minor_pause_goal_sec), | |
53 _latest_major_mutator_interval_seconds(0), | |
54 _young_gen_change_for_major_pause_count(0) | |
55 { | |
56 // Sizing policy statistics | |
57 _avg_major_pause = | |
58 new AdaptivePaddedAverage(AdaptiveTimeWeight, PausePadding); | |
59 _avg_minor_interval = new AdaptiveWeightedAverage(AdaptiveTimeWeight); | |
60 _avg_major_interval = new AdaptiveWeightedAverage(AdaptiveTimeWeight); | |
61 | |
62 _avg_base_footprint = new AdaptiveWeightedAverage(AdaptiveSizePolicyWeight); | |
63 _major_pause_old_estimator = | |
64 new LinearLeastSquareFit(AdaptiveSizePolicyWeight); | |
65 _major_pause_young_estimator = | |
66 new LinearLeastSquareFit(AdaptiveSizePolicyWeight); | |
67 _major_collection_estimator = | |
68 new LinearLeastSquareFit(AdaptiveSizePolicyWeight); | |
69 | |
70 _young_gen_size_increment_supplement = YoungGenerationSizeSupplement; | |
71 _old_gen_size_increment_supplement = TenuredGenerationSizeSupplement; | |
72 | |
73 // Start the timers | |
74 _major_timer.start(); | |
75 | |
76 _old_gen_policy_is_ready = false; | |
77 } | |
78 | |
79 void PSAdaptiveSizePolicy::major_collection_begin() { | |
80 // Update the interval time | |
81 _major_timer.stop(); | |
82 // Save most recent collection time | |
83 _latest_major_mutator_interval_seconds = _major_timer.seconds(); | |
84 _major_timer.reset(); | |
85 _major_timer.start(); | |
86 } | |
87 | |
88 void PSAdaptiveSizePolicy::update_minor_pause_old_estimator( | |
89 double minor_pause_in_ms) { | |
90 double promo_size_in_mbytes = ((double)_promo_size)/((double)M); | |
91 _minor_pause_old_estimator->update(promo_size_in_mbytes, | |
92 minor_pause_in_ms); | |
93 } | |
94 | |
95 void PSAdaptiveSizePolicy::major_collection_end(size_t amount_live, | |
96 GCCause::Cause gc_cause) { | |
97 // Update the pause time. | |
98 _major_timer.stop(); | |
99 | |
100 if (gc_cause != GCCause::_java_lang_system_gc || | |
101 UseAdaptiveSizePolicyWithSystemGC) { | |
102 double major_pause_in_seconds = _major_timer.seconds(); | |
103 double major_pause_in_ms = major_pause_in_seconds * MILLIUNITS; | |
104 | |
105 // Sample for performance counter | |
106 _avg_major_pause->sample(major_pause_in_seconds); | |
107 | |
108 // Cost of collection (unit-less) | |
109 double collection_cost = 0.0; | |
110 if ((_latest_major_mutator_interval_seconds > 0.0) && | |
111 (major_pause_in_seconds > 0.0)) { | |
112 double interval_in_seconds = | |
113 _latest_major_mutator_interval_seconds + major_pause_in_seconds; | |
114 collection_cost = | |
115 major_pause_in_seconds / interval_in_seconds; | |
116 avg_major_gc_cost()->sample(collection_cost); | |
117 | |
118 // Sample for performance counter | |
119 _avg_major_interval->sample(interval_in_seconds); | |
120 } | |
121 | |
122 // Calculate variables used to estimate pause time vs. gen sizes | |
123 double eden_size_in_mbytes = ((double)_eden_size)/((double)M); | |
124 double promo_size_in_mbytes = ((double)_promo_size)/((double)M); | |
125 _major_pause_old_estimator->update(promo_size_in_mbytes, | |
126 major_pause_in_ms); | |
127 _major_pause_young_estimator->update(eden_size_in_mbytes, | |
128 major_pause_in_ms); | |
129 | |
130 if (PrintAdaptiveSizePolicy && Verbose) { | |
131 gclog_or_tty->print("psAdaptiveSizePolicy::major_collection_end: " | |
132 "major gc cost: %f average: %f", collection_cost, | |
133 avg_major_gc_cost()->average()); | |
134 gclog_or_tty->print_cr(" major pause: %f major period %f", | |
135 major_pause_in_ms, | |
136 _latest_major_mutator_interval_seconds * MILLIUNITS); | |
137 } | |
138 | |
139 // Calculate variable used to estimate collection cost vs. gen sizes | |
140 assert(collection_cost >= 0.0, "Expected to be non-negative"); | |
141 _major_collection_estimator->update(promo_size_in_mbytes, | |
142 collection_cost); | |
143 } | |
144 | |
145 // Update the amount live at the end of a full GC | |
146 _live_at_last_full_gc = amount_live; | |
147 | |
148 // The policy does not have enough data until at least some major collections | |
149 // have been done. | |
150 if (_avg_major_pause->count() >= AdaptiveSizePolicyReadyThreshold) { | |
151 _old_gen_policy_is_ready = true; | |
152 } | |
153 | |
154 // Interval times use this timer to measure the interval that | |
155 // the mutator runs. Reset after the GC pause has been measured. | |
156 _major_timer.reset(); | |
157 _major_timer.start(); | |
158 } | |
159 | |
160 // If the remaining free space in the old generation is less that | |
161 // that expected to be needed by the next collection, do a full | |
162 // collection now. | |
163 bool PSAdaptiveSizePolicy::should_full_GC(size_t old_free_in_bytes) { | |
164 | |
165 // A similar test is done in the scavenge's should_attempt_scavenge(). If | |
166 // this is changed, decide if that test should also be changed. | |
167 bool result = padded_average_promoted_in_bytes() > (float) old_free_in_bytes; | |
168 if (PrintGCDetails && Verbose) { | |
169 if (result) { | |
170 gclog_or_tty->print(" full after scavenge: "); | |
171 } else { | |
172 gclog_or_tty->print(" no full after scavenge: "); | |
173 } | |
174 gclog_or_tty->print_cr(" average_promoted " SIZE_FORMAT | |
175 " padded_average_promoted " SIZE_FORMAT | |
176 " free in old gen " SIZE_FORMAT, | |
177 (size_t) average_promoted_in_bytes(), | |
178 (size_t) padded_average_promoted_in_bytes(), | |
179 old_free_in_bytes); | |
180 } | |
181 return result; | |
182 } | |
183 | |
184 void PSAdaptiveSizePolicy::clear_generation_free_space_flags() { | |
185 | |
186 AdaptiveSizePolicy::clear_generation_free_space_flags(); | |
187 | |
188 set_change_old_gen_for_min_pauses(0); | |
189 | |
190 set_change_young_gen_for_maj_pauses(0); | |
191 } | |
192 | |
193 // If this is not a full GC, only test and modify the young generation. | |
194 | |
10359
14d3f71f831d
8007762: Rename a bunch of methods in size policy across collectors
tamao
parents:
10288
diff
changeset
|
195 void PSAdaptiveSizePolicy::compute_generations_free_space( |
1387
0bfd3fb24150
6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents:
0
diff
changeset
|
196 size_t young_live, |
0bfd3fb24150
6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents:
0
diff
changeset
|
197 size_t eden_live, |
0bfd3fb24150
6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents:
0
diff
changeset
|
198 size_t old_live, |
0bfd3fb24150
6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents:
0
diff
changeset
|
199 size_t cur_eden, |
0bfd3fb24150
6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents:
0
diff
changeset
|
200 size_t max_old_gen_size, |
0bfd3fb24150
6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents:
0
diff
changeset
|
201 size_t max_eden_size, |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
202 bool is_full_gc) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
203 compute_eden_space_size(young_live, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
204 eden_live, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
205 cur_eden, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
206 max_eden_size, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
207 is_full_gc); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
208 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
209 compute_old_gen_free_space(old_live, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
210 cur_eden, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
211 max_old_gen_size, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
212 is_full_gc); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
213 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
214 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
215 void PSAdaptiveSizePolicy::compute_eden_space_size( |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
216 size_t young_live, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
217 size_t eden_live, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
218 size_t cur_eden, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
219 size_t max_eden_size, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
220 bool is_full_gc) { |
0 | 221 |
222 // Update statistics | |
223 // Time statistics are updated as we go, update footprint stats here | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
1972
diff
changeset
|
224 _avg_base_footprint->sample(BaseFootPrintEstimate); |
0 | 225 avg_young_live()->sample(young_live); |
226 avg_eden_live()->sample(eden_live); | |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
227 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
228 // This code used to return if the policy was not ready , i.e., |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
229 // policy_is_ready() returning false. The intent was that |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
230 // decisions below needed major collection times and so could |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
231 // not be made before two major collections. A consequence was |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
232 // adjustments to the young generation were not done until after |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
233 // two major collections even if the minor collections times |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
234 // exceeded the requested goals. Now let the young generation |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
235 // adjust for the minor collection times. Major collection times |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
236 // will be zero for the first collection and will naturally be |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
237 // ignored. Tenured generation adjustments are only made at the |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
238 // full collections so until the second major collection has |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
239 // been reached, no tenured generation adjustments will be made. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
240 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
241 // Until we know better, desired promotion size uses the last calculation |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
242 size_t desired_promo_size = _promo_size; |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
243 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
244 // Start eden at the current value. The desired value that is stored |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
245 // in _eden_size is not bounded by constraints of the heap and can |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
246 // run away. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
247 // |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
248 // As expected setting desired_eden_size to the current |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
249 // value of desired_eden_size as a starting point |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
250 // caused desired_eden_size to grow way too large and caused |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
251 // an overflow down stream. It may have improved performance in |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
252 // some case but is dangerous. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
253 size_t desired_eden_size = cur_eden; |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
254 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
255 // Cache some values. There's a bit of work getting these, so |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
256 // we might save a little time. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
257 const double major_cost = major_gc_cost(); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
258 const double minor_cost = minor_gc_cost(); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
259 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
260 // This method sets the desired eden size. That plus the |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
261 // desired survivor space sizes sets the desired young generation |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
262 // size. This methods does not know what the desired survivor |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
263 // size is but expects that other policy will attempt to make |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
264 // the survivor sizes compatible with the live data in the |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
265 // young generation. This limit is an estimate of the space left |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
266 // in the young generation after the survivor spaces have been |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
267 // subtracted out. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
268 size_t eden_limit = max_eden_size; |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
269 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
270 const double gc_cost_limit = GCTimeLimit/100.0; |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
271 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
272 // Which way should we go? |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
273 // if pause requirement is not met |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
274 // adjust size of any generation with average paus exceeding |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
275 // the pause limit. Adjust one pause at a time (the larger) |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
276 // and only make adjustments for the major pause at full collections. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
277 // else if throughput requirement not met |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
278 // adjust the size of the generation with larger gc time. Only |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
279 // adjust one generation at a time. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
280 // else |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
281 // adjust down the total heap size. Adjust down the larger of the |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
282 // generations. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
283 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
284 // Add some checks for a threshold for a change. For example, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
285 // a change less than the necessary alignment is probably not worth |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
286 // attempting. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
287 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
288 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
289 if ((_avg_minor_pause->padded_average() > gc_pause_goal_sec()) || |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
290 (_avg_major_pause->padded_average() > gc_pause_goal_sec())) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
291 // |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
292 // Check pauses |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
293 // |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
294 // Make changes only to affect one of the pauses (the larger) |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
295 // at a time. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
296 adjust_eden_for_pause_time(is_full_gc, &desired_promo_size, &desired_eden_size); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
297 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
298 } else if (_avg_minor_pause->padded_average() > gc_minor_pause_goal_sec()) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
299 // Adjust only for the minor pause time goal |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
300 adjust_eden_for_minor_pause_time(is_full_gc, &desired_eden_size); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
301 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
302 } else if(adjusted_mutator_cost() < _throughput_goal) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
303 // This branch used to require that (mutator_cost() > 0.0 in 1.4.2. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
304 // This sometimes resulted in skipping to the minimize footprint |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
305 // code. Change this to try and reduce GC time if mutator time is |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
306 // negative for whatever reason. Or for future consideration, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
307 // bail out of the code if mutator time is negative. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
308 // |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
309 // Throughput |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
310 // |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
311 assert(major_cost >= 0.0, "major cost is < 0.0"); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
312 assert(minor_cost >= 0.0, "minor cost is < 0.0"); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
313 // Try to reduce the GC times. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
314 adjust_eden_for_throughput(is_full_gc, &desired_eden_size); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
315 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
316 } else { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
317 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
318 // Be conservative about reducing the footprint. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
319 // Do a minimum number of major collections first. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
320 // Have reasonable averages for major and minor collections costs. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
321 if (UseAdaptiveSizePolicyFootprintGoal && |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
322 young_gen_policy_is_ready() && |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
323 avg_major_gc_cost()->average() >= 0.0 && |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
324 avg_minor_gc_cost()->average() >= 0.0) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
325 size_t desired_sum = desired_eden_size + desired_promo_size; |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
326 desired_eden_size = adjust_eden_for_footprint(desired_eden_size, desired_sum); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
327 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
328 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
329 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
330 // Note we make the same tests as in the code block below; the code |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
331 // seems a little easier to read with the printing in another block. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
332 if (PrintAdaptiveSizePolicy) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
333 if (desired_eden_size > eden_limit) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
334 gclog_or_tty->print_cr( |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
335 "PSAdaptiveSizePolicy::compute_eden_space_size limits:" |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
336 " desired_eden_size: " SIZE_FORMAT |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
337 " old_eden_size: " SIZE_FORMAT |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
338 " eden_limit: " SIZE_FORMAT |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
339 " cur_eden: " SIZE_FORMAT |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
340 " max_eden_size: " SIZE_FORMAT |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
341 " avg_young_live: " SIZE_FORMAT, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
342 desired_eden_size, _eden_size, eden_limit, cur_eden, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
343 max_eden_size, (size_t)avg_young_live()->average()); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
344 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
345 if (gc_cost() > gc_cost_limit) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
346 gclog_or_tty->print_cr( |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
347 "PSAdaptiveSizePolicy::compute_eden_space_size: gc time limit" |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
348 " gc_cost: %f " |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
349 " GCTimeLimit: %d", |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
350 gc_cost(), GCTimeLimit); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
351 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
352 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
353 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
354 // Align everything and make a final limit check |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
355 desired_eden_size = align_size_up(desired_eden_size, _space_alignment); |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
356 desired_eden_size = MAX2(desired_eden_size, _space_alignment); |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
357 |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
358 eden_limit = align_size_down(eden_limit, _space_alignment); |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
359 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
360 // And one last limit check, now that we've aligned things. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
361 if (desired_eden_size > eden_limit) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
362 // If the policy says to get a larger eden but |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
363 // is hitting the limit, don't decrease eden. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
364 // This can lead to a general drifting down of the |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
365 // eden size. Let the tenuring calculation push more |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
366 // into the old gen. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
367 desired_eden_size = MAX2(eden_limit, cur_eden); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
368 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
369 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
370 if (PrintAdaptiveSizePolicy) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
371 // Timing stats |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
372 gclog_or_tty->print( |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
373 "PSAdaptiveSizePolicy::compute_eden_space_size: costs" |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
374 " minor_time: %f" |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
375 " major_cost: %f" |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
376 " mutator_cost: %f" |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
377 " throughput_goal: %f", |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
378 minor_gc_cost(), major_gc_cost(), mutator_cost(), |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
379 _throughput_goal); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
380 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
381 // We give more details if Verbose is set |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
382 if (Verbose) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
383 gclog_or_tty->print( " minor_pause: %f" |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
384 " major_pause: %f" |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
385 " minor_interval: %f" |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
386 " major_interval: %f" |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
387 " pause_goal: %f", |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
388 _avg_minor_pause->padded_average(), |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
389 _avg_major_pause->padded_average(), |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
390 _avg_minor_interval->average(), |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
391 _avg_major_interval->average(), |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
392 gc_pause_goal_sec()); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
393 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
394 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
395 // Footprint stats |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
396 gclog_or_tty->print( " live_space: " SIZE_FORMAT |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
397 " free_space: " SIZE_FORMAT, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
398 live_space(), free_space()); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
399 // More detail |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
400 if (Verbose) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
401 gclog_or_tty->print( " base_footprint: " SIZE_FORMAT |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
402 " avg_young_live: " SIZE_FORMAT |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
403 " avg_old_live: " SIZE_FORMAT, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
404 (size_t)_avg_base_footprint->average(), |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
405 (size_t)avg_young_live()->average(), |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
406 (size_t)avg_old_live()->average()); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
407 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
408 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
409 // And finally, our old and new sizes. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
410 gclog_or_tty->print(" old_eden_size: " SIZE_FORMAT |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
411 " desired_eden_size: " SIZE_FORMAT, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
412 _eden_size, desired_eden_size); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
413 gclog_or_tty->cr(); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
414 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
415 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
416 set_eden_size(desired_eden_size); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
417 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
418 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
419 void PSAdaptiveSizePolicy::compute_old_gen_free_space( |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
420 size_t old_live, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
421 size_t cur_eden, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
422 size_t max_old_gen_size, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
423 bool is_full_gc) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
424 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
425 // Update statistics |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
426 // Time statistics are updated as we go, update footprint stats here |
0 | 427 if (is_full_gc) { |
428 // old_live is only accurate after a full gc | |
429 avg_old_live()->sample(old_live); | |
430 } | |
431 | |
432 // This code used to return if the policy was not ready , i.e., | |
433 // policy_is_ready() returning false. The intent was that | |
434 // decisions below needed major collection times and so could | |
435 // not be made before two major collections. A consequence was | |
436 // adjustments to the young generation were not done until after | |
437 // two major collections even if the minor collections times | |
438 // exceeded the requested goals. Now let the young generation | |
439 // adjust for the minor collection times. Major collection times | |
440 // will be zero for the first collection and will naturally be | |
441 // ignored. Tenured generation adjustments are only made at the | |
442 // full collections so until the second major collection has | |
443 // been reached, no tenured generation adjustments will be made. | |
444 | |
445 // Until we know better, desired promotion size uses the last calculation | |
446 size_t desired_promo_size = _promo_size; | |
447 | |
448 // Start eden at the current value. The desired value that is stored | |
449 // in _eden_size is not bounded by constraints of the heap and can | |
450 // run away. | |
451 // | |
452 // As expected setting desired_eden_size to the current | |
453 // value of desired_eden_size as a starting point | |
454 // caused desired_eden_size to grow way too large and caused | |
455 // an overflow down stream. It may have improved performance in | |
456 // some case but is dangerous. | |
457 size_t desired_eden_size = cur_eden; | |
458 | |
459 // Cache some values. There's a bit of work getting these, so | |
460 // we might save a little time. | |
461 const double major_cost = major_gc_cost(); | |
462 const double minor_cost = minor_gc_cost(); | |
463 | |
464 // Limits on our growth | |
465 size_t promo_limit = (size_t)(max_old_gen_size - avg_old_live()->average()); | |
466 | |
467 // But don't force a promo size below the current promo size. Otherwise, | |
468 // the promo size will shrink for no good reason. | |
469 promo_limit = MAX2(promo_limit, _promo_size); | |
470 | |
471 const double gc_cost_limit = GCTimeLimit/100.0; | |
472 | |
473 // Which way should we go? | |
474 // if pause requirement is not met | |
475 // adjust size of any generation with average paus exceeding | |
476 // the pause limit. Adjust one pause at a time (the larger) | |
477 // and only make adjustments for the major pause at full collections. | |
478 // else if throughput requirement not met | |
479 // adjust the size of the generation with larger gc time. Only | |
480 // adjust one generation at a time. | |
481 // else | |
482 // adjust down the total heap size. Adjust down the larger of the | |
483 // generations. | |
484 | |
485 // Add some checks for a threshhold for a change. For example, | |
486 // a change less than the necessary alignment is probably not worth | |
487 // attempting. | |
488 | |
489 if ((_avg_minor_pause->padded_average() > gc_pause_goal_sec()) || | |
490 (_avg_major_pause->padded_average() > gc_pause_goal_sec())) { | |
491 // | |
492 // Check pauses | |
493 // | |
494 // Make changes only to affect one of the pauses (the larger) | |
495 // at a time. | |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
496 if (is_full_gc) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
497 set_decide_at_full_gc(decide_at_full_gc_true); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
498 adjust_promo_for_pause_time(is_full_gc, &desired_promo_size, &desired_eden_size); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
499 } |
0 | 500 } else if (_avg_minor_pause->padded_average() > gc_minor_pause_goal_sec()) { |
501 // Adjust only for the minor pause time goal | |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
502 adjust_promo_for_minor_pause_time(is_full_gc, &desired_promo_size, &desired_eden_size); |
0 | 503 } else if(adjusted_mutator_cost() < _throughput_goal) { |
504 // This branch used to require that (mutator_cost() > 0.0 in 1.4.2. | |
505 // This sometimes resulted in skipping to the minimize footprint | |
506 // code. Change this to try and reduce GC time if mutator time is | |
507 // negative for whatever reason. Or for future consideration, | |
508 // bail out of the code if mutator time is negative. | |
509 // | |
510 // Throughput | |
511 // | |
512 assert(major_cost >= 0.0, "major cost is < 0.0"); | |
513 assert(minor_cost >= 0.0, "minor cost is < 0.0"); | |
514 // Try to reduce the GC times. | |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
515 if (is_full_gc) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
516 set_decide_at_full_gc(decide_at_full_gc_true); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
517 adjust_promo_for_throughput(is_full_gc, &desired_promo_size); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
518 } |
0 | 519 } else { |
520 | |
521 // Be conservative about reducing the footprint. | |
522 // Do a minimum number of major collections first. | |
523 // Have reasonable averages for major and minor collections costs. | |
524 if (UseAdaptiveSizePolicyFootprintGoal && | |
525 young_gen_policy_is_ready() && | |
526 avg_major_gc_cost()->average() >= 0.0 && | |
527 avg_minor_gc_cost()->average() >= 0.0) { | |
528 if (is_full_gc) { | |
529 set_decide_at_full_gc(decide_at_full_gc_true); | |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
530 size_t desired_sum = desired_eden_size + desired_promo_size; |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
531 desired_promo_size = adjust_promo_for_footprint(desired_promo_size, desired_sum); |
0 | 532 } |
533 } | |
534 } | |
535 | |
536 // Note we make the same tests as in the code block below; the code | |
537 // seems a little easier to read with the printing in another block. | |
538 if (PrintAdaptiveSizePolicy) { | |
539 if (desired_promo_size > promo_limit) { | |
540 // "free_in_old_gen" was the original value for used for promo_limit | |
541 size_t free_in_old_gen = (size_t)(max_old_gen_size - avg_old_live()->average()); | |
542 gclog_or_tty->print_cr( | |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
543 "PSAdaptiveSizePolicy::compute_old_gen_free_space limits:" |
0 | 544 " desired_promo_size: " SIZE_FORMAT |
545 " promo_limit: " SIZE_FORMAT | |
546 " free_in_old_gen: " SIZE_FORMAT | |
547 " max_old_gen_size: " SIZE_FORMAT | |
548 " avg_old_live: " SIZE_FORMAT, | |
549 desired_promo_size, promo_limit, free_in_old_gen, | |
550 max_old_gen_size, (size_t) avg_old_live()->average()); | |
551 } | |
552 if (gc_cost() > gc_cost_limit) { | |
553 gclog_or_tty->print_cr( | |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
554 "PSAdaptiveSizePolicy::compute_old_gen_free_space: gc time limit" |
0 | 555 " gc_cost: %f " |
556 " GCTimeLimit: %d", | |
557 gc_cost(), GCTimeLimit); | |
558 } | |
559 } | |
560 | |
561 // Align everything and make a final limit check | |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
562 desired_promo_size = align_size_up(desired_promo_size, _space_alignment); |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
563 desired_promo_size = MAX2(desired_promo_size, _space_alignment); |
0 | 564 |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
565 promo_limit = align_size_down(promo_limit, _space_alignment); |
0 | 566 |
567 // And one last limit check, now that we've aligned things. | |
568 desired_promo_size = MIN2(desired_promo_size, promo_limit); | |
569 | |
570 if (PrintAdaptiveSizePolicy) { | |
571 // Timing stats | |
572 gclog_or_tty->print( | |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
573 "PSAdaptiveSizePolicy::compute_old_gen_free_space: costs" |
0 | 574 " minor_time: %f" |
575 " major_cost: %f" | |
576 " mutator_cost: %f" | |
577 " throughput_goal: %f", | |
578 minor_gc_cost(), major_gc_cost(), mutator_cost(), | |
579 _throughput_goal); | |
580 | |
581 // We give more details if Verbose is set | |
582 if (Verbose) { | |
583 gclog_or_tty->print( " minor_pause: %f" | |
584 " major_pause: %f" | |
585 " minor_interval: %f" | |
586 " major_interval: %f" | |
587 " pause_goal: %f", | |
588 _avg_minor_pause->padded_average(), | |
589 _avg_major_pause->padded_average(), | |
590 _avg_minor_interval->average(), | |
591 _avg_major_interval->average(), | |
592 gc_pause_goal_sec()); | |
593 } | |
594 | |
595 // Footprint stats | |
596 gclog_or_tty->print( " live_space: " SIZE_FORMAT | |
597 " free_space: " SIZE_FORMAT, | |
598 live_space(), free_space()); | |
599 // More detail | |
600 if (Verbose) { | |
601 gclog_or_tty->print( " base_footprint: " SIZE_FORMAT | |
602 " avg_young_live: " SIZE_FORMAT | |
603 " avg_old_live: " SIZE_FORMAT, | |
604 (size_t)_avg_base_footprint->average(), | |
605 (size_t)avg_young_live()->average(), | |
606 (size_t)avg_old_live()->average()); | |
607 } | |
608 | |
609 // And finally, our old and new sizes. | |
610 gclog_or_tty->print(" old_promo_size: " SIZE_FORMAT | |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
611 " desired_promo_size: " SIZE_FORMAT, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
612 _promo_size, desired_promo_size); |
0 | 613 gclog_or_tty->cr(); |
614 } | |
615 | |
616 set_promo_size(desired_promo_size); | |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
617 } |
0 | 618 |
619 void PSAdaptiveSizePolicy::decay_supplemental_growth(bool is_full_gc) { | |
620 // Decay the supplemental increment? Decay the supplement growth | |
621 // factor even if it is not used. It is only meant to give a boost | |
622 // to the initial growth and if it is not used, then it was not | |
623 // needed. | |
624 if (is_full_gc) { | |
625 // Don't wait for the threshold value for the major collections. If | |
626 // here, the supplemental growth term was used and should decay. | |
627 if ((_avg_major_pause->count() % TenuredGenerationSizeSupplementDecay) | |
628 == 0) { | |
629 _old_gen_size_increment_supplement = | |
630 _old_gen_size_increment_supplement >> 1; | |
631 } | |
632 } else { | |
633 if ((_avg_minor_pause->count() >= AdaptiveSizePolicyReadyThreshold) && | |
634 (_avg_minor_pause->count() % YoungGenerationSizeSupplementDecay) == 0) { | |
635 _young_gen_size_increment_supplement = | |
636 _young_gen_size_increment_supplement >> 1; | |
637 } | |
638 } | |
639 } | |
640 | |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
641 void PSAdaptiveSizePolicy::adjust_promo_for_minor_pause_time(bool is_full_gc, |
0 | 642 size_t* desired_promo_size_ptr, size_t* desired_eden_size_ptr) { |
643 | |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
644 if (PSAdjustTenuredGenForMinorPause) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
645 if (is_full_gc) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
646 set_decide_at_full_gc(decide_at_full_gc_true); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
647 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
648 // If the desired eden size is as small as it will get, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
649 // try to adjust the old gen size. |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
650 if (*desired_eden_size_ptr <= _space_alignment) { |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
651 // Vary the old gen size to reduce the young gen pause. This |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
652 // may not be a good idea. This is just a test. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
653 if (minor_pause_old_estimator()->decrement_will_decrease()) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
654 set_change_old_gen_for_min_pauses(decrease_old_gen_for_min_pauses_true); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
655 *desired_promo_size_ptr = |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
656 _promo_size - promo_decrement_aligned_down(*desired_promo_size_ptr); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
657 } else { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
658 set_change_old_gen_for_min_pauses(increase_old_gen_for_min_pauses_true); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
659 size_t promo_heap_delta = |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
660 promo_increment_with_supplement_aligned_up(*desired_promo_size_ptr); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
661 if ((*desired_promo_size_ptr + promo_heap_delta) > |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
662 *desired_promo_size_ptr) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
663 *desired_promo_size_ptr = |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
664 _promo_size + promo_heap_delta; |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
665 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
666 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
667 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
668 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
669 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
670 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
671 void PSAdaptiveSizePolicy::adjust_eden_for_minor_pause_time(bool is_full_gc, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
672 size_t* desired_eden_size_ptr) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
673 |
0 | 674 // Adjust the young generation size to reduce pause time of |
675 // of collections. | |
676 // | |
677 // The AdaptiveSizePolicyInitializingSteps test is not used | |
678 // here. It has not seemed to be needed but perhaps should | |
679 // be added for consistency. | |
680 if (minor_pause_young_estimator()->decrement_will_decrease()) { | |
681 // reduce eden size | |
682 set_change_young_gen_for_min_pauses( | |
683 decrease_young_gen_for_min_pauses_true); | |
684 *desired_eden_size_ptr = *desired_eden_size_ptr - | |
685 eden_decrement_aligned_down(*desired_eden_size_ptr); | |
686 } else { | |
687 // EXPERIMENTAL ADJUSTMENT | |
688 // Only record that the estimator indicated such an action. | |
689 // *desired_eden_size_ptr = *desired_eden_size_ptr + eden_heap_delta; | |
690 set_change_young_gen_for_min_pauses( | |
691 increase_young_gen_for_min_pauses_true); | |
692 } | |
693 } | |
694 | |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
695 void PSAdaptiveSizePolicy::adjust_promo_for_pause_time(bool is_full_gc, |
0 | 696 size_t* desired_promo_size_ptr, |
697 size_t* desired_eden_size_ptr) { | |
698 | |
699 size_t promo_heap_delta = 0; | |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
700 // Add some checks for a threshold for a change. For example, |
0 | 701 // a change less than the required alignment is probably not worth |
702 // attempting. | |
703 | |
704 if (_avg_minor_pause->padded_average() > _avg_major_pause->padded_average()) { | |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
705 adjust_promo_for_minor_pause_time(is_full_gc, desired_promo_size_ptr, desired_eden_size_ptr); |
0 | 706 // major pause adjustments |
707 } else if (is_full_gc) { | |
708 // Adjust for the major pause time only at full gc's because the | |
709 // affects of a change can only be seen at full gc's. | |
710 | |
711 // Reduce old generation size to reduce pause? | |
712 if (major_pause_old_estimator()->decrement_will_decrease()) { | |
713 // reduce old generation size | |
714 set_change_old_gen_for_maj_pauses(decrease_old_gen_for_maj_pauses_true); | |
715 promo_heap_delta = promo_decrement_aligned_down(*desired_promo_size_ptr); | |
716 *desired_promo_size_ptr = _promo_size - promo_heap_delta; | |
717 } else { | |
718 // EXPERIMENTAL ADJUSTMENT | |
719 // Only record that the estimator indicated such an action. | |
720 // *desired_promo_size_ptr = _promo_size + | |
721 // promo_increment_aligned_up(*desired_promo_size_ptr); | |
722 set_change_old_gen_for_maj_pauses(increase_old_gen_for_maj_pauses_true); | |
723 } | |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
724 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
725 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
726 if (PrintAdaptiveSizePolicy && Verbose) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
727 gclog_or_tty->print_cr( |
10359
14d3f71f831d
8007762: Rename a bunch of methods in size policy across collectors
tamao
parents:
10288
diff
changeset
|
728 "PSAdaptiveSizePolicy::adjust_promo_for_pause_time " |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
729 "adjusting gen sizes for major pause (avg %f goal %f). " |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
730 "desired_promo_size " SIZE_FORMAT " promo delta " SIZE_FORMAT, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
731 _avg_major_pause->average(), gc_pause_goal_sec(), |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
732 *desired_promo_size_ptr, promo_heap_delta); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
733 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
734 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
735 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
736 void PSAdaptiveSizePolicy::adjust_eden_for_pause_time(bool is_full_gc, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
737 size_t* desired_promo_size_ptr, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
738 size_t* desired_eden_size_ptr) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
739 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
740 size_t eden_heap_delta = 0; |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
741 // Add some checks for a threshold for a change. For example, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
742 // a change less than the required alignment is probably not worth |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
743 // attempting. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
744 if (_avg_minor_pause->padded_average() > _avg_major_pause->padded_average()) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
745 adjust_eden_for_minor_pause_time(is_full_gc, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
746 desired_eden_size_ptr); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
747 // major pause adjustments |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
748 } else if (is_full_gc) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
749 // Adjust for the major pause time only at full gc's because the |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
750 // affects of a change can only be seen at full gc's. |
0 | 751 if (PSAdjustYoungGenForMajorPause) { |
752 // If the promo size is at the minimum (i.e., the old gen | |
753 // size will not actually decrease), consider changing the | |
754 // young gen size. | |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
755 if (*desired_promo_size_ptr < _space_alignment) { |
0 | 756 // If increasing the young generation will decrease the old gen |
757 // pause, do it. | |
758 // During startup there is noise in the statistics for deciding | |
759 // on whether to increase or decrease the young gen size. For | |
760 // some number of iterations, just try to increase the young | |
761 // gen size if the major pause is too long to try and establish | |
762 // good statistics for later decisions. | |
763 if (major_pause_young_estimator()->increment_will_decrease() || | |
764 (_young_gen_change_for_major_pause_count | |
765 <= AdaptiveSizePolicyInitializingSteps)) { | |
766 set_change_young_gen_for_maj_pauses( | |
767 increase_young_gen_for_maj_pauses_true); | |
768 eden_heap_delta = eden_increment_aligned_up(*desired_eden_size_ptr); | |
769 *desired_eden_size_ptr = _eden_size + eden_heap_delta; | |
770 _young_gen_change_for_major_pause_count++; | |
771 } else { | |
772 // Record that decreasing the young gen size would decrease | |
773 // the major pause | |
774 set_change_young_gen_for_maj_pauses( | |
775 decrease_young_gen_for_maj_pauses_true); | |
776 eden_heap_delta = eden_decrement_aligned_down(*desired_eden_size_ptr); | |
777 *desired_eden_size_ptr = _eden_size - eden_heap_delta; | |
778 } | |
779 } | |
780 } | |
781 } | |
782 | |
783 if (PrintAdaptiveSizePolicy && Verbose) { | |
784 gclog_or_tty->print_cr( | |
10359
14d3f71f831d
8007762: Rename a bunch of methods in size policy across collectors
tamao
parents:
10288
diff
changeset
|
785 "PSAdaptiveSizePolicy::adjust_eden_for_pause_time " |
0 | 786 "adjusting gen sizes for major pause (avg %f goal %f). " |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
787 "desired_eden_size " SIZE_FORMAT " eden delta " SIZE_FORMAT, |
0 | 788 _avg_major_pause->average(), gc_pause_goal_sec(), |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
789 *desired_eden_size_ptr, eden_heap_delta); |
0 | 790 } |
791 } | |
792 | |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
793 void PSAdaptiveSizePolicy::adjust_promo_for_throughput(bool is_full_gc, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
794 size_t* desired_promo_size_ptr) { |
0 | 795 |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
796 // Add some checks for a threshold for a change. For example, |
0 | 797 // a change less than the required alignment is probably not worth |
798 // attempting. | |
799 | |
800 if ((gc_cost() + mutator_cost()) == 0.0) { | |
801 return; | |
802 } | |
803 | |
804 if (PrintAdaptiveSizePolicy && Verbose) { | |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
805 gclog_or_tty->print("\nPSAdaptiveSizePolicy::adjust_promo_for_throughput(" |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
806 "is_full: %d, promo: " SIZE_FORMAT "): ", |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
807 is_full_gc, *desired_promo_size_ptr); |
0 | 808 gclog_or_tty->print_cr("mutator_cost %f major_gc_cost %f " |
809 "minor_gc_cost %f", mutator_cost(), major_gc_cost(), minor_gc_cost()); | |
810 } | |
811 | |
812 // Tenured generation | |
813 if (is_full_gc) { | |
814 // Calculate the change to use for the tenured gen. | |
815 size_t scaled_promo_heap_delta = 0; | |
816 // Can the increment to the generation be scaled? | |
817 if (gc_cost() >= 0.0 && major_gc_cost() >= 0.0) { | |
818 size_t promo_heap_delta = | |
819 promo_increment_with_supplement_aligned_up(*desired_promo_size_ptr); | |
820 double scale_by_ratio = major_gc_cost() / gc_cost(); | |
821 scaled_promo_heap_delta = | |
822 (size_t) (scale_by_ratio * (double) promo_heap_delta); | |
823 if (PrintAdaptiveSizePolicy && Verbose) { | |
824 gclog_or_tty->print_cr( | |
825 "Scaled tenured increment: " SIZE_FORMAT " by %f down to " | |
826 SIZE_FORMAT, | |
827 promo_heap_delta, scale_by_ratio, scaled_promo_heap_delta); | |
828 } | |
829 } else if (major_gc_cost() >= 0.0) { | |
830 // Scaling is not going to work. If the major gc time is the | |
831 // larger, give it a full increment. | |
832 if (major_gc_cost() >= minor_gc_cost()) { | |
833 scaled_promo_heap_delta = | |
834 promo_increment_with_supplement_aligned_up(*desired_promo_size_ptr); | |
835 } | |
836 } else { | |
837 // Don't expect to get here but it's ok if it does | |
838 // in the product build since the delta will be 0 | |
839 // and nothing will change. | |
840 assert(false, "Unexpected value for gc costs"); | |
841 } | |
842 | |
843 switch (AdaptiveSizeThroughPutPolicy) { | |
844 case 1: | |
845 // Early in the run the statistics might not be good. Until | |
846 // a specific number of collections have been, use the heuristic | |
847 // that a larger generation size means lower collection costs. | |
848 if (major_collection_estimator()->increment_will_decrease() || | |
849 (_old_gen_change_for_major_throughput | |
850 <= AdaptiveSizePolicyInitializingSteps)) { | |
851 // Increase tenured generation size to reduce major collection cost | |
852 if ((*desired_promo_size_ptr + scaled_promo_heap_delta) > | |
853 *desired_promo_size_ptr) { | |
854 *desired_promo_size_ptr = _promo_size + scaled_promo_heap_delta; | |
855 } | |
856 set_change_old_gen_for_throughput( | |
857 increase_old_gen_for_throughput_true); | |
858 _old_gen_change_for_major_throughput++; | |
859 } else { | |
860 // EXPERIMENTAL ADJUSTMENT | |
861 // Record that decreasing the old gen size would decrease | |
862 // the major collection cost but don't do it. | |
863 // *desired_promo_size_ptr = _promo_size - | |
864 // promo_decrement_aligned_down(*desired_promo_size_ptr); | |
865 set_change_old_gen_for_throughput( | |
866 decrease_old_gen_for_throughput_true); | |
867 } | |
868 | |
869 break; | |
870 default: | |
871 // Simplest strategy | |
872 if ((*desired_promo_size_ptr + scaled_promo_heap_delta) > | |
873 *desired_promo_size_ptr) { | |
874 *desired_promo_size_ptr = *desired_promo_size_ptr + | |
875 scaled_promo_heap_delta; | |
876 } | |
877 set_change_old_gen_for_throughput( | |
878 increase_old_gen_for_throughput_true); | |
879 _old_gen_change_for_major_throughput++; | |
880 } | |
881 | |
882 if (PrintAdaptiveSizePolicy && Verbose) { | |
883 gclog_or_tty->print_cr( | |
884 "adjusting tenured gen for throughput (avg %f goal %f). " | |
885 "desired_promo_size " SIZE_FORMAT " promo_delta " SIZE_FORMAT , | |
886 mutator_cost(), _throughput_goal, | |
887 *desired_promo_size_ptr, scaled_promo_heap_delta); | |
888 } | |
889 } | |
10288
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
890 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
891 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
892 void PSAdaptiveSizePolicy::adjust_eden_for_throughput(bool is_full_gc, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
893 size_t* desired_eden_size_ptr) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
894 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
895 // Add some checks for a threshold for a change. For example, |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
896 // a change less than the required alignment is probably not worth |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
897 // attempting. |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
898 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
899 if ((gc_cost() + mutator_cost()) == 0.0) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
900 return; |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
901 } |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
902 |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
903 if (PrintAdaptiveSizePolicy && Verbose) { |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
904 gclog_or_tty->print("\nPSAdaptiveSizePolicy::adjust_eden_for_throughput(" |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
905 "is_full: %d, cur_eden: " SIZE_FORMAT "): ", |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
906 is_full_gc, *desired_eden_size_ptr); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
907 gclog_or_tty->print_cr("mutator_cost %f major_gc_cost %f " |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
908 "minor_gc_cost %f", mutator_cost(), major_gc_cost(), minor_gc_cost()); |
eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents:
6818
diff
changeset
|
909 } |
0 | 910 |
911 // Young generation | |
912 size_t scaled_eden_heap_delta = 0; | |
913 // Can the increment to the generation be scaled? | |
914 if (gc_cost() >= 0.0 && minor_gc_cost() >= 0.0) { | |
915 size_t eden_heap_delta = | |
916 eden_increment_with_supplement_aligned_up(*desired_eden_size_ptr); | |
917 double scale_by_ratio = minor_gc_cost() / gc_cost(); | |
918 assert(scale_by_ratio <= 1.0 && scale_by_ratio >= 0.0, "Scaling is wrong"); | |
919 scaled_eden_heap_delta = | |
920 (size_t) (scale_by_ratio * (double) eden_heap_delta); | |
921 if (PrintAdaptiveSizePolicy && Verbose) { | |
922 gclog_or_tty->print_cr( | |
923 "Scaled eden increment: " SIZE_FORMAT " by %f down to " | |
924 SIZE_FORMAT, | |
925 eden_heap_delta, scale_by_ratio, scaled_eden_heap_delta); | |
926 } | |
927 } else if (minor_gc_cost() >= 0.0) { | |
928 // Scaling is not going to work. If the minor gc time is the | |
929 // larger, give it a full increment. | |
930 if (minor_gc_cost() > major_gc_cost()) { | |
931 scaled_eden_heap_delta = | |
932 eden_increment_with_supplement_aligned_up(*desired_eden_size_ptr); | |
933 } | |
934 } else { | |
935 // Don't expect to get here but it's ok if it does | |
936 // in the product build since the delta will be 0 | |
937 // and nothing will change. | |
938 assert(false, "Unexpected value for gc costs"); | |
939 } | |
940 | |
941 // Use a heuristic for some number of collections to give | |
942 // the averages time to settle down. | |
943 switch (AdaptiveSizeThroughPutPolicy) { | |
944 case 1: | |
945 if (minor_collection_estimator()->increment_will_decrease() || | |
946 (_young_gen_change_for_minor_throughput | |
947 <= AdaptiveSizePolicyInitializingSteps)) { | |
948 // Expand young generation size to reduce frequency of | |
949 // of collections. | |
950 if ((*desired_eden_size_ptr + scaled_eden_heap_delta) > | |
951 *desired_eden_size_ptr) { | |
952 *desired_eden_size_ptr = | |
953 *desired_eden_size_ptr + scaled_eden_heap_delta; | |
954 } | |
955 set_change_young_gen_for_throughput( | |
956 increase_young_gen_for_througput_true); | |
957 _young_gen_change_for_minor_throughput++; | |
958 } else { | |
959 // EXPERIMENTAL ADJUSTMENT | |
960 // Record that decreasing the young gen size would decrease | |
961 // the minor collection cost but don't do it. | |
962 // *desired_eden_size_ptr = _eden_size - | |
963 // eden_decrement_aligned_down(*desired_eden_size_ptr); | |
964 set_change_young_gen_for_throughput( | |
965 decrease_young_gen_for_througput_true); | |
966 } | |
967 break; | |
968 default: | |
969 if ((*desired_eden_size_ptr + scaled_eden_heap_delta) > | |
970 *desired_eden_size_ptr) { | |
971 *desired_eden_size_ptr = | |
972 *desired_eden_size_ptr + scaled_eden_heap_delta; | |
973 } | |
974 set_change_young_gen_for_throughput( | |
975 increase_young_gen_for_througput_true); | |
976 _young_gen_change_for_minor_throughput++; | |
977 } | |
978 | |
979 if (PrintAdaptiveSizePolicy && Verbose) { | |
980 gclog_or_tty->print_cr( | |
981 "adjusting eden for throughput (avg %f goal %f). desired_eden_size " | |
982 SIZE_FORMAT " eden delta " SIZE_FORMAT "\n", | |
983 mutator_cost(), _throughput_goal, | |
984 *desired_eden_size_ptr, scaled_eden_heap_delta); | |
985 } | |
986 } | |
987 | |
988 size_t PSAdaptiveSizePolicy::adjust_promo_for_footprint( | |
989 size_t desired_promo_size, size_t desired_sum) { | |
990 assert(desired_promo_size <= desired_sum, "Inconsistent parameters"); | |
991 set_decrease_for_footprint(decrease_old_gen_for_footprint_true); | |
992 | |
993 size_t change = promo_decrement(desired_promo_size); | |
994 change = scale_down(change, desired_promo_size, desired_sum); | |
995 | |
996 size_t reduced_size = desired_promo_size - change; | |
997 | |
998 if (PrintAdaptiveSizePolicy && Verbose) { | |
999 gclog_or_tty->print_cr( | |
10359
14d3f71f831d
8007762: Rename a bunch of methods in size policy across collectors
tamao
parents:
10288
diff
changeset
|
1000 "AdaptiveSizePolicy::adjust_promo_for_footprint " |
0 | 1001 "adjusting tenured gen for footprint. " |
1002 "starting promo size " SIZE_FORMAT | |
1003 " reduced promo size " SIZE_FORMAT, | |
1004 " promo delta " SIZE_FORMAT, | |
1005 desired_promo_size, reduced_size, change ); | |
1006 } | |
1007 | |
1008 assert(reduced_size <= desired_promo_size, "Inconsistent result"); | |
1009 return reduced_size; | |
1010 } | |
1011 | |
1012 size_t PSAdaptiveSizePolicy::adjust_eden_for_footprint( | |
1013 size_t desired_eden_size, size_t desired_sum) { | |
1014 assert(desired_eden_size <= desired_sum, "Inconsistent parameters"); | |
1015 set_decrease_for_footprint(decrease_young_gen_for_footprint_true); | |
1016 | |
1017 size_t change = eden_decrement(desired_eden_size); | |
1018 change = scale_down(change, desired_eden_size, desired_sum); | |
1019 | |
1020 size_t reduced_size = desired_eden_size - change; | |
1021 | |
1022 if (PrintAdaptiveSizePolicy && Verbose) { | |
1023 gclog_or_tty->print_cr( | |
10359
14d3f71f831d
8007762: Rename a bunch of methods in size policy across collectors
tamao
parents:
10288
diff
changeset
|
1024 "AdaptiveSizePolicy::adjust_eden_for_footprint " |
0 | 1025 "adjusting eden for footprint. " |
1026 " starting eden size " SIZE_FORMAT | |
1027 " reduced eden size " SIZE_FORMAT | |
1028 " eden delta " SIZE_FORMAT, | |
1029 desired_eden_size, reduced_size, change); | |
1030 } | |
1031 | |
1032 assert(reduced_size <= desired_eden_size, "Inconsistent result"); | |
1033 return reduced_size; | |
1034 } | |
1035 | |
1036 // Scale down "change" by the factor | |
1037 // part / total | |
1038 // Don't align the results. | |
1039 | |
1040 size_t PSAdaptiveSizePolicy::scale_down(size_t change, | |
1041 double part, | |
1042 double total) { | |
1043 assert(part <= total, "Inconsistent input"); | |
1044 size_t reduced_change = change; | |
1045 if (total > 0) { | |
1046 double fraction = part / total; | |
1047 reduced_change = (size_t) (fraction * (double) change); | |
1048 } | |
1049 assert(reduced_change <= change, "Inconsistent result"); | |
1050 return reduced_change; | |
1051 } | |
1052 | |
1053 size_t PSAdaptiveSizePolicy::eden_increment(size_t cur_eden, | |
1054 uint percent_change) { | |
1055 size_t eden_heap_delta; | |
1056 eden_heap_delta = cur_eden / 100 * percent_change; | |
1057 return eden_heap_delta; | |
1058 } | |
1059 | |
1060 size_t PSAdaptiveSizePolicy::eden_increment(size_t cur_eden) { | |
1061 return eden_increment(cur_eden, YoungGenerationSizeIncrement); | |
1062 } | |
1063 | |
1064 size_t PSAdaptiveSizePolicy::eden_increment_aligned_up(size_t cur_eden) { | |
1065 size_t result = eden_increment(cur_eden, YoungGenerationSizeIncrement); | |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
1066 return align_size_up(result, _space_alignment); |
0 | 1067 } |
1068 | |
1069 size_t PSAdaptiveSizePolicy::eden_increment_aligned_down(size_t cur_eden) { | |
1070 size_t result = eden_increment(cur_eden); | |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
1071 return align_size_down(result, _space_alignment); |
0 | 1072 } |
1073 | |
1074 size_t PSAdaptiveSizePolicy::eden_increment_with_supplement_aligned_up( | |
1075 size_t cur_eden) { | |
1076 size_t result = eden_increment(cur_eden, | |
1077 YoungGenerationSizeIncrement + _young_gen_size_increment_supplement); | |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
1078 return align_size_up(result, _space_alignment); |
0 | 1079 } |
1080 | |
1081 size_t PSAdaptiveSizePolicy::eden_decrement_aligned_down(size_t cur_eden) { | |
1082 size_t eden_heap_delta = eden_decrement(cur_eden); | |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
1083 return align_size_down(eden_heap_delta, _space_alignment); |
0 | 1084 } |
1085 | |
1086 size_t PSAdaptiveSizePolicy::eden_decrement(size_t cur_eden) { | |
1087 size_t eden_heap_delta = eden_increment(cur_eden) / | |
1088 AdaptiveSizeDecrementScaleFactor; | |
1089 return eden_heap_delta; | |
1090 } | |
1091 | |
1092 size_t PSAdaptiveSizePolicy::promo_increment(size_t cur_promo, | |
1093 uint percent_change) { | |
1094 size_t promo_heap_delta; | |
1095 promo_heap_delta = cur_promo / 100 * percent_change; | |
1096 return promo_heap_delta; | |
1097 } | |
1098 | |
1099 size_t PSAdaptiveSizePolicy::promo_increment(size_t cur_promo) { | |
1100 return promo_increment(cur_promo, TenuredGenerationSizeIncrement); | |
1101 } | |
1102 | |
1103 size_t PSAdaptiveSizePolicy::promo_increment_aligned_up(size_t cur_promo) { | |
1104 size_t result = promo_increment(cur_promo, TenuredGenerationSizeIncrement); | |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
1105 return align_size_up(result, _space_alignment); |
0 | 1106 } |
1107 | |
1108 size_t PSAdaptiveSizePolicy::promo_increment_aligned_down(size_t cur_promo) { | |
1109 size_t result = promo_increment(cur_promo, TenuredGenerationSizeIncrement); | |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
1110 return align_size_down(result, _space_alignment); |
0 | 1111 } |
1112 | |
1113 size_t PSAdaptiveSizePolicy::promo_increment_with_supplement_aligned_up( | |
1114 size_t cur_promo) { | |
1115 size_t result = promo_increment(cur_promo, | |
1116 TenuredGenerationSizeIncrement + _old_gen_size_increment_supplement); | |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
1117 return align_size_up(result, _space_alignment); |
0 | 1118 } |
1119 | |
1120 size_t PSAdaptiveSizePolicy::promo_decrement_aligned_down(size_t cur_promo) { | |
1121 size_t promo_heap_delta = promo_decrement(cur_promo); | |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
1122 return align_size_down(promo_heap_delta, _space_alignment); |
0 | 1123 } |
1124 | |
1125 size_t PSAdaptiveSizePolicy::promo_decrement(size_t cur_promo) { | |
1126 size_t promo_heap_delta = promo_increment(cur_promo); | |
1127 promo_heap_delta = promo_heap_delta / AdaptiveSizeDecrementScaleFactor; | |
1128 return promo_heap_delta; | |
1129 } | |
1130 | |
6818 | 1131 uint PSAdaptiveSizePolicy::compute_survivor_space_size_and_threshold( |
0 | 1132 bool is_survivor_overflow, |
6818 | 1133 uint tenuring_threshold, |
0 | 1134 size_t survivor_limit) { |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
1135 assert(survivor_limit >= _space_alignment, |
0 | 1136 "survivor_limit too small"); |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
1137 assert((size_t)align_size_down(survivor_limit, _space_alignment) |
0 | 1138 == survivor_limit, "survivor_limit not aligned"); |
1139 | |
1140 // This method is called even if the tenuring threshold and survivor | |
1141 // spaces are not adjusted so that the averages are sampled above. | |
1142 if (!UsePSAdaptiveSurvivorSizePolicy || | |
1143 !young_gen_policy_is_ready()) { | |
1144 return tenuring_threshold; | |
1145 } | |
1146 | |
1147 // We'll decide whether to increase or decrease the tenuring | |
1148 // threshold based partly on the newly computed survivor size | |
1149 // (if we hit the maximum limit allowed, we'll always choose to | |
1150 // decrement the threshold). | |
1151 bool incr_tenuring_threshold = false; | |
1152 bool decr_tenuring_threshold = false; | |
1153 | |
1154 set_decrement_tenuring_threshold_for_gc_cost(false); | |
1155 set_increment_tenuring_threshold_for_gc_cost(false); | |
1156 set_decrement_tenuring_threshold_for_survivor_limit(false); | |
1157 | |
1158 if (!is_survivor_overflow) { | |
1159 // Keep running averages on how much survived | |
1160 | |
1161 // We use the tenuring threshold to equalize the cost of major | |
1162 // and minor collections. | |
1163 // ThresholdTolerance is used to indicate how sensitive the | |
1164 // tenuring threshold is to differences in cost betweent the | |
1165 // collection types. | |
1166 | |
1167 // Get the times of interest. This involves a little work, so | |
1168 // we cache the values here. | |
1169 const double major_cost = major_gc_cost(); | |
1170 const double minor_cost = minor_gc_cost(); | |
1171 | |
1172 if (minor_cost > major_cost * _threshold_tolerance_percent) { | |
1173 // Minor times are getting too long; lower the threshold so | |
1174 // less survives and more is promoted. | |
1175 decr_tenuring_threshold = true; | |
1176 set_decrement_tenuring_threshold_for_gc_cost(true); | |
1177 } else if (major_cost > minor_cost * _threshold_tolerance_percent) { | |
1178 // Major times are too long, so we want less promotion. | |
1179 incr_tenuring_threshold = true; | |
1180 set_increment_tenuring_threshold_for_gc_cost(true); | |
1181 } | |
1182 | |
1183 } else { | |
1184 // Survivor space overflow occurred, so promoted and survived are | |
1185 // not accurate. We'll make our best guess by combining survived | |
1186 // and promoted and count them as survivors. | |
1187 // | |
1188 // We'll lower the tenuring threshold to see if we can correct | |
1189 // things. Also, set the survivor size conservatively. We're | |
1190 // trying to avoid many overflows from occurring if defnew size | |
1191 // is just too small. | |
1192 | |
1193 decr_tenuring_threshold = true; | |
1194 } | |
1195 | |
1196 // The padded average also maintains a deviation from the average; | |
1197 // we use this to see how good of an estimate we have of what survived. | |
1198 // We're trying to pad the survivor size as little as possible without | |
1199 // overflowing the survivor spaces. | |
1200 size_t target_size = align_size_up((size_t)_avg_survived->padded_average(), | |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
1201 _space_alignment); |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
13059
diff
changeset
|
1202 target_size = MAX2(target_size, _space_alignment); |
0 | 1203 |
1204 if (target_size > survivor_limit) { | |
1205 // Target size is bigger than we can handle. Let's also reduce | |
1206 // the tenuring threshold. | |
1207 target_size = survivor_limit; | |
1208 decr_tenuring_threshold = true; | |
1209 set_decrement_tenuring_threshold_for_survivor_limit(true); | |
1210 } | |
1211 | |
1212 // Finally, increment or decrement the tenuring threshold, as decided above. | |
1213 // We test for decrementing first, as we might have hit the target size | |
1214 // limit. | |
1215 if (decr_tenuring_threshold && !(AlwaysTenure || NeverTenure)) { | |
1216 if (tenuring_threshold > 1) { | |
1217 tenuring_threshold--; | |
1218 } | |
1219 } else if (incr_tenuring_threshold && !(AlwaysTenure || NeverTenure)) { | |
1220 if (tenuring_threshold < MaxTenuringThreshold) { | |
1221 tenuring_threshold++; | |
1222 } | |
1223 } | |
1224 | |
1225 // We keep a running average of the amount promoted which is used | |
1226 // to decide when we should collect the old generation (when | |
1227 // the amount of old gen free space is less than what we expect to | |
1228 // promote). | |
1229 | |
1230 if (PrintAdaptiveSizePolicy) { | |
1231 // A little more detail if Verbose is on | |
1232 if (Verbose) { | |
1233 gclog_or_tty->print( " avg_survived: %f" | |
1234 " avg_deviation: %f", | |
1235 _avg_survived->average(), | |
1236 _avg_survived->deviation()); | |
1237 } | |
1238 | |
1239 gclog_or_tty->print( " avg_survived_padded_avg: %f", | |
1240 _avg_survived->padded_average()); | |
1241 | |
1242 if (Verbose) { | |
1243 gclog_or_tty->print( " avg_promoted_avg: %f" | |
1244 " avg_promoted_dev: %f", | |
1245 avg_promoted()->average(), | |
1246 avg_promoted()->deviation()); | |
1247 } | |
1248 | |
10993
493089fd29df
8015903: Format issue with -XX:+PrintAdaptiveSizePolicy on JDK8
poonam
parents:
10359
diff
changeset
|
1249 gclog_or_tty->print_cr( " avg_promoted_padded_avg: %f" |
0 | 1250 " avg_pretenured_padded_avg: %f" |
1251 " tenuring_thresh: %d" | |
1252 " target_size: " SIZE_FORMAT, | |
1253 avg_promoted()->padded_average(), | |
1254 _avg_pretenured->padded_average(), | |
1255 tenuring_threshold, target_size); | |
1256 } | |
1257 | |
1258 set_survivor_size(target_size); | |
1259 | |
1260 return tenuring_threshold; | |
1261 } | |
1262 | |
1263 void PSAdaptiveSizePolicy::update_averages(bool is_survivor_overflow, | |
1264 size_t survived, | |
1265 size_t promoted) { | |
1266 // Update averages | |
1267 if (!is_survivor_overflow) { | |
1268 // Keep running averages on how much survived | |
1269 _avg_survived->sample(survived); | |
1270 } else { | |
1271 size_t survived_guess = survived + promoted; | |
1272 _avg_survived->sample(survived_guess); | |
1273 } | |
1274 avg_promoted()->sample(promoted + _avg_pretenured->padded_average()); | |
1275 | |
1276 if (PrintAdaptiveSizePolicy) { | |
10993
493089fd29df
8015903: Format issue with -XX:+PrintAdaptiveSizePolicy on JDK8
poonam
parents:
10359
diff
changeset
|
1277 gclog_or_tty->print_cr( |
10359
14d3f71f831d
8007762: Rename a bunch of methods in size policy across collectors
tamao
parents:
10288
diff
changeset
|
1278 "AdaptiveSizePolicy::update_averages:" |
0 | 1279 " survived: " SIZE_FORMAT |
1280 " promoted: " SIZE_FORMAT | |
1281 " overflow: %s", | |
1282 survived, promoted, is_survivor_overflow ? "true" : "false"); | |
1283 } | |
1284 } | |
1285 | |
1286 bool PSAdaptiveSizePolicy::print_adaptive_size_policy_on(outputStream* st) | |
1287 const { | |
1288 | |
1289 if (!UseAdaptiveSizePolicy) return false; | |
1290 | |
1291 return AdaptiveSizePolicy::print_adaptive_size_policy_on( | |
1292 st, | |
1293 PSScavenge::tenuring_threshold()); | |
1294 } |