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