src/share/vm/gc_implementation/concurrentMarkSweep/cmsGCAdaptivePolicyCounters.hpp

Thu, 13 Feb 2014 17:44:39 +0100

author
stefank
date
Thu, 13 Feb 2014 17:44:39 +0100
changeset 6971
7426d8d76305
parent 2314
f95d63e2154a
child 6876
710a3c8b516e
permissions
-rw-r--r--

8034761: Remove the do_code_roots parameter from process_strong_roots
Reviewed-by: tschatzl, mgerdin, jmasa

duke@435 1 /*
stefank@2314 2 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. 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 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSGCADAPTIVEPOLICYCOUNTERS_HPP
stefank@2314 26 #define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSGCADAPTIVEPOLICYCOUNTERS_HPP
stefank@2314 27
stefank@2314 28 #include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp"
stefank@2314 29 #include "gc_implementation/shared/gcAdaptivePolicyCounters.hpp"
stefank@2314 30 #include "gc_implementation/shared/gcStats.hpp"
stefank@2314 31 #include "runtime/perfData.hpp"
stefank@2314 32
duke@435 33 // CMSGCAdaptivePolicyCounters is a holder class for performance counters
duke@435 34 // that track the data and decisions for the ergonomics policy for the
duke@435 35 // concurrent mark sweep collector
duke@435 36
duke@435 37 class CMSGCAdaptivePolicyCounters : public GCAdaptivePolicyCounters {
duke@435 38 friend class VMStructs;
duke@435 39
duke@435 40 private:
duke@435 41
duke@435 42 // Capacity of tenured generation recorded at the end of
duke@435 43 // any collection.
duke@435 44 PerfVariable* _cms_capacity_counter; // Make this common with PS _old_capacity
duke@435 45
duke@435 46 // Average stop-the-world pause time for both initial and
duke@435 47 // remark pauses sampled at the end of the checkpointRootsFinalWork.
duke@435 48 PerfVariable* _avg_cms_STW_time_counter;
duke@435 49 // Average stop-the-world (STW) GC cost for the STW pause time
duke@435 50 // _avg_cms_STW_time_counter.
duke@435 51 PerfVariable* _avg_cms_STW_gc_cost_counter;
duke@435 52
duke@435 53 #ifdef NOT_PRODUCT
duke@435 54 // These are useful to see how the most recent values of these
duke@435 55 // counters compare to their respective averages but
duke@435 56 // do not control behavior.
duke@435 57 PerfVariable* _initial_pause_counter;
duke@435 58 PerfVariable* _remark_pause_counter;
duke@435 59 #endif
duke@435 60
duke@435 61 // Average of the initial marking pause for a concurrent collection.
duke@435 62 PerfVariable* _avg_initial_pause_counter;
duke@435 63 // Average of the remark pause for a concurrent collection.
duke@435 64 PerfVariable* _avg_remark_pause_counter;
duke@435 65
duke@435 66 // Average for the sum of all the concurrent times per collection.
duke@435 67 PerfVariable* _avg_concurrent_time_counter;
duke@435 68 // Average for the time between the most recent end of a
duke@435 69 // concurrent collection and the beginning of the next
duke@435 70 // concurrent collection.
duke@435 71 PerfVariable* _avg_concurrent_interval_counter;
duke@435 72 // Average of the concurrent GC costs based on _avg_concurrent_time_counter
duke@435 73 // and _avg_concurrent_interval_counter.
duke@435 74 PerfVariable* _avg_concurrent_gc_cost_counter;
duke@435 75
duke@435 76 // Average of the free space in the tenured generation at the
duke@435 77 // end of the sweep of the tenured generation.
duke@435 78 PerfVariable* _avg_cms_free_counter;
duke@435 79 // Average of the free space in the tenured generation at the
twisti@1040 80 // start of the sweep of the tenured generation.
duke@435 81 PerfVariable* _avg_cms_free_at_sweep_counter;
duke@435 82 // Average of the free space in the tenured generation at the
duke@435 83 // after any resizing of the tenured generation at the end
duke@435 84 // of a collection of the tenured generation.
duke@435 85 PerfVariable* _avg_cms_promo_counter;
duke@435 86
duke@435 87 // Average of the mark-sweep-compact (MSC) pause time for a collection
duke@435 88 // of the tenured generation.
duke@435 89 PerfVariable* _avg_msc_pause_counter;
duke@435 90 // Average for the time between the most recent end of a
duke@435 91 // MSC collection and the beginning of the next
duke@435 92 // MSC collection.
duke@435 93 PerfVariable* _avg_msc_interval_counter;
duke@435 94 // Average for the GC cost of a MSC collection based on
duke@435 95 // _avg_msc_pause_counter and _avg_msc_interval_counter.
duke@435 96 PerfVariable* _msc_gc_cost_counter;
duke@435 97
duke@435 98 // Average of the mark-sweep (MS) pause time for a collection
duke@435 99 // of the tenured generation.
duke@435 100 PerfVariable* _avg_ms_pause_counter;
duke@435 101 // Average for the time between the most recent end of a
duke@435 102 // MS collection and the beginning of the next
duke@435 103 // MS collection.
duke@435 104 PerfVariable* _avg_ms_interval_counter;
duke@435 105 // Average for the GC cost of a MS collection based on
duke@435 106 // _avg_ms_pause_counter and _avg_ms_interval_counter.
duke@435 107 PerfVariable* _ms_gc_cost_counter;
duke@435 108
duke@435 109 // Average of the bytes promoted per minor collection.
duke@435 110 PerfVariable* _promoted_avg_counter;
duke@435 111 // Average of the deviation of the promoted average
duke@435 112 PerfVariable* _promoted_avg_dev_counter;
duke@435 113 // Padded average of the bytes promoted per minor colleciton
duke@435 114 PerfVariable* _promoted_padded_avg_counter;
duke@435 115
duke@435 116 // See description of the _change_young_gen_for_maj_pauses
duke@435 117 // variable recently in cmsAdaptiveSizePolicy.hpp.
duke@435 118 PerfVariable* _change_young_gen_for_maj_pauses_counter;
duke@435 119
duke@435 120 // See descriptions of _remark_pause_old_slope, _initial_pause_old_slope,
duke@435 121 // etc. variables recently in cmsAdaptiveSizePolicy.hpp.
duke@435 122 PerfVariable* _remark_pause_old_slope_counter;
duke@435 123 PerfVariable* _initial_pause_old_slope_counter;
duke@435 124 PerfVariable* _remark_pause_young_slope_counter;
duke@435 125 PerfVariable* _initial_pause_young_slope_counter;
duke@435 126
duke@435 127 CMSAdaptiveSizePolicy* cms_size_policy() {
duke@435 128 assert(_size_policy->kind() ==
duke@435 129 AdaptiveSizePolicy::_gc_cms_adaptive_size_policy,
duke@435 130 "Wrong size policy");
duke@435 131 return (CMSAdaptiveSizePolicy*)_size_policy;
duke@435 132 }
duke@435 133
duke@435 134 inline void update_avg_cms_STW_time_counter() {
duke@435 135 _avg_cms_STW_time_counter->set_value(
duke@435 136 (jlong) (cms_size_policy()->avg_cms_STW_time()->average() *
duke@435 137 (double) MILLIUNITS));
duke@435 138 }
duke@435 139
duke@435 140 inline void update_avg_cms_STW_gc_cost_counter() {
duke@435 141 _avg_cms_STW_gc_cost_counter->set_value(
duke@435 142 (jlong) (cms_size_policy()->avg_cms_STW_gc_cost()->average() * 100.0));
duke@435 143 }
duke@435 144
duke@435 145 inline void update_avg_initial_pause_counter() {
duke@435 146 _avg_initial_pause_counter->set_value(
duke@435 147 (jlong) (cms_size_policy()->avg_initial_pause()->average() *
duke@435 148 (double) MILLIUNITS));
duke@435 149 }
duke@435 150 #ifdef NOT_PRODUCT
duke@435 151 inline void update_avg_remark_pause_counter() {
duke@435 152 _avg_remark_pause_counter->set_value(
duke@435 153 (jlong) (cms_size_policy()-> avg_remark_pause()->average() *
duke@435 154 (double) MILLIUNITS));
duke@435 155 }
duke@435 156
duke@435 157 inline void update_initial_pause_counter() {
duke@435 158 _initial_pause_counter->set_value(
duke@435 159 (jlong) (cms_size_policy()->avg_initial_pause()->average() *
duke@435 160 (double) MILLIUNITS));
duke@435 161 }
duke@435 162 #endif
duke@435 163 inline void update_remark_pause_counter() {
duke@435 164 _remark_pause_counter->set_value(
duke@435 165 (jlong) (cms_size_policy()-> avg_remark_pause()->last_sample() *
duke@435 166 (double) MILLIUNITS));
duke@435 167 }
duke@435 168
duke@435 169 inline void update_avg_concurrent_time_counter() {
duke@435 170 _avg_concurrent_time_counter->set_value(
duke@435 171 (jlong) (cms_size_policy()->avg_concurrent_time()->last_sample() *
duke@435 172 (double) MILLIUNITS));
duke@435 173 }
duke@435 174
duke@435 175 inline void update_avg_concurrent_interval_counter() {
duke@435 176 _avg_concurrent_interval_counter->set_value(
duke@435 177 (jlong) (cms_size_policy()->avg_concurrent_interval()->average() *
duke@435 178 (double) MILLIUNITS));
duke@435 179 }
duke@435 180
duke@435 181 inline void update_avg_concurrent_gc_cost_counter() {
duke@435 182 _avg_concurrent_gc_cost_counter->set_value(
duke@435 183 (jlong) (cms_size_policy()->avg_concurrent_gc_cost()->average() * 100.0));
duke@435 184 }
duke@435 185
duke@435 186 inline void update_avg_cms_free_counter() {
duke@435 187 _avg_cms_free_counter->set_value(
duke@435 188 (jlong) cms_size_policy()->avg_cms_free()->average());
duke@435 189 }
duke@435 190
duke@435 191 inline void update_avg_cms_free_at_sweep_counter() {
duke@435 192 _avg_cms_free_at_sweep_counter->set_value(
duke@435 193 (jlong) cms_size_policy()->avg_cms_free_at_sweep()->average());
duke@435 194 }
duke@435 195
duke@435 196 inline void update_avg_cms_promo_counter() {
duke@435 197 _avg_cms_promo_counter->set_value(
duke@435 198 (jlong) cms_size_policy()->avg_cms_promo()->average());
duke@435 199 }
duke@435 200
duke@435 201 inline void update_avg_old_live_counter() {
duke@435 202 _avg_old_live_counter->set_value(
duke@435 203 (jlong)(cms_size_policy()->avg_old_live()->average())
duke@435 204 );
duke@435 205 }
duke@435 206
duke@435 207 inline void update_avg_msc_pause_counter() {
duke@435 208 _avg_msc_pause_counter->set_value(
duke@435 209 (jlong) (cms_size_policy()->avg_msc_pause()->average() *
duke@435 210 (double) MILLIUNITS));
duke@435 211 }
duke@435 212
duke@435 213 inline void update_avg_msc_interval_counter() {
duke@435 214 _avg_msc_interval_counter->set_value(
duke@435 215 (jlong) (cms_size_policy()->avg_msc_interval()->average() *
duke@435 216 (double) MILLIUNITS));
duke@435 217 }
duke@435 218
duke@435 219 inline void update_msc_gc_cost_counter() {
duke@435 220 _msc_gc_cost_counter->set_value(
duke@435 221 (jlong) (cms_size_policy()->avg_msc_gc_cost()->average() * 100.0));
duke@435 222 }
duke@435 223
duke@435 224 inline void update_avg_ms_pause_counter() {
duke@435 225 _avg_ms_pause_counter->set_value(
duke@435 226 (jlong) (cms_size_policy()->avg_ms_pause()->average() *
duke@435 227 (double) MILLIUNITS));
duke@435 228 }
duke@435 229
duke@435 230 inline void update_avg_ms_interval_counter() {
duke@435 231 _avg_ms_interval_counter->set_value(
duke@435 232 (jlong) (cms_size_policy()->avg_ms_interval()->average() *
duke@435 233 (double) MILLIUNITS));
duke@435 234 }
duke@435 235
duke@435 236 inline void update_ms_gc_cost_counter() {
duke@435 237 _ms_gc_cost_counter->set_value(
duke@435 238 (jlong) (cms_size_policy()->avg_ms_gc_cost()->average() * 100.0));
duke@435 239 }
duke@435 240
duke@435 241 inline void update_major_gc_cost_counter() {
duke@435 242 _major_gc_cost_counter->set_value(
duke@435 243 (jlong)(cms_size_policy()->cms_gc_cost() * 100.0)
duke@435 244 );
duke@435 245 }
duke@435 246 inline void update_mutator_cost_counter() {
duke@435 247 _mutator_cost_counter->set_value(
duke@435 248 (jlong)(cms_size_policy()->mutator_cost() * 100.0)
duke@435 249 );
duke@435 250 }
duke@435 251
duke@435 252 inline void update_avg_promoted_avg(CMSGCStats* gc_stats) {
duke@435 253 _promoted_avg_counter->set_value(
duke@435 254 (jlong)(gc_stats->avg_promoted()->average())
duke@435 255 );
duke@435 256 }
duke@435 257 inline void update_avg_promoted_dev(CMSGCStats* gc_stats) {
duke@435 258 _promoted_avg_dev_counter->set_value(
duke@435 259 (jlong)(gc_stats->avg_promoted()->deviation())
duke@435 260 );
duke@435 261 }
duke@435 262 inline void update_avg_promoted_padded_avg(CMSGCStats* gc_stats) {
duke@435 263 _promoted_padded_avg_counter->set_value(
duke@435 264 (jlong)(gc_stats->avg_promoted()->padded_average())
duke@435 265 );
duke@435 266 }
duke@435 267 inline void update_remark_pause_old_slope_counter() {
duke@435 268 _remark_pause_old_slope_counter->set_value(
duke@435 269 (jlong)(cms_size_policy()->remark_pause_old_slope() * 1000)
duke@435 270 );
duke@435 271 }
duke@435 272 inline void update_initial_pause_old_slope_counter() {
duke@435 273 _initial_pause_old_slope_counter->set_value(
duke@435 274 (jlong)(cms_size_policy()->initial_pause_old_slope() * 1000)
duke@435 275 );
duke@435 276 }
duke@435 277 inline void update_remark_pause_young_slope_counter() {
duke@435 278 _remark_pause_young_slope_counter->set_value(
duke@435 279 (jlong)(cms_size_policy()->remark_pause_young_slope() * 1000)
duke@435 280 );
duke@435 281 }
duke@435 282 inline void update_initial_pause_young_slope_counter() {
duke@435 283 _initial_pause_young_slope_counter->set_value(
duke@435 284 (jlong)(cms_size_policy()->initial_pause_young_slope() * 1000)
duke@435 285 );
duke@435 286 }
duke@435 287 inline void update_change_young_gen_for_maj_pauses() {
duke@435 288 _change_young_gen_for_maj_pauses_counter->set_value(
duke@435 289 cms_size_policy()->change_young_gen_for_maj_pauses());
duke@435 290 }
duke@435 291
duke@435 292 public:
duke@435 293 CMSGCAdaptivePolicyCounters(const char* name, int collectors, int generations,
duke@435 294 AdaptiveSizePolicy* size_policy);
duke@435 295
duke@435 296 // update counters
duke@435 297 void update_counters();
duke@435 298 void update_counters(CMSGCStats* gc_stats);
duke@435 299 void update_counters_from_policy();
duke@435 300
duke@435 301 inline void update_cms_capacity_counter(size_t size_in_bytes) {
duke@435 302 _cms_capacity_counter->set_value(size_in_bytes);
duke@435 303 }
duke@435 304
duke@435 305 virtual GCPolicyCounters::Name kind() const {
duke@435 306 return GCPolicyCounters::CMSGCAdaptivePolicyCountersKind;
duke@435 307 }
duke@435 308 };
stefank@2314 309
stefank@2314 310 #endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSGCADAPTIVEPOLICYCOUNTERS_HPP

mercurial