Mercurial > hg > truffle
annotate src/share/vm/gc_implementation/shared/gcAdaptivePolicyCounters.hpp @ 5935:a735aec54ea4
7123170: JCK vm/jvmti/ResourceExhausted/resexh001/resexh00101/ tests fails since 7u4 b02
Summary: The JVMTI ResourceExhausted events must be generated in all places where OOME is thrown
Reviewed-by: acorn, coleenp, dcubed, dholmes, dsamersoff, jwilhelm, tonyp
Contributed-by: serguei.spitsyn@oracle.com
author | sspitsyn |
---|---|
date | Wed, 14 Mar 2012 20:06:48 -0700 |
parents | f95d63e2154a |
children | 22b8d3d181d9 |
rev | line source |
---|---|
0 | 1 /* |
1972 | 2 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
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:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_GCADAPTIVEPOLICYCOUNTERS_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCADAPTIVEPOLICYCOUNTERS_HPP | |
27 | |
28 #ifndef SERIALGC | |
29 #include "gc_implementation/shared/adaptiveSizePolicy.hpp" | |
30 #include "gc_implementation/shared/gcPolicyCounters.hpp" | |
31 #endif | |
32 | |
0 | 33 // This class keeps statistical information and computes the |
34 // size of the heap. | |
35 | |
36 class GCAdaptivePolicyCounters : public GCPolicyCounters { | |
37 protected: | |
38 PerfVariable* _eden_size_counter; | |
39 PerfVariable* _promo_size_counter; | |
40 | |
41 PerfVariable* _young_capacity_counter; | |
42 | |
43 PerfVariable* _minor_gc_cost_counter; | |
44 PerfVariable* _major_gc_cost_counter; | |
45 PerfVariable* _mutator_cost_counter; | |
46 | |
47 PerfVariable* _avg_young_live_counter; | |
48 PerfVariable* _avg_old_live_counter; | |
49 | |
50 PerfVariable* _avg_minor_pause_counter; | |
51 PerfVariable* _avg_minor_interval_counter; | |
52 | |
53 #ifdef NOT_PRODUCT | |
54 PerfVariable* _minor_pause_counter; | |
55 #endif | |
56 | |
57 PerfVariable* _change_young_gen_for_min_pauses_counter; | |
58 PerfVariable* _change_young_gen_for_throughput_counter; | |
59 PerfVariable* _change_old_gen_for_maj_pauses_counter; | |
60 PerfVariable* _change_old_gen_for_throughput_counter; | |
61 PerfVariable* _decrease_for_footprint_counter; | |
62 | |
63 PerfVariable* _minor_pause_young_slope_counter; | |
64 PerfVariable* _major_pause_old_slope_counter; | |
65 | |
66 PerfVariable* _decide_at_full_gc_counter; | |
67 | |
68 PerfVariable* _survived_counter; | |
69 PerfVariable* _promoted_counter; | |
70 | |
71 PerfVariable* _avg_survived_avg_counter; | |
72 PerfVariable* _avg_survived_dev_counter; | |
73 PerfVariable* _avg_survived_padded_avg_counter; | |
74 | |
75 PerfVariable* _survivor_overflowed_counter; | |
76 PerfVariable* _increment_tenuring_threshold_for_gc_cost_counter; | |
77 PerfVariable* _decrement_tenuring_threshold_for_gc_cost_counter; | |
78 PerfVariable* _decrement_tenuring_threshold_for_survivor_limit_counter; | |
79 | |
80 PerfVariable* _minor_collection_slope_counter; | |
81 PerfVariable* _major_collection_slope_counter; | |
82 | |
83 AdaptiveSizePolicy* _size_policy; | |
84 | |
85 inline void update_eden_size() { | |
86 size_t eden_size_in_bytes = size_policy()->calculated_eden_size_in_bytes(); | |
87 _eden_size_counter->set_value(eden_size_in_bytes); | |
88 } | |
89 | |
90 inline void update_promo_size() { | |
91 _promo_size_counter->set_value( | |
92 size_policy()->calculated_promo_size_in_bytes()); | |
93 } | |
94 | |
95 inline void update_avg_minor_pause_counter() { | |
96 _avg_minor_pause_counter->set_value((jlong) | |
97 (size_policy()->avg_minor_pause()->average() * 1000.0)); | |
98 } | |
99 inline void update_avg_minor_interval_counter() { | |
100 _avg_minor_interval_counter->set_value((jlong) | |
101 (size_policy()->avg_minor_interval()->average() * 1000.0)); | |
102 } | |
103 | |
104 #ifdef NOT_PRODUCT | |
105 inline void update_minor_pause_counter() { | |
106 _minor_pause_counter->set_value((jlong) | |
107 (size_policy()->avg_minor_pause()->last_sample() * 1000.0)); | |
108 } | |
109 #endif | |
110 inline void update_minor_gc_cost_counter() { | |
111 _minor_gc_cost_counter->set_value((jlong) | |
112 (size_policy()->minor_gc_cost() * 100.0)); | |
113 } | |
114 | |
115 inline void update_avg_young_live_counter() { | |
116 _avg_young_live_counter->set_value( | |
117 (jlong)(size_policy()->avg_young_live()->average()) | |
118 ); | |
119 } | |
120 | |
121 inline void update_avg_survived_avg_counters() { | |
122 _avg_survived_avg_counter->set_value( | |
123 (jlong)(size_policy()->_avg_survived->average()) | |
124 ); | |
125 } | |
126 inline void update_avg_survived_dev_counters() { | |
127 _avg_survived_dev_counter->set_value( | |
128 (jlong)(size_policy()->_avg_survived->deviation()) | |
129 ); | |
130 } | |
131 inline void update_avg_survived_padded_avg_counters() { | |
132 _avg_survived_padded_avg_counter->set_value( | |
133 (jlong)(size_policy()->_avg_survived->padded_average()) | |
134 ); | |
135 } | |
136 | |
137 inline void update_change_old_gen_for_throughput() { | |
138 _change_old_gen_for_throughput_counter->set_value( | |
139 size_policy()->change_old_gen_for_throughput()); | |
140 } | |
141 inline void update_change_young_gen_for_throughput() { | |
142 _change_young_gen_for_throughput_counter->set_value( | |
143 size_policy()->change_young_gen_for_throughput()); | |
144 } | |
145 inline void update_decrease_for_footprint() { | |
146 _decrease_for_footprint_counter->set_value( | |
147 size_policy()->decrease_for_footprint()); | |
148 } | |
149 | |
150 inline void update_decide_at_full_gc_counter() { | |
151 _decide_at_full_gc_counter->set_value( | |
152 size_policy()->decide_at_full_gc()); | |
153 } | |
154 | |
155 inline void update_minor_pause_young_slope_counter() { | |
156 _minor_pause_young_slope_counter->set_value( | |
157 (jlong)(size_policy()->minor_pause_young_slope() * 1000) | |
158 ); | |
159 } | |
160 | |
161 virtual void update_counters_from_policy(); | |
162 | |
163 protected: | |
164 virtual AdaptiveSizePolicy* size_policy() { return _size_policy; } | |
165 | |
166 public: | |
167 GCAdaptivePolicyCounters(const char* name, | |
168 int collectors, | |
169 int generations, | |
170 AdaptiveSizePolicy* size_policy); | |
171 | |
172 inline void update_survived(size_t survived) { | |
173 _survived_counter->set_value(survived); | |
174 } | |
175 inline void update_promoted(size_t promoted) { | |
176 _promoted_counter->set_value(promoted); | |
177 } | |
178 inline void update_young_capacity(size_t size_in_bytes) { | |
179 _young_capacity_counter->set_value(size_in_bytes); | |
180 } | |
181 | |
182 virtual void update_counters(); | |
183 | |
184 inline void update_survivor_size_counters() { | |
185 desired_survivor_size()->set_value( | |
186 size_policy()->calculated_survivor_size_in_bytes()); | |
187 } | |
188 inline void update_survivor_overflowed(bool survivor_overflowed) { | |
189 _survivor_overflowed_counter->set_value(survivor_overflowed); | |
190 } | |
191 inline void update_tenuring_threshold(int threshold) { | |
192 tenuring_threshold()->set_value(threshold); | |
193 } | |
194 inline void update_increment_tenuring_threshold_for_gc_cost() { | |
195 _increment_tenuring_threshold_for_gc_cost_counter->set_value( | |
196 size_policy()->increment_tenuring_threshold_for_gc_cost()); | |
197 } | |
198 inline void update_decrement_tenuring_threshold_for_gc_cost() { | |
199 _decrement_tenuring_threshold_for_gc_cost_counter->set_value( | |
200 size_policy()->decrement_tenuring_threshold_for_gc_cost()); | |
201 } | |
202 inline void update_decrement_tenuring_threshold_for_survivor_limit() { | |
203 _decrement_tenuring_threshold_for_survivor_limit_counter->set_value( | |
204 size_policy()->decrement_tenuring_threshold_for_survivor_limit()); | |
205 } | |
206 inline void update_change_young_gen_for_min_pauses() { | |
207 _change_young_gen_for_min_pauses_counter->set_value( | |
208 size_policy()->change_young_gen_for_min_pauses()); | |
209 } | |
210 inline void update_change_old_gen_for_maj_pauses() { | |
211 _change_old_gen_for_maj_pauses_counter->set_value( | |
212 size_policy()->change_old_gen_for_maj_pauses()); | |
213 } | |
214 | |
215 inline void update_minor_collection_slope_counter() { | |
216 _minor_collection_slope_counter->set_value( | |
217 (jlong)(size_policy()->minor_collection_slope() * 1000) | |
218 ); | |
219 } | |
220 | |
221 inline void update_major_collection_slope_counter() { | |
222 _major_collection_slope_counter->set_value( | |
223 (jlong)(size_policy()->major_collection_slope() * 1000) | |
224 ); | |
225 } | |
226 | |
227 void set_size_policy(AdaptiveSizePolicy* v) { _size_policy = v; } | |
228 | |
229 virtual GCPolicyCounters::Name kind() const { | |
230 return GCPolicyCounters::GCAdaptivePolicyCountersKind; | |
231 } | |
232 }; | |
1972 | 233 |
234 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_GCADAPTIVEPOLICYCOUNTERS_HPP |