annotate src/share/vm/gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.cpp @ 1091:6aa7255741f3

6906727: UseCompressedOops: some card-marking fixes related to object arrays Summary: Introduced a new write_ref_array(HeapWords* start, size_t count) method that does the requisite MemRegion range calculation so (some of the) clients of the erstwhile write_ref_array(MemRegion mr) do not need to worry. This removed all external uses of array_size(), which was also simplified and made private. Asserts were added to catch other possible issues. Further, less essential, fixes stemming from this investigation are deferred to CR 6904516 (to follow shortly in hs17). Reviewed-by: kvn, coleenp, jmasa
author ysr
date Thu, 03 Dec 2009 15:01:57 -0800
parents a61af66fc99e
children 473cce303f13
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
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,
a61af66fc99e Initial load
duke
parents:
diff changeset
54 PerfData::U_Bytes, (jlong) Arguments::initial_heap_size(), CHECK);
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");
a61af66fc99e Initial load
duke
parents:
diff changeset
120 _gc_time_limit_exceeded = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
121 PerfData::U_Events, ps_size_policy()->gc_time_limit_exceeded(), CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
122
a61af66fc99e Initial load
duke
parents:
diff changeset
123 cname = PerfDataManager::counter_name(name_space(), "liveAtLastFullGc");
a61af66fc99e Initial load
duke
parents:
diff changeset
124 _live_at_last_full_gc = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
125 PerfData::U_Bytes, ps_size_policy()->live_at_last_full_gc(), CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
126
a61af66fc99e Initial load
duke
parents:
diff changeset
127 cname = PerfDataManager::counter_name(name_space(), "majorPauseOldSlope");
a61af66fc99e Initial load
duke
parents:
diff changeset
128 _major_pause_old_slope = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
129 PerfData::U_None, (jlong) 0, CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
130
a61af66fc99e Initial load
duke
parents:
diff changeset
131 cname = PerfDataManager::counter_name(name_space(), "minorPauseOldSlope");
a61af66fc99e Initial load
duke
parents:
diff changeset
132 _minor_pause_old_slope = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
133 PerfData::U_None, (jlong) 0, CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
134
a61af66fc99e Initial load
duke
parents:
diff changeset
135 cname = PerfDataManager::counter_name(name_space(), "majorPauseYoungSlope");
a61af66fc99e Initial load
duke
parents:
diff changeset
136 _major_pause_young_slope = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
137 PerfData::U_None, (jlong) 0, CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
138
a61af66fc99e Initial load
duke
parents:
diff changeset
139 cname = PerfDataManager::counter_name(name_space(), "scavengeSkipped");
a61af66fc99e Initial load
duke
parents:
diff changeset
140 _scavenge_skipped = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
141 PerfData::U_Bytes, (jlong) 0, CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
142
a61af66fc99e Initial load
duke
parents:
diff changeset
143 cname = PerfDataManager::counter_name(name_space(), "fullFollowsScavenge");
a61af66fc99e Initial load
duke
parents:
diff changeset
144 _full_follows_scavenge = PerfDataManager::create_variable(SUN_GC, cname,
a61af66fc99e Initial load
duke
parents:
diff changeset
145 PerfData::U_Bytes, (jlong) 0, CHECK);
a61af66fc99e Initial load
duke
parents:
diff changeset
146
a61af66fc99e Initial load
duke
parents:
diff changeset
147 _counter_time_stamp.update();
a61af66fc99e Initial load
duke
parents:
diff changeset
148 }
a61af66fc99e Initial load
duke
parents:
diff changeset
149
a61af66fc99e Initial load
duke
parents:
diff changeset
150 assert(size_policy()->is_gc_ps_adaptive_size_policy(),
a61af66fc99e Initial load
duke
parents:
diff changeset
151 "Wrong type of size policy");
a61af66fc99e Initial load
duke
parents:
diff changeset
152 }
a61af66fc99e Initial load
duke
parents:
diff changeset
153
a61af66fc99e Initial load
duke
parents:
diff changeset
154 void PSGCAdaptivePolicyCounters::update_counters_from_policy() {
a61af66fc99e Initial load
duke
parents:
diff changeset
155 if (UsePerfData) {
a61af66fc99e Initial load
duke
parents:
diff changeset
156 GCAdaptivePolicyCounters::update_counters_from_policy();
a61af66fc99e Initial load
duke
parents:
diff changeset
157 update_eden_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
158 update_promo_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
159 update_avg_old_live();
a61af66fc99e Initial load
duke
parents:
diff changeset
160 update_survivor_size_counters();
a61af66fc99e Initial load
duke
parents:
diff changeset
161 update_avg_promoted_avg();
a61af66fc99e Initial load
duke
parents:
diff changeset
162 update_avg_promoted_dev();
a61af66fc99e Initial load
duke
parents:
diff changeset
163 update_avg_promoted_padded_avg();
a61af66fc99e Initial load
duke
parents:
diff changeset
164 update_avg_pretenured_padded_avg();
a61af66fc99e Initial load
duke
parents:
diff changeset
165
a61af66fc99e Initial load
duke
parents:
diff changeset
166 update_avg_major_pause();
a61af66fc99e Initial load
duke
parents:
diff changeset
167 update_avg_major_interval();
a61af66fc99e Initial load
duke
parents:
diff changeset
168 update_minor_gc_cost_counter();
a61af66fc99e Initial load
duke
parents:
diff changeset
169 update_major_gc_cost_counter();
a61af66fc99e Initial load
duke
parents:
diff changeset
170 update_mutator_cost_counter();
a61af66fc99e Initial load
duke
parents:
diff changeset
171 update_decrement_tenuring_threshold_for_gc_cost();
a61af66fc99e Initial load
duke
parents:
diff changeset
172 update_increment_tenuring_threshold_for_gc_cost();
a61af66fc99e Initial load
duke
parents:
diff changeset
173 update_decrement_tenuring_threshold_for_survivor_limit();
a61af66fc99e Initial load
duke
parents:
diff changeset
174 update_live_space();
a61af66fc99e Initial load
duke
parents:
diff changeset
175 update_free_space();
a61af66fc99e Initial load
duke
parents:
diff changeset
176 update_avg_base_footprint();
a61af66fc99e Initial load
duke
parents:
diff changeset
177
a61af66fc99e Initial load
duke
parents:
diff changeset
178 update_change_old_gen_for_maj_pauses();
a61af66fc99e Initial load
duke
parents:
diff changeset
179 update_change_young_gen_for_maj_pauses();
a61af66fc99e Initial load
duke
parents:
diff changeset
180 update_change_old_gen_for_min_pauses();
a61af66fc99e Initial load
duke
parents:
diff changeset
181
a61af66fc99e Initial load
duke
parents:
diff changeset
182 update_change_old_gen_for_throughput();
a61af66fc99e Initial load
duke
parents:
diff changeset
183 update_change_young_gen_for_throughput();
a61af66fc99e Initial load
duke
parents:
diff changeset
184
a61af66fc99e Initial load
duke
parents:
diff changeset
185 update_decrease_for_footprint();
a61af66fc99e Initial load
duke
parents:
diff changeset
186 update_decide_at_full_gc_counter();
a61af66fc99e Initial load
duke
parents:
diff changeset
187
a61af66fc99e Initial load
duke
parents:
diff changeset
188 update_major_pause_old_slope();
a61af66fc99e Initial load
duke
parents:
diff changeset
189 update_minor_pause_old_slope();
a61af66fc99e Initial load
duke
parents:
diff changeset
190 update_major_pause_young_slope();
a61af66fc99e Initial load
duke
parents:
diff changeset
191 update_minor_collection_slope_counter();
a61af66fc99e Initial load
duke
parents:
diff changeset
192 }
a61af66fc99e Initial load
duke
parents:
diff changeset
193 }
a61af66fc99e Initial load
duke
parents:
diff changeset
194
a61af66fc99e Initial load
duke
parents:
diff changeset
195 void PSGCAdaptivePolicyCounters::update_counters() {
a61af66fc99e Initial load
duke
parents:
diff changeset
196 if (UsePerfData) {
a61af66fc99e Initial load
duke
parents:
diff changeset
197 update_counters_from_policy();
a61af66fc99e Initial load
duke
parents:
diff changeset
198 }
a61af66fc99e Initial load
duke
parents:
diff changeset
199 }