hotspot/src/share/vm/gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.hpp
author trims
Thu, 27 May 2010 19:08:38 -0700
changeset 5547 f4b087cbb361
parent 5343 95a5c4b89273
child 7397 5b173b4ca846
permissions -rw-r--r--
6941466: Oracle rebranding changes for Hotspot repositories Summary: Change all the Sun copyrights to Oracle copyright Reviewed-by: ohair
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: 5343
diff changeset
     2
 * Copyright (c) 2003, 2010, 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: 5343
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5343
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: 5343
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
// PSGCAdaptivePolicyCounters 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
// parallel scavenge collector.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
class PSGCAdaptivePolicyCounters : 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
  // survivor space vs. tenuring threshold
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
  PerfVariable* _old_promo_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  PerfVariable* _old_eden_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  PerfVariable* _avg_promoted_avg_counter;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  PerfVariable* _avg_promoted_dev_counter;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  PerfVariable* _avg_promoted_padded_avg_counter;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  PerfVariable* _avg_pretenured_padded_avg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  // young gen vs. old gen sizing
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  PerfVariable* _avg_major_pause;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  PerfVariable* _avg_major_interval;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  PerfVariable* _live_space;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  PerfVariable* _free_space;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  PerfVariable* _avg_base_footprint;
5343
95a5c4b89273 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 1
diff changeset
    47
  PerfVariable* _gc_overhead_limit_exceeded_counter;
95a5c4b89273 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 1
diff changeset
    48
  PerfVariable* _live_at_last_full_gc_counter;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  PerfVariable* _old_capacity;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  PerfVariable* _boundary_moved;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  PerfVariable* _change_old_gen_for_min_pauses;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  PerfVariable* _change_young_gen_for_maj_pauses_counter;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  PerfVariable* _major_pause_old_slope;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  PerfVariable* _minor_pause_old_slope;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  PerfVariable* _major_pause_young_slope;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  PerfVariable* _scavenge_skipped;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  PerfVariable* _full_follows_scavenge;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  // Use this time stamp if the gc time stamp is not available.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  TimeStamp     _counter_time_stamp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  PSAdaptiveSizePolicy* ps_size_policy() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    return (PSAdaptiveSizePolicy*)_size_policy;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  PSGCAdaptivePolicyCounters(const char* name, int collectors, int generations,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
                             PSAdaptiveSizePolicy* size_policy);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  inline void update_old_capacity(size_t size_in_bytes) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
    _old_capacity->set_value(size_in_bytes);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  inline void update_old_eden_size(size_t old_size) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    _old_eden_size->set_value(old_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  inline void update_old_promo_size(size_t old_size) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
    _old_promo_size->set_value(old_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  inline void update_boundary_moved(int size_in_bytes) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
    _boundary_moved->set_value(size_in_bytes);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  inline void update_avg_promoted_avg() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
    _avg_promoted_avg_counter->set_value(
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
      (jlong)(ps_size_policy()->avg_promoted()->average())
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
    );
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  inline void update_avg_promoted_dev() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
    _avg_promoted_dev_counter->set_value(
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
      (jlong)(ps_size_policy()->avg_promoted()->deviation())
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    );
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  inline void update_avg_promoted_padded_avg() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    _avg_promoted_padded_avg_counter->set_value(
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
      (jlong)(ps_size_policy()->avg_promoted()->padded_average())
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
    );
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  inline void update_avg_pretenured_padded_avg() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
    _avg_pretenured_padded_avg->set_value(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
      (jlong)(ps_size_policy()->_avg_pretenured->padded_average())
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  inline void update_change_young_gen_for_maj_pauses() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
    _change_young_gen_for_maj_pauses_counter->set_value(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
      ps_size_policy()->change_young_gen_for_maj_pauses());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  inline void update_change_old_gen_for_min_pauses() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
    _change_old_gen_for_min_pauses->set_value(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
      ps_size_policy()->change_old_gen_for_min_pauses());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  // compute_generation_free_space() statistics
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  inline void update_avg_major_pause() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
    _avg_major_pause->set_value(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
      (jlong)(ps_size_policy()->_avg_major_pause->average() * 1000.0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
    );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  inline void update_avg_major_interval() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    _avg_major_interval->set_value(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
      (jlong)(ps_size_policy()->_avg_major_interval->average() * 1000.0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  inline void update_major_gc_cost_counter() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
    _major_gc_cost_counter->set_value(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
      (jlong)(ps_size_policy()->major_gc_cost() * 100.0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  inline void update_mutator_cost_counter() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
    _mutator_cost_counter->set_value(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
      (jlong)(ps_size_policy()->mutator_cost() * 100.0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  inline void update_live_space() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
    _live_space->set_value(ps_size_policy()->live_space());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  inline void update_free_space() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
    _free_space->set_value(ps_size_policy()->free_space());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  inline void update_avg_base_footprint() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
    _avg_base_footprint->set_value(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
      (jlong)(ps_size_policy()->avg_base_footprint()->average())
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
    );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  inline void update_avg_old_live() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
    _avg_old_live_counter->set_value(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
      (jlong)(ps_size_policy()->avg_old_live()->average())
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
    );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  // Scale up all the slopes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  inline void update_major_pause_old_slope() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
    _major_pause_old_slope->set_value(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
      (jlong)(ps_size_policy()->major_pause_old_slope() * 1000)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
    );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  inline void update_minor_pause_old_slope() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
    _minor_pause_old_slope->set_value(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
      (jlong)(ps_size_policy()->minor_pause_old_slope() * 1000)
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_major_pause_young_slope() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
    _major_pause_young_slope->set_value(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
      (jlong)(ps_size_policy()->major_pause_young_slope() * 1000)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
    );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  }
5343
95a5c4b89273 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 1
diff changeset
   172
  inline void update_gc_overhead_limit_exceeded_counter() {
95a5c4b89273 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 1
diff changeset
   173
    _gc_overhead_limit_exceeded_counter->set_value(
95a5c4b89273 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 1
diff changeset
   174
      (jlong) ps_size_policy()->gc_overhead_limit_exceeded());
95a5c4b89273 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 1
diff changeset
   175
  }
95a5c4b89273 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 1
diff changeset
   176
  inline void update_live_at_last_full_gc_counter() {
95a5c4b89273 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 1
diff changeset
   177
    _live_at_last_full_gc_counter->set_value(
95a5c4b89273 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 1
diff changeset
   178
      (jlong)(ps_size_policy()->live_at_last_full_gc()));
95a5c4b89273 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 1
diff changeset
   179
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  inline void update_scavenge_skipped(int cause) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
    _scavenge_skipped->set_value(cause);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  inline void update_full_follows_scavenge(int event) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
    _full_follows_scavenge->set_value(event);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  // Update all the counters that can be updated from the size policy.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  // This should be called after all policy changes have been made
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  // and reflected internall in the size policy.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  void update_counters_from_policy();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  // Update counters that can be updated from fields internal to the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  // counter or from globals.  This is distinguished from counters
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  // that are updated via input parameters.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  void update_counters();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  virtual GCPolicyCounters::Name kind() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
    return GCPolicyCounters::PSGCAdaptivePolicyCountersKind;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
};