annotate src/share/vm/gc_implementation/shared/adaptiveSizePolicy.hpp @ 1972:f95d63e2154a

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