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