annotate src/share/vm/gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.hpp @ 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 0bfd3fb24150
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-2005 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 // PSGCAdaptivePolicyCounters is a holder class for performance counters
a61af66fc99e Initial load
duke
parents:
diff changeset
26 // that track the data and decisions for the ergonomics policy for the
a61af66fc99e Initial load
duke
parents:
diff changeset
27 // parallel scavenge collector.
a61af66fc99e Initial load
duke
parents:
diff changeset
28
a61af66fc99e Initial load
duke
parents:
diff changeset
29 class PSGCAdaptivePolicyCounters : public GCAdaptivePolicyCounters {
a61af66fc99e Initial load
duke
parents:
diff changeset
30 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
31
a61af66fc99e Initial load
duke
parents:
diff changeset
32 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // survivor space vs. tenuring threshold
a61af66fc99e Initial load
duke
parents:
diff changeset
34 PerfVariable* _old_promo_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
35 PerfVariable* _old_eden_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
36 PerfVariable* _avg_promoted_avg_counter;
a61af66fc99e Initial load
duke
parents:
diff changeset
37 PerfVariable* _avg_promoted_dev_counter;
a61af66fc99e Initial load
duke
parents:
diff changeset
38 PerfVariable* _avg_promoted_padded_avg_counter;
a61af66fc99e Initial load
duke
parents:
diff changeset
39 PerfVariable* _avg_pretenured_padded_avg;
a61af66fc99e Initial load
duke
parents:
diff changeset
40
a61af66fc99e Initial load
duke
parents:
diff changeset
41 // young gen vs. old gen sizing
a61af66fc99e Initial load
duke
parents:
diff changeset
42 PerfVariable* _avg_major_pause;
a61af66fc99e Initial load
duke
parents:
diff changeset
43 PerfVariable* _avg_major_interval;
a61af66fc99e Initial load
duke
parents:
diff changeset
44 PerfVariable* _live_space;
a61af66fc99e Initial load
duke
parents:
diff changeset
45 PerfVariable* _free_space;
a61af66fc99e Initial load
duke
parents:
diff changeset
46 PerfVariable* _avg_base_footprint;
a61af66fc99e Initial load
duke
parents:
diff changeset
47 PerfVariable* _gc_time_limit_exceeded;
a61af66fc99e Initial load
duke
parents:
diff changeset
48 PerfVariable* _live_at_last_full_gc;
a61af66fc99e Initial load
duke
parents:
diff changeset
49 PerfVariable* _old_capacity;
a61af66fc99e Initial load
duke
parents:
diff changeset
50 PerfVariable* _boundary_moved;
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 PerfVariable* _change_old_gen_for_min_pauses;
a61af66fc99e Initial load
duke
parents:
diff changeset
53 PerfVariable* _change_young_gen_for_maj_pauses_counter;
a61af66fc99e Initial load
duke
parents:
diff changeset
54
a61af66fc99e Initial load
duke
parents:
diff changeset
55 PerfVariable* _major_pause_old_slope;
a61af66fc99e Initial load
duke
parents:
diff changeset
56 PerfVariable* _minor_pause_old_slope;
a61af66fc99e Initial load
duke
parents:
diff changeset
57 PerfVariable* _major_pause_young_slope;
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 PerfVariable* _scavenge_skipped;
a61af66fc99e Initial load
duke
parents:
diff changeset
60 PerfVariable* _full_follows_scavenge;
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 // Use this time stamp if the gc time stamp is not available.
a61af66fc99e Initial load
duke
parents:
diff changeset
63 TimeStamp _counter_time_stamp;
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
66 PSAdaptiveSizePolicy* ps_size_policy() {
a61af66fc99e Initial load
duke
parents:
diff changeset
67 return (PSAdaptiveSizePolicy*)_size_policy;
a61af66fc99e Initial load
duke
parents:
diff changeset
68 }
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
71 PSGCAdaptivePolicyCounters(const char* name, int collectors, int generations,
a61af66fc99e Initial load
duke
parents:
diff changeset
72 PSAdaptiveSizePolicy* size_policy);
a61af66fc99e Initial load
duke
parents:
diff changeset
73 inline void update_old_capacity(size_t size_in_bytes) {
a61af66fc99e Initial load
duke
parents:
diff changeset
74 _old_capacity->set_value(size_in_bytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
75 }
a61af66fc99e Initial load
duke
parents:
diff changeset
76 inline void update_old_eden_size(size_t old_size) {
a61af66fc99e Initial load
duke
parents:
diff changeset
77 _old_eden_size->set_value(old_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
78 }
a61af66fc99e Initial load
duke
parents:
diff changeset
79 inline void update_old_promo_size(size_t old_size) {
a61af66fc99e Initial load
duke
parents:
diff changeset
80 _old_promo_size->set_value(old_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
81 }
a61af66fc99e Initial load
duke
parents:
diff changeset
82 inline void update_boundary_moved(int size_in_bytes) {
a61af66fc99e Initial load
duke
parents:
diff changeset
83 _boundary_moved->set_value(size_in_bytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
84 }
a61af66fc99e Initial load
duke
parents:
diff changeset
85 inline void update_avg_promoted_avg() {
a61af66fc99e Initial load
duke
parents:
diff changeset
86 _avg_promoted_avg_counter->set_value(
a61af66fc99e Initial load
duke
parents:
diff changeset
87 (jlong)(ps_size_policy()->avg_promoted()->average())
a61af66fc99e Initial load
duke
parents:
diff changeset
88 );
a61af66fc99e Initial load
duke
parents:
diff changeset
89 }
a61af66fc99e Initial load
duke
parents:
diff changeset
90 inline void update_avg_promoted_dev() {
a61af66fc99e Initial load
duke
parents:
diff changeset
91 _avg_promoted_dev_counter->set_value(
a61af66fc99e Initial load
duke
parents:
diff changeset
92 (jlong)(ps_size_policy()->avg_promoted()->deviation())
a61af66fc99e Initial load
duke
parents:
diff changeset
93 );
a61af66fc99e Initial load
duke
parents:
diff changeset
94 }
a61af66fc99e Initial load
duke
parents:
diff changeset
95 inline void update_avg_promoted_padded_avg() {
a61af66fc99e Initial load
duke
parents:
diff changeset
96 _avg_promoted_padded_avg_counter->set_value(
a61af66fc99e Initial load
duke
parents:
diff changeset
97 (jlong)(ps_size_policy()->avg_promoted()->padded_average())
a61af66fc99e Initial load
duke
parents:
diff changeset
98 );
a61af66fc99e Initial load
duke
parents:
diff changeset
99 }
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 inline void update_avg_pretenured_padded_avg() {
a61af66fc99e Initial load
duke
parents:
diff changeset
102 _avg_pretenured_padded_avg->set_value(
a61af66fc99e Initial load
duke
parents:
diff changeset
103 (jlong)(ps_size_policy()->_avg_pretenured->padded_average())
a61af66fc99e Initial load
duke
parents:
diff changeset
104 );
a61af66fc99e Initial load
duke
parents:
diff changeset
105 }
a61af66fc99e Initial load
duke
parents:
diff changeset
106 inline void update_change_young_gen_for_maj_pauses() {
a61af66fc99e Initial load
duke
parents:
diff changeset
107 _change_young_gen_for_maj_pauses_counter->set_value(
a61af66fc99e Initial load
duke
parents:
diff changeset
108 ps_size_policy()->change_young_gen_for_maj_pauses());
a61af66fc99e Initial load
duke
parents:
diff changeset
109 }
a61af66fc99e Initial load
duke
parents:
diff changeset
110 inline void update_change_old_gen_for_min_pauses() {
a61af66fc99e Initial load
duke
parents:
diff changeset
111 _change_old_gen_for_min_pauses->set_value(
a61af66fc99e Initial load
duke
parents:
diff changeset
112 ps_size_policy()->change_old_gen_for_min_pauses());
a61af66fc99e Initial load
duke
parents:
diff changeset
113 }
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 // compute_generation_free_space() statistics
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 inline void update_avg_major_pause() {
a61af66fc99e Initial load
duke
parents:
diff changeset
118 _avg_major_pause->set_value(
a61af66fc99e Initial load
duke
parents:
diff changeset
119 (jlong)(ps_size_policy()->_avg_major_pause->average() * 1000.0)
a61af66fc99e Initial load
duke
parents:
diff changeset
120 );
a61af66fc99e Initial load
duke
parents:
diff changeset
121 }
a61af66fc99e Initial load
duke
parents:
diff changeset
122 inline void update_avg_major_interval() {
a61af66fc99e Initial load
duke
parents:
diff changeset
123 _avg_major_interval->set_value(
a61af66fc99e Initial load
duke
parents:
diff changeset
124 (jlong)(ps_size_policy()->_avg_major_interval->average() * 1000.0)
a61af66fc99e Initial load
duke
parents:
diff changeset
125 );
a61af66fc99e Initial load
duke
parents:
diff changeset
126 }
a61af66fc99e Initial load
duke
parents:
diff changeset
127
a61af66fc99e Initial load
duke
parents:
diff changeset
128 inline void update_major_gc_cost_counter() {
a61af66fc99e Initial load
duke
parents:
diff changeset
129 _major_gc_cost_counter->set_value(
a61af66fc99e Initial load
duke
parents:
diff changeset
130 (jlong)(ps_size_policy()->major_gc_cost() * 100.0)
a61af66fc99e Initial load
duke
parents:
diff changeset
131 );
a61af66fc99e Initial load
duke
parents:
diff changeset
132 }
a61af66fc99e Initial load
duke
parents:
diff changeset
133 inline void update_mutator_cost_counter() {
a61af66fc99e Initial load
duke
parents:
diff changeset
134 _mutator_cost_counter->set_value(
a61af66fc99e Initial load
duke
parents:
diff changeset
135 (jlong)(ps_size_policy()->mutator_cost() * 100.0)
a61af66fc99e Initial load
duke
parents:
diff changeset
136 );
a61af66fc99e Initial load
duke
parents:
diff changeset
137 }
a61af66fc99e Initial load
duke
parents:
diff changeset
138
a61af66fc99e Initial load
duke
parents:
diff changeset
139 inline void update_live_space() {
a61af66fc99e Initial load
duke
parents:
diff changeset
140 _live_space->set_value(ps_size_policy()->live_space());
a61af66fc99e Initial load
duke
parents:
diff changeset
141 }
a61af66fc99e Initial load
duke
parents:
diff changeset
142 inline void update_free_space() {
a61af66fc99e Initial load
duke
parents:
diff changeset
143 _free_space->set_value(ps_size_policy()->free_space());
a61af66fc99e Initial load
duke
parents:
diff changeset
144 }
a61af66fc99e Initial load
duke
parents:
diff changeset
145
a61af66fc99e Initial load
duke
parents:
diff changeset
146 inline void update_avg_base_footprint() {
a61af66fc99e Initial load
duke
parents:
diff changeset
147 _avg_base_footprint->set_value(
a61af66fc99e Initial load
duke
parents:
diff changeset
148 (jlong)(ps_size_policy()->avg_base_footprint()->average())
a61af66fc99e Initial load
duke
parents:
diff changeset
149 );
a61af66fc99e Initial load
duke
parents:
diff changeset
150 }
a61af66fc99e Initial load
duke
parents:
diff changeset
151 inline void update_avg_old_live() {
a61af66fc99e Initial load
duke
parents:
diff changeset
152 _avg_old_live_counter->set_value(
a61af66fc99e Initial load
duke
parents:
diff changeset
153 (jlong)(ps_size_policy()->avg_old_live()->average())
a61af66fc99e Initial load
duke
parents:
diff changeset
154 );
a61af66fc99e Initial load
duke
parents:
diff changeset
155 }
a61af66fc99e Initial load
duke
parents:
diff changeset
156 // Scale up all the slopes
a61af66fc99e Initial load
duke
parents:
diff changeset
157 inline void update_major_pause_old_slope() {
a61af66fc99e Initial load
duke
parents:
diff changeset
158 _major_pause_old_slope->set_value(
a61af66fc99e Initial load
duke
parents:
diff changeset
159 (jlong)(ps_size_policy()->major_pause_old_slope() * 1000)
a61af66fc99e Initial load
duke
parents:
diff changeset
160 );
a61af66fc99e Initial load
duke
parents:
diff changeset
161 }
a61af66fc99e Initial load
duke
parents:
diff changeset
162 inline void update_minor_pause_old_slope() {
a61af66fc99e Initial load
duke
parents:
diff changeset
163 _minor_pause_old_slope->set_value(
a61af66fc99e Initial load
duke
parents:
diff changeset
164 (jlong)(ps_size_policy()->minor_pause_old_slope() * 1000)
a61af66fc99e Initial load
duke
parents:
diff changeset
165 );
a61af66fc99e Initial load
duke
parents:
diff changeset
166 }
a61af66fc99e Initial load
duke
parents:
diff changeset
167 inline void update_major_pause_young_slope() {
a61af66fc99e Initial load
duke
parents:
diff changeset
168 _major_pause_young_slope->set_value(
a61af66fc99e Initial load
duke
parents:
diff changeset
169 (jlong)(ps_size_policy()->major_pause_young_slope() * 1000)
a61af66fc99e Initial load
duke
parents:
diff changeset
170 );
a61af66fc99e Initial load
duke
parents:
diff changeset
171 }
a61af66fc99e Initial load
duke
parents:
diff changeset
172
a61af66fc99e Initial load
duke
parents:
diff changeset
173 inline void update_scavenge_skipped(int cause) {
a61af66fc99e Initial load
duke
parents:
diff changeset
174 _scavenge_skipped->set_value(cause);
a61af66fc99e Initial load
duke
parents:
diff changeset
175 }
a61af66fc99e Initial load
duke
parents:
diff changeset
176
a61af66fc99e Initial load
duke
parents:
diff changeset
177 inline void update_full_follows_scavenge(int event) {
a61af66fc99e Initial load
duke
parents:
diff changeset
178 _full_follows_scavenge->set_value(event);
a61af66fc99e Initial load
duke
parents:
diff changeset
179 }
a61af66fc99e Initial load
duke
parents:
diff changeset
180
a61af66fc99e Initial load
duke
parents:
diff changeset
181 // Update all the counters that can be updated from the size policy.
a61af66fc99e Initial load
duke
parents:
diff changeset
182 // This should be called after all policy changes have been made
a61af66fc99e Initial load
duke
parents:
diff changeset
183 // and reflected internall in the size policy.
a61af66fc99e Initial load
duke
parents:
diff changeset
184 void update_counters_from_policy();
a61af66fc99e Initial load
duke
parents:
diff changeset
185
a61af66fc99e Initial load
duke
parents:
diff changeset
186 // Update counters that can be updated from fields internal to the
a61af66fc99e Initial load
duke
parents:
diff changeset
187 // counter or from globals. This is distinguished from counters
a61af66fc99e Initial load
duke
parents:
diff changeset
188 // that are updated via input parameters.
a61af66fc99e Initial load
duke
parents:
diff changeset
189 void update_counters();
a61af66fc99e Initial load
duke
parents:
diff changeset
190
a61af66fc99e Initial load
duke
parents:
diff changeset
191 virtual GCPolicyCounters::Name kind() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
192 return GCPolicyCounters::PSGCAdaptivePolicyCountersKind;
a61af66fc99e Initial load
duke
parents:
diff changeset
193 }
a61af66fc99e Initial load
duke
parents:
diff changeset
194 };