annotate src/share/vm/gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.cpp @ 1387:0bfd3fb24150

6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit. Summary: Ensure a full GC that clears SoftReferences before throwing an out-of-memory Reviewed-by: ysr, jcoomes
author jmasa
date Tue, 13 Apr 2010 13:52:10 -0700
parents 473cce303f13
children c18cbe5936b8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1387
0bfd3fb24150 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 1064
diff changeset
2 * Copyright 2003-2010 Sun Microsystems, Inc. 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 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 # include "incls/_precompiled.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
26 # include "incls/_psGCAdaptivePolicyCounters.cpp.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28
a61af66fc99e Initial load
duke
parents:
diff changeset
29
a61af66fc99e Initial load
duke
parents:
diff changeset
30 PSGCAdaptivePolicyCounters::PSGCAdaptivePolicyCounters(const char* name_arg,
a61af66fc99e Initial load
duke
parents:
diff changeset
31 int collectors,
a61af66fc99e Initial load
duke
parents:
diff changeset
32 int generations,
a61af66fc99e Initial load
duke
parents:
diff changeset
33 PSAdaptiveSizePolicy* size_policy_arg)
a61af66fc99e Initial load
duke
parents:
diff changeset
34 : GCAdaptivePolicyCounters(name_arg,
a61af66fc99e Initial load
duke
parents:
diff changeset
35 collectors,
a61af66fc99e Initial load
duke
parents:
diff changeset
36 generations,
a61af66fc99e Initial load
duke
parents:
diff changeset
37 size_policy_arg) {
a61af66fc99e Initial load
duke
parents:
diff changeset
38 if (UsePerfData) {
a61af66fc99e Initial load
duke
parents:
diff changeset
39 EXCEPTION_MARK;
a61af66fc99e Initial load
duke
parents:
diff changeset
40 ResourceMark rm;
a61af66fc99e Initial load
duke
parents:
diff changeset
41
a61af66fc99e Initial load
duke
parents:
diff changeset
42 const char* cname;
a61af66fc99e Initial load
duke
parents:
diff changeset
43
a61af66fc99e Initial load
duke
parents:
diff changeset
44 cname = PerfDataManager::counter_name(name_space(), "oldPromoSize");
a61af66fc99e Initial load
duke
parents:
diff changeset
45 _old_promo_size = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
46 PerfData::U_Bytes, ps_size_policy()->calculated_promo_size_in_bytes(), CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
47
a61af66fc99e Initial load
duke
parents:
diff changeset
48 cname = PerfDataManager::counter_name(name_space(), "oldEdenSize");
a61af66fc99e Initial load
duke
parents:
diff changeset
49 _old_eden_size = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
50 PerfData::U_Bytes, ps_size_policy()->calculated_eden_size_in_bytes(), CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 cname = PerfDataManager::counter_name(name_space(), "oldCapacity");
a61af66fc99e Initial load
duke
parents:
diff changeset
53 _old_capacity = PerfDataManager::create_variable(SUN_GC, cname,
1064
473cce303f13 6887571: Increase default heap config sizes
phh
parents: 0
diff changeset
54 PerfData::U_Bytes, (jlong) InitialHeapSize, CHECK);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 cname = PerfDataManager::counter_name(name_space(), "boundaryMoved");
a61af66fc99e Initial load
duke
parents:
diff changeset
57 _boundary_moved = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
58 PerfData::U_Bytes, (jlong) 0, CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
59
a61af66fc99e Initial load
duke
parents:
diff changeset
60 cname = PerfDataManager::counter_name(name_space(), "avgPromotedAvg");
a61af66fc99e Initial load
duke
parents:
diff changeset
61 _avg_promoted_avg_counter =
a61af66fc99e Initial load
duke
parents:
diff changeset
62 PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
a61af66fc99e Initial load
duke
parents:
diff changeset
63 ps_size_policy()->calculated_promo_size_in_bytes(), CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65 cname = PerfDataManager::counter_name(name_space(), "avgPromotedDev");
a61af66fc99e Initial load
duke
parents:
diff changeset
66 _avg_promoted_dev_counter =
a61af66fc99e Initial load
duke
parents:
diff changeset
67 PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
a61af66fc99e Initial load
duke
parents:
diff changeset
68 (jlong) 0 , CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 cname = PerfDataManager::counter_name(name_space(), "avgPromotedPaddedAvg");
a61af66fc99e Initial load
duke
parents:
diff changeset
71 _avg_promoted_padded_avg_counter =
a61af66fc99e Initial load
duke
parents:
diff changeset
72 PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
a61af66fc99e Initial load
duke
parents:
diff changeset
73 ps_size_policy()->calculated_promo_size_in_bytes(), CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
74
a61af66fc99e Initial load
duke
parents:
diff changeset
75 cname = PerfDataManager::counter_name(name_space(),
a61af66fc99e Initial load
duke
parents:
diff changeset
76 "avgPretenuredPaddedAvg");
a61af66fc99e Initial load
duke
parents:
diff changeset
77 _avg_pretenured_padded_avg =
a61af66fc99e Initial load
duke
parents:
diff changeset
78 PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
a61af66fc99e Initial load
duke
parents:
diff changeset
79 (jlong) 0, CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 cname = PerfDataManager::counter_name(name_space(),
a61af66fc99e Initial load
duke
parents:
diff changeset
83 "changeYoungGenForMajPauses");
a61af66fc99e Initial load
duke
parents:
diff changeset
84 _change_young_gen_for_maj_pauses_counter =
a61af66fc99e Initial load
duke
parents:
diff changeset
85 PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Events,
a61af66fc99e Initial load
duke
parents:
diff changeset
86 (jlong)0, CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
87
a61af66fc99e Initial load
duke
parents:
diff changeset
88 cname = PerfDataManager::counter_name(name_space(),
a61af66fc99e Initial load
duke
parents:
diff changeset
89 "changeOldGenForMinPauses");
a61af66fc99e Initial load
duke
parents:
diff changeset
90 _change_old_gen_for_min_pauses =
a61af66fc99e Initial load
duke
parents:
diff changeset
91 PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Events,
a61af66fc99e Initial load
duke
parents:
diff changeset
92 (jlong)0, CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
93
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 cname = PerfDataManager::counter_name(name_space(), "avgMajorPauseTime");
a61af66fc99e Initial load
duke
parents:
diff changeset
96 _avg_major_pause = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
97 PerfData::U_Ticks, (jlong) ps_size_policy()->_avg_major_pause->average(), CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 cname = PerfDataManager::counter_name(name_space(), "avgMajorIntervalTime");
a61af66fc99e Initial load
duke
parents:
diff changeset
100 _avg_major_interval = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
101 PerfData::U_Ticks, (jlong) ps_size_policy()->_avg_major_interval->average(), CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103 cname = PerfDataManager::counter_name(name_space(), "majorGcCost");
a61af66fc99e Initial load
duke
parents:
diff changeset
104 _major_gc_cost_counter = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
105 PerfData::U_Ticks, (jlong) ps_size_policy()->major_gc_cost(), CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107 cname = PerfDataManager::counter_name(name_space(), "liveSpace");
a61af66fc99e Initial load
duke
parents:
diff changeset
108 _live_space = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
109 PerfData::U_Bytes, ps_size_policy()->live_space(), CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
110
a61af66fc99e Initial load
duke
parents:
diff changeset
111 cname = PerfDataManager::counter_name(name_space(), "freeSpace");
a61af66fc99e Initial load
duke
parents:
diff changeset
112 _free_space = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
113 PerfData::U_Bytes, ps_size_policy()->free_space(), CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 cname = PerfDataManager::counter_name(name_space(), "avgBaseFootprint");
a61af66fc99e Initial load
duke
parents:
diff changeset
116 _avg_base_footprint = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
117 PerfData::U_Bytes, (jlong) ps_size_policy()->avg_base_footprint()->average(), CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
118
a61af66fc99e Initial load
duke
parents:
diff changeset
119 cname = PerfDataManager::counter_name(name_space(), "gcTimeLimitExceeded");
1387
0bfd3fb24150 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 1064
diff changeset
120 _gc_overhead_limit_exceeded_counter =
0bfd3fb24150 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 1064
diff changeset
121 PerfDataManager::create_variable(SUN_GC, cname,
0bfd3fb24150 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 1064
diff changeset
122 PerfData::U_Events, ps_size_policy()->gc_overhead_limit_exceeded(), CHECK);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
123
a61af66fc99e Initial load
duke
parents:
diff changeset
124 cname = PerfDataManager::counter_name(name_space(), "liveAtLastFullGc");
1387
0bfd3fb24150 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 1064
diff changeset
125 _live_at_last_full_gc_counter =
0bfd3fb24150 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 1064
diff changeset
126 PerfDataManager::create_variable(SUN_GC, cname,
0
a61af66fc99e Initial load
duke
parents:
diff changeset
127 PerfData::U_Bytes, ps_size_policy()->live_at_last_full_gc(), CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
128
a61af66fc99e Initial load
duke
parents:
diff changeset
129 cname = PerfDataManager::counter_name(name_space(), "majorPauseOldSlope");
a61af66fc99e Initial load
duke
parents:
diff changeset
130 _major_pause_old_slope = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
131 PerfData::U_None, (jlong) 0, CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
132
a61af66fc99e Initial load
duke
parents:
diff changeset
133 cname = PerfDataManager::counter_name(name_space(), "minorPauseOldSlope");
a61af66fc99e Initial load
duke
parents:
diff changeset
134 _minor_pause_old_slope = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
135 PerfData::U_None, (jlong) 0, CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
136
a61af66fc99e Initial load
duke
parents:
diff changeset
137 cname = PerfDataManager::counter_name(name_space(), "majorPauseYoungSlope");
a61af66fc99e Initial load
duke
parents:
diff changeset
138 _major_pause_young_slope = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
139 PerfData::U_None, (jlong) 0, CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
140
a61af66fc99e Initial load
duke
parents:
diff changeset
141 cname = PerfDataManager::counter_name(name_space(), "scavengeSkipped");
a61af66fc99e Initial load
duke
parents:
diff changeset
142 _scavenge_skipped = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
143 PerfData::U_Bytes, (jlong) 0, CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
144
a61af66fc99e Initial load
duke
parents:
diff changeset
145 cname = PerfDataManager::counter_name(name_space(), "fullFollowsScavenge");
a61af66fc99e Initial load
duke
parents:
diff changeset
146 _full_follows_scavenge = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
147 PerfData::U_Bytes, (jlong) 0, CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
148
a61af66fc99e Initial load
duke
parents:
diff changeset
149 _counter_time_stamp.update();
a61af66fc99e Initial load
duke
parents:
diff changeset
150 }
a61af66fc99e Initial load
duke
parents:
diff changeset
151
a61af66fc99e Initial load
duke
parents:
diff changeset
152 assert(size_policy()->is_gc_ps_adaptive_size_policy(),
a61af66fc99e Initial load
duke
parents:
diff changeset
153 "Wrong type of size policy");
a61af66fc99e Initial load
duke
parents:
diff changeset
154 }
a61af66fc99e Initial load
duke
parents:
diff changeset
155
a61af66fc99e Initial load
duke
parents:
diff changeset
156 void PSGCAdaptivePolicyCounters::update_counters_from_policy() {
a61af66fc99e Initial load
duke
parents:
diff changeset
157 if (UsePerfData) {
a61af66fc99e Initial load
duke
parents:
diff changeset
158 GCAdaptivePolicyCounters::update_counters_from_policy();
a61af66fc99e Initial load
duke
parents:
diff changeset
159 update_eden_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
160 update_promo_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
161 update_avg_old_live();
a61af66fc99e Initial load
duke
parents:
diff changeset
162 update_survivor_size_counters();
a61af66fc99e Initial load
duke
parents:
diff changeset
163 update_avg_promoted_avg();
a61af66fc99e Initial load
duke
parents:
diff changeset
164 update_avg_promoted_dev();
a61af66fc99e Initial load
duke
parents:
diff changeset
165 update_avg_promoted_padded_avg();
a61af66fc99e Initial load
duke
parents:
diff changeset
166 update_avg_pretenured_padded_avg();
a61af66fc99e Initial load
duke
parents:
diff changeset
167
a61af66fc99e Initial load
duke
parents:
diff changeset
168 update_avg_major_pause();
a61af66fc99e Initial load
duke
parents:
diff changeset
169 update_avg_major_interval();
a61af66fc99e Initial load
duke
parents:
diff changeset
170 update_minor_gc_cost_counter();
a61af66fc99e Initial load
duke
parents:
diff changeset
171 update_major_gc_cost_counter();
a61af66fc99e Initial load
duke
parents:
diff changeset
172 update_mutator_cost_counter();
a61af66fc99e Initial load
duke
parents:
diff changeset
173 update_decrement_tenuring_threshold_for_gc_cost();
a61af66fc99e Initial load
duke
parents:
diff changeset
174 update_increment_tenuring_threshold_for_gc_cost();
a61af66fc99e Initial load
duke
parents:
diff changeset
175 update_decrement_tenuring_threshold_for_survivor_limit();
a61af66fc99e Initial load
duke
parents:
diff changeset
176 update_live_space();
a61af66fc99e Initial load
duke
parents:
diff changeset
177 update_free_space();
a61af66fc99e Initial load
duke
parents:
diff changeset
178 update_avg_base_footprint();
a61af66fc99e Initial load
duke
parents:
diff changeset
179
a61af66fc99e Initial load
duke
parents:
diff changeset
180 update_change_old_gen_for_maj_pauses();
a61af66fc99e Initial load
duke
parents:
diff changeset
181 update_change_young_gen_for_maj_pauses();
a61af66fc99e Initial load
duke
parents:
diff changeset
182 update_change_old_gen_for_min_pauses();
a61af66fc99e Initial load
duke
parents:
diff changeset
183
a61af66fc99e Initial load
duke
parents:
diff changeset
184 update_change_old_gen_for_throughput();
a61af66fc99e Initial load
duke
parents:
diff changeset
185 update_change_young_gen_for_throughput();
a61af66fc99e Initial load
duke
parents:
diff changeset
186
a61af66fc99e Initial load
duke
parents:
diff changeset
187 update_decrease_for_footprint();
a61af66fc99e Initial load
duke
parents:
diff changeset
188 update_decide_at_full_gc_counter();
a61af66fc99e Initial load
duke
parents:
diff changeset
189
a61af66fc99e Initial load
duke
parents:
diff changeset
190 update_major_pause_old_slope();
a61af66fc99e Initial load
duke
parents:
diff changeset
191 update_minor_pause_old_slope();
a61af66fc99e Initial load
duke
parents:
diff changeset
192 update_major_pause_young_slope();
a61af66fc99e Initial load
duke
parents:
diff changeset
193 update_minor_collection_slope_counter();
1387
0bfd3fb24150 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 1064
diff changeset
194 update_gc_overhead_limit_exceeded_counter();
0bfd3fb24150 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 1064
diff changeset
195 update_live_at_last_full_gc_counter();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
196 }
a61af66fc99e Initial load
duke
parents:
diff changeset
197 }
a61af66fc99e Initial load
duke
parents:
diff changeset
198
a61af66fc99e Initial load
duke
parents:
diff changeset
199 void PSGCAdaptivePolicyCounters::update_counters() {
a61af66fc99e Initial load
duke
parents:
diff changeset
200 if (UsePerfData) {
a61af66fc99e Initial load
duke
parents:
diff changeset
201 update_counters_from_policy();
a61af66fc99e Initial load
duke
parents:
diff changeset
202 }
a61af66fc99e Initial load
duke
parents:
diff changeset
203 }