Fri, 09 May 2008 08:55:13 -0700
6670684: 4/5 SA command universe did not print out CMS space information
Summary: Forward port of Yumin's fix for 6670684 from HSX-11; Yumin verified the port was correct.
Reviewed-by: dcubed
duke@435 | 1 | /* |
duke@435 | 2 | * Copyright 2004-2005 Sun Microsystems, Inc. All Rights Reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
duke@435 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | * have any questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | // CMSGCAdaptivePolicyCounters is a holder class for performance counters |
duke@435 | 26 | // that track the data and decisions for the ergonomics policy for the |
duke@435 | 27 | // concurrent mark sweep collector |
duke@435 | 28 | |
duke@435 | 29 | class CMSGCAdaptivePolicyCounters : public GCAdaptivePolicyCounters { |
duke@435 | 30 | friend class VMStructs; |
duke@435 | 31 | |
duke@435 | 32 | private: |
duke@435 | 33 | |
duke@435 | 34 | // Capacity of tenured generation recorded at the end of |
duke@435 | 35 | // any collection. |
duke@435 | 36 | PerfVariable* _cms_capacity_counter; // Make this common with PS _old_capacity |
duke@435 | 37 | |
duke@435 | 38 | // Average stop-the-world pause time for both initial and |
duke@435 | 39 | // remark pauses sampled at the end of the checkpointRootsFinalWork. |
duke@435 | 40 | PerfVariable* _avg_cms_STW_time_counter; |
duke@435 | 41 | // Average stop-the-world (STW) GC cost for the STW pause time |
duke@435 | 42 | // _avg_cms_STW_time_counter. |
duke@435 | 43 | PerfVariable* _avg_cms_STW_gc_cost_counter; |
duke@435 | 44 | |
duke@435 | 45 | #ifdef NOT_PRODUCT |
duke@435 | 46 | // These are useful to see how the most recent values of these |
duke@435 | 47 | // counters compare to their respective averages but |
duke@435 | 48 | // do not control behavior. |
duke@435 | 49 | PerfVariable* _initial_pause_counter; |
duke@435 | 50 | PerfVariable* _remark_pause_counter; |
duke@435 | 51 | #endif |
duke@435 | 52 | |
duke@435 | 53 | // Average of the initial marking pause for a concurrent collection. |
duke@435 | 54 | PerfVariable* _avg_initial_pause_counter; |
duke@435 | 55 | // Average of the remark pause for a concurrent collection. |
duke@435 | 56 | PerfVariable* _avg_remark_pause_counter; |
duke@435 | 57 | |
duke@435 | 58 | // Average for the sum of all the concurrent times per collection. |
duke@435 | 59 | PerfVariable* _avg_concurrent_time_counter; |
duke@435 | 60 | // Average for the time between the most recent end of a |
duke@435 | 61 | // concurrent collection and the beginning of the next |
duke@435 | 62 | // concurrent collection. |
duke@435 | 63 | PerfVariable* _avg_concurrent_interval_counter; |
duke@435 | 64 | // Average of the concurrent GC costs based on _avg_concurrent_time_counter |
duke@435 | 65 | // and _avg_concurrent_interval_counter. |
duke@435 | 66 | PerfVariable* _avg_concurrent_gc_cost_counter; |
duke@435 | 67 | |
duke@435 | 68 | // Average of the free space in the tenured generation at the |
duke@435 | 69 | // end of the sweep of the tenured generation. |
duke@435 | 70 | PerfVariable* _avg_cms_free_counter; |
duke@435 | 71 | // Average of the free space in the tenured generation at the |
duke@435 | 72 | // start of the sweep of the tenured genertion. |
duke@435 | 73 | PerfVariable* _avg_cms_free_at_sweep_counter; |
duke@435 | 74 | // Average of the free space in the tenured generation at the |
duke@435 | 75 | // after any resizing of the tenured generation at the end |
duke@435 | 76 | // of a collection of the tenured generation. |
duke@435 | 77 | PerfVariable* _avg_cms_promo_counter; |
duke@435 | 78 | |
duke@435 | 79 | // Average of the mark-sweep-compact (MSC) pause time for a collection |
duke@435 | 80 | // of the tenured generation. |
duke@435 | 81 | PerfVariable* _avg_msc_pause_counter; |
duke@435 | 82 | // Average for the time between the most recent end of a |
duke@435 | 83 | // MSC collection and the beginning of the next |
duke@435 | 84 | // MSC collection. |
duke@435 | 85 | PerfVariable* _avg_msc_interval_counter; |
duke@435 | 86 | // Average for the GC cost of a MSC collection based on |
duke@435 | 87 | // _avg_msc_pause_counter and _avg_msc_interval_counter. |
duke@435 | 88 | PerfVariable* _msc_gc_cost_counter; |
duke@435 | 89 | |
duke@435 | 90 | // Average of the mark-sweep (MS) pause time for a collection |
duke@435 | 91 | // of the tenured generation. |
duke@435 | 92 | PerfVariable* _avg_ms_pause_counter; |
duke@435 | 93 | // Average for the time between the most recent end of a |
duke@435 | 94 | // MS collection and the beginning of the next |
duke@435 | 95 | // MS collection. |
duke@435 | 96 | PerfVariable* _avg_ms_interval_counter; |
duke@435 | 97 | // Average for the GC cost of a MS collection based on |
duke@435 | 98 | // _avg_ms_pause_counter and _avg_ms_interval_counter. |
duke@435 | 99 | PerfVariable* _ms_gc_cost_counter; |
duke@435 | 100 | |
duke@435 | 101 | // Average of the bytes promoted per minor collection. |
duke@435 | 102 | PerfVariable* _promoted_avg_counter; |
duke@435 | 103 | // Average of the deviation of the promoted average |
duke@435 | 104 | PerfVariable* _promoted_avg_dev_counter; |
duke@435 | 105 | // Padded average of the bytes promoted per minor colleciton |
duke@435 | 106 | PerfVariable* _promoted_padded_avg_counter; |
duke@435 | 107 | |
duke@435 | 108 | // See description of the _change_young_gen_for_maj_pauses |
duke@435 | 109 | // variable recently in cmsAdaptiveSizePolicy.hpp. |
duke@435 | 110 | PerfVariable* _change_young_gen_for_maj_pauses_counter; |
duke@435 | 111 | |
duke@435 | 112 | // See descriptions of _remark_pause_old_slope, _initial_pause_old_slope, |
duke@435 | 113 | // etc. variables recently in cmsAdaptiveSizePolicy.hpp. |
duke@435 | 114 | PerfVariable* _remark_pause_old_slope_counter; |
duke@435 | 115 | PerfVariable* _initial_pause_old_slope_counter; |
duke@435 | 116 | PerfVariable* _remark_pause_young_slope_counter; |
duke@435 | 117 | PerfVariable* _initial_pause_young_slope_counter; |
duke@435 | 118 | |
duke@435 | 119 | CMSAdaptiveSizePolicy* cms_size_policy() { |
duke@435 | 120 | assert(_size_policy->kind() == |
duke@435 | 121 | AdaptiveSizePolicy::_gc_cms_adaptive_size_policy, |
duke@435 | 122 | "Wrong size policy"); |
duke@435 | 123 | return (CMSAdaptiveSizePolicy*)_size_policy; |
duke@435 | 124 | } |
duke@435 | 125 | |
duke@435 | 126 | inline void update_avg_cms_STW_time_counter() { |
duke@435 | 127 | _avg_cms_STW_time_counter->set_value( |
duke@435 | 128 | (jlong) (cms_size_policy()->avg_cms_STW_time()->average() * |
duke@435 | 129 | (double) MILLIUNITS)); |
duke@435 | 130 | } |
duke@435 | 131 | |
duke@435 | 132 | inline void update_avg_cms_STW_gc_cost_counter() { |
duke@435 | 133 | _avg_cms_STW_gc_cost_counter->set_value( |
duke@435 | 134 | (jlong) (cms_size_policy()->avg_cms_STW_gc_cost()->average() * 100.0)); |
duke@435 | 135 | } |
duke@435 | 136 | |
duke@435 | 137 | inline void update_avg_initial_pause_counter() { |
duke@435 | 138 | _avg_initial_pause_counter->set_value( |
duke@435 | 139 | (jlong) (cms_size_policy()->avg_initial_pause()->average() * |
duke@435 | 140 | (double) MILLIUNITS)); |
duke@435 | 141 | } |
duke@435 | 142 | #ifdef NOT_PRODUCT |
duke@435 | 143 | inline void update_avg_remark_pause_counter() { |
duke@435 | 144 | _avg_remark_pause_counter->set_value( |
duke@435 | 145 | (jlong) (cms_size_policy()-> avg_remark_pause()->average() * |
duke@435 | 146 | (double) MILLIUNITS)); |
duke@435 | 147 | } |
duke@435 | 148 | |
duke@435 | 149 | inline void update_initial_pause_counter() { |
duke@435 | 150 | _initial_pause_counter->set_value( |
duke@435 | 151 | (jlong) (cms_size_policy()->avg_initial_pause()->average() * |
duke@435 | 152 | (double) MILLIUNITS)); |
duke@435 | 153 | } |
duke@435 | 154 | #endif |
duke@435 | 155 | inline void update_remark_pause_counter() { |
duke@435 | 156 | _remark_pause_counter->set_value( |
duke@435 | 157 | (jlong) (cms_size_policy()-> avg_remark_pause()->last_sample() * |
duke@435 | 158 | (double) MILLIUNITS)); |
duke@435 | 159 | } |
duke@435 | 160 | |
duke@435 | 161 | inline void update_avg_concurrent_time_counter() { |
duke@435 | 162 | _avg_concurrent_time_counter->set_value( |
duke@435 | 163 | (jlong) (cms_size_policy()->avg_concurrent_time()->last_sample() * |
duke@435 | 164 | (double) MILLIUNITS)); |
duke@435 | 165 | } |
duke@435 | 166 | |
duke@435 | 167 | inline void update_avg_concurrent_interval_counter() { |
duke@435 | 168 | _avg_concurrent_interval_counter->set_value( |
duke@435 | 169 | (jlong) (cms_size_policy()->avg_concurrent_interval()->average() * |
duke@435 | 170 | (double) MILLIUNITS)); |
duke@435 | 171 | } |
duke@435 | 172 | |
duke@435 | 173 | inline void update_avg_concurrent_gc_cost_counter() { |
duke@435 | 174 | _avg_concurrent_gc_cost_counter->set_value( |
duke@435 | 175 | (jlong) (cms_size_policy()->avg_concurrent_gc_cost()->average() * 100.0)); |
duke@435 | 176 | } |
duke@435 | 177 | |
duke@435 | 178 | inline void update_avg_cms_free_counter() { |
duke@435 | 179 | _avg_cms_free_counter->set_value( |
duke@435 | 180 | (jlong) cms_size_policy()->avg_cms_free()->average()); |
duke@435 | 181 | } |
duke@435 | 182 | |
duke@435 | 183 | inline void update_avg_cms_free_at_sweep_counter() { |
duke@435 | 184 | _avg_cms_free_at_sweep_counter->set_value( |
duke@435 | 185 | (jlong) cms_size_policy()->avg_cms_free_at_sweep()->average()); |
duke@435 | 186 | } |
duke@435 | 187 | |
duke@435 | 188 | inline void update_avg_cms_promo_counter() { |
duke@435 | 189 | _avg_cms_promo_counter->set_value( |
duke@435 | 190 | (jlong) cms_size_policy()->avg_cms_promo()->average()); |
duke@435 | 191 | } |
duke@435 | 192 | |
duke@435 | 193 | inline void update_avg_old_live_counter() { |
duke@435 | 194 | _avg_old_live_counter->set_value( |
duke@435 | 195 | (jlong)(cms_size_policy()->avg_old_live()->average()) |
duke@435 | 196 | ); |
duke@435 | 197 | } |
duke@435 | 198 | |
duke@435 | 199 | inline void update_avg_msc_pause_counter() { |
duke@435 | 200 | _avg_msc_pause_counter->set_value( |
duke@435 | 201 | (jlong) (cms_size_policy()->avg_msc_pause()->average() * |
duke@435 | 202 | (double) MILLIUNITS)); |
duke@435 | 203 | } |
duke@435 | 204 | |
duke@435 | 205 | inline void update_avg_msc_interval_counter() { |
duke@435 | 206 | _avg_msc_interval_counter->set_value( |
duke@435 | 207 | (jlong) (cms_size_policy()->avg_msc_interval()->average() * |
duke@435 | 208 | (double) MILLIUNITS)); |
duke@435 | 209 | } |
duke@435 | 210 | |
duke@435 | 211 | inline void update_msc_gc_cost_counter() { |
duke@435 | 212 | _msc_gc_cost_counter->set_value( |
duke@435 | 213 | (jlong) (cms_size_policy()->avg_msc_gc_cost()->average() * 100.0)); |
duke@435 | 214 | } |
duke@435 | 215 | |
duke@435 | 216 | inline void update_avg_ms_pause_counter() { |
duke@435 | 217 | _avg_ms_pause_counter->set_value( |
duke@435 | 218 | (jlong) (cms_size_policy()->avg_ms_pause()->average() * |
duke@435 | 219 | (double) MILLIUNITS)); |
duke@435 | 220 | } |
duke@435 | 221 | |
duke@435 | 222 | inline void update_avg_ms_interval_counter() { |
duke@435 | 223 | _avg_ms_interval_counter->set_value( |
duke@435 | 224 | (jlong) (cms_size_policy()->avg_ms_interval()->average() * |
duke@435 | 225 | (double) MILLIUNITS)); |
duke@435 | 226 | } |
duke@435 | 227 | |
duke@435 | 228 | inline void update_ms_gc_cost_counter() { |
duke@435 | 229 | _ms_gc_cost_counter->set_value( |
duke@435 | 230 | (jlong) (cms_size_policy()->avg_ms_gc_cost()->average() * 100.0)); |
duke@435 | 231 | } |
duke@435 | 232 | |
duke@435 | 233 | inline void update_major_gc_cost_counter() { |
duke@435 | 234 | _major_gc_cost_counter->set_value( |
duke@435 | 235 | (jlong)(cms_size_policy()->cms_gc_cost() * 100.0) |
duke@435 | 236 | ); |
duke@435 | 237 | } |
duke@435 | 238 | inline void update_mutator_cost_counter() { |
duke@435 | 239 | _mutator_cost_counter->set_value( |
duke@435 | 240 | (jlong)(cms_size_policy()->mutator_cost() * 100.0) |
duke@435 | 241 | ); |
duke@435 | 242 | } |
duke@435 | 243 | |
duke@435 | 244 | inline void update_avg_promoted_avg(CMSGCStats* gc_stats) { |
duke@435 | 245 | _promoted_avg_counter->set_value( |
duke@435 | 246 | (jlong)(gc_stats->avg_promoted()->average()) |
duke@435 | 247 | ); |
duke@435 | 248 | } |
duke@435 | 249 | inline void update_avg_promoted_dev(CMSGCStats* gc_stats) { |
duke@435 | 250 | _promoted_avg_dev_counter->set_value( |
duke@435 | 251 | (jlong)(gc_stats->avg_promoted()->deviation()) |
duke@435 | 252 | ); |
duke@435 | 253 | } |
duke@435 | 254 | inline void update_avg_promoted_padded_avg(CMSGCStats* gc_stats) { |
duke@435 | 255 | _promoted_padded_avg_counter->set_value( |
duke@435 | 256 | (jlong)(gc_stats->avg_promoted()->padded_average()) |
duke@435 | 257 | ); |
duke@435 | 258 | } |
duke@435 | 259 | inline void update_remark_pause_old_slope_counter() { |
duke@435 | 260 | _remark_pause_old_slope_counter->set_value( |
duke@435 | 261 | (jlong)(cms_size_policy()->remark_pause_old_slope() * 1000) |
duke@435 | 262 | ); |
duke@435 | 263 | } |
duke@435 | 264 | inline void update_initial_pause_old_slope_counter() { |
duke@435 | 265 | _initial_pause_old_slope_counter->set_value( |
duke@435 | 266 | (jlong)(cms_size_policy()->initial_pause_old_slope() * 1000) |
duke@435 | 267 | ); |
duke@435 | 268 | } |
duke@435 | 269 | inline void update_remark_pause_young_slope_counter() { |
duke@435 | 270 | _remark_pause_young_slope_counter->set_value( |
duke@435 | 271 | (jlong)(cms_size_policy()->remark_pause_young_slope() * 1000) |
duke@435 | 272 | ); |
duke@435 | 273 | } |
duke@435 | 274 | inline void update_initial_pause_young_slope_counter() { |
duke@435 | 275 | _initial_pause_young_slope_counter->set_value( |
duke@435 | 276 | (jlong)(cms_size_policy()->initial_pause_young_slope() * 1000) |
duke@435 | 277 | ); |
duke@435 | 278 | } |
duke@435 | 279 | inline void update_change_young_gen_for_maj_pauses() { |
duke@435 | 280 | _change_young_gen_for_maj_pauses_counter->set_value( |
duke@435 | 281 | cms_size_policy()->change_young_gen_for_maj_pauses()); |
duke@435 | 282 | } |
duke@435 | 283 | |
duke@435 | 284 | public: |
duke@435 | 285 | CMSGCAdaptivePolicyCounters(const char* name, int collectors, int generations, |
duke@435 | 286 | AdaptiveSizePolicy* size_policy); |
duke@435 | 287 | |
duke@435 | 288 | // update counters |
duke@435 | 289 | void update_counters(); |
duke@435 | 290 | void update_counters(CMSGCStats* gc_stats); |
duke@435 | 291 | void update_counters_from_policy(); |
duke@435 | 292 | |
duke@435 | 293 | inline void update_cms_capacity_counter(size_t size_in_bytes) { |
duke@435 | 294 | _cms_capacity_counter->set_value(size_in_bytes); |
duke@435 | 295 | } |
duke@435 | 296 | |
duke@435 | 297 | virtual GCPolicyCounters::Name kind() const { |
duke@435 | 298 | return GCPolicyCounters::CMSGCAdaptivePolicyCountersKind; |
duke@435 | 299 | } |
duke@435 | 300 | }; |