src/share/vm/gc_implementation/shared/gcAdaptivePolicyCounters.hpp

Wed, 03 Oct 2012 20:31:41 +0200

author
jwilhelm
date
Wed, 03 Oct 2012 20:31:41 +0200
changeset 4129
22b8d3d181d9
parent 2314
f95d63e2154a
child 4542
db9981fd3124
permissions
-rw-r--r--

8000351: Tenuring threshold should be unsigned
Summary: Change the flags and variables related to tenuring threshold to be unsigned
Reviewed-by: jmasa, johnc

     1 /*
     2  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    22  *
    23  */
    25 #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_GCADAPTIVEPOLICYCOUNTERS_HPP
    26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCADAPTIVEPOLICYCOUNTERS_HPP
    28 #ifndef SERIALGC
    29 #include "gc_implementation/shared/adaptiveSizePolicy.hpp"
    30 #include "gc_implementation/shared/gcPolicyCounters.hpp"
    31 #endif
    33 // This class keeps statistical information and computes the
    34 // size of the heap.
    36 class GCAdaptivePolicyCounters : public GCPolicyCounters {
    37  protected:
    38   PerfVariable*         _eden_size_counter;
    39   PerfVariable*         _promo_size_counter;
    41   PerfVariable*         _young_capacity_counter;
    43   PerfVariable*         _minor_gc_cost_counter;
    44   PerfVariable*         _major_gc_cost_counter;
    45   PerfVariable*         _mutator_cost_counter;
    47   PerfVariable*         _avg_young_live_counter;
    48   PerfVariable*         _avg_old_live_counter;
    50   PerfVariable*         _avg_minor_pause_counter;
    51   PerfVariable*         _avg_minor_interval_counter;
    53 #ifdef NOT_PRODUCT
    54   PerfVariable*         _minor_pause_counter;
    55 #endif
    57   PerfVariable*         _change_young_gen_for_min_pauses_counter;
    58   PerfVariable*         _change_young_gen_for_throughput_counter;
    59   PerfVariable*         _change_old_gen_for_maj_pauses_counter;
    60   PerfVariable*         _change_old_gen_for_throughput_counter;
    61   PerfVariable*         _decrease_for_footprint_counter;
    63   PerfVariable*         _minor_pause_young_slope_counter;
    64   PerfVariable*         _major_pause_old_slope_counter;
    66   PerfVariable*         _decide_at_full_gc_counter;
    68   PerfVariable*         _survived_counter;
    69   PerfVariable*         _promoted_counter;
    71   PerfVariable*         _avg_survived_avg_counter;
    72   PerfVariable*         _avg_survived_dev_counter;
    73   PerfVariable*         _avg_survived_padded_avg_counter;
    75   PerfVariable*         _survivor_overflowed_counter;
    76   PerfVariable*         _increment_tenuring_threshold_for_gc_cost_counter;
    77   PerfVariable*         _decrement_tenuring_threshold_for_gc_cost_counter;
    78   PerfVariable*        _decrement_tenuring_threshold_for_survivor_limit_counter;
    80   PerfVariable*         _minor_collection_slope_counter;
    81   PerfVariable*         _major_collection_slope_counter;
    83   AdaptiveSizePolicy* _size_policy;
    85   inline void update_eden_size() {
    86     size_t eden_size_in_bytes = size_policy()->calculated_eden_size_in_bytes();
    87     _eden_size_counter->set_value(eden_size_in_bytes);
    88   }
    90   inline void update_promo_size() {
    91     _promo_size_counter->set_value(
    92       size_policy()->calculated_promo_size_in_bytes());
    93   }
    95   inline void update_avg_minor_pause_counter() {
    96     _avg_minor_pause_counter->set_value((jlong)
    97       (size_policy()->avg_minor_pause()->average() * 1000.0));
    98   }
    99   inline void update_avg_minor_interval_counter() {
   100     _avg_minor_interval_counter->set_value((jlong)
   101       (size_policy()->avg_minor_interval()->average() * 1000.0));
   102   }
   104 #ifdef NOT_PRODUCT
   105   inline void update_minor_pause_counter() {
   106     _minor_pause_counter->set_value((jlong)
   107       (size_policy()->avg_minor_pause()->last_sample() * 1000.0));
   108   }
   109 #endif
   110   inline void update_minor_gc_cost_counter() {
   111     _minor_gc_cost_counter->set_value((jlong)
   112       (size_policy()->minor_gc_cost() * 100.0));
   113   }
   115   inline void update_avg_young_live_counter() {
   116     _avg_young_live_counter->set_value(
   117       (jlong)(size_policy()->avg_young_live()->average())
   118     );
   119   }
   121   inline void update_avg_survived_avg_counters() {
   122     _avg_survived_avg_counter->set_value(
   123       (jlong)(size_policy()->_avg_survived->average())
   124     );
   125   }
   126   inline void update_avg_survived_dev_counters() {
   127     _avg_survived_dev_counter->set_value(
   128       (jlong)(size_policy()->_avg_survived->deviation())
   129     );
   130   }
   131   inline void update_avg_survived_padded_avg_counters() {
   132     _avg_survived_padded_avg_counter->set_value(
   133       (jlong)(size_policy()->_avg_survived->padded_average())
   134     );
   135   }
   137   inline void update_change_old_gen_for_throughput() {
   138     _change_old_gen_for_throughput_counter->set_value(
   139       size_policy()->change_old_gen_for_throughput());
   140   }
   141   inline void update_change_young_gen_for_throughput() {
   142     _change_young_gen_for_throughput_counter->set_value(
   143       size_policy()->change_young_gen_for_throughput());
   144   }
   145   inline void update_decrease_for_footprint() {
   146     _decrease_for_footprint_counter->set_value(
   147       size_policy()->decrease_for_footprint());
   148   }
   150   inline void update_decide_at_full_gc_counter() {
   151     _decide_at_full_gc_counter->set_value(
   152       size_policy()->decide_at_full_gc());
   153   }
   155   inline void update_minor_pause_young_slope_counter() {
   156     _minor_pause_young_slope_counter->set_value(
   157       (jlong)(size_policy()->minor_pause_young_slope() * 1000)
   158     );
   159   }
   161   virtual void update_counters_from_policy();
   163  protected:
   164   virtual AdaptiveSizePolicy* size_policy() { return _size_policy; }
   166  public:
   167   GCAdaptivePolicyCounters(const char* name,
   168                            int collectors,
   169                            int generations,
   170                            AdaptiveSizePolicy* size_policy);
   172   inline void update_survived(size_t survived) {
   173     _survived_counter->set_value(survived);
   174   }
   175   inline void update_promoted(size_t promoted) {
   176     _promoted_counter->set_value(promoted);
   177   }
   178   inline void update_young_capacity(size_t size_in_bytes) {
   179     _young_capacity_counter->set_value(size_in_bytes);
   180   }
   182   virtual void update_counters();
   184   inline void update_survivor_size_counters() {
   185     desired_survivor_size()->set_value(
   186       size_policy()->calculated_survivor_size_in_bytes());
   187   }
   188   inline void update_survivor_overflowed(bool survivor_overflowed) {
   189     _survivor_overflowed_counter->set_value(survivor_overflowed);
   190   }
   191   inline void update_tenuring_threshold(uint threshold) {
   192     tenuring_threshold()->set_value(threshold);
   193   }
   194   inline void update_increment_tenuring_threshold_for_gc_cost() {
   195     _increment_tenuring_threshold_for_gc_cost_counter->set_value(
   196       size_policy()->increment_tenuring_threshold_for_gc_cost());
   197   }
   198   inline void update_decrement_tenuring_threshold_for_gc_cost() {
   199     _decrement_tenuring_threshold_for_gc_cost_counter->set_value(
   200       size_policy()->decrement_tenuring_threshold_for_gc_cost());
   201   }
   202   inline void update_decrement_tenuring_threshold_for_survivor_limit() {
   203     _decrement_tenuring_threshold_for_survivor_limit_counter->set_value(
   204       size_policy()->decrement_tenuring_threshold_for_survivor_limit());
   205   }
   206   inline void update_change_young_gen_for_min_pauses() {
   207     _change_young_gen_for_min_pauses_counter->set_value(
   208       size_policy()->change_young_gen_for_min_pauses());
   209   }
   210   inline void update_change_old_gen_for_maj_pauses() {
   211     _change_old_gen_for_maj_pauses_counter->set_value(
   212       size_policy()->change_old_gen_for_maj_pauses());
   213   }
   215   inline void update_minor_collection_slope_counter() {
   216     _minor_collection_slope_counter->set_value(
   217       (jlong)(size_policy()->minor_collection_slope() * 1000)
   218     );
   219   }
   221   inline void update_major_collection_slope_counter() {
   222     _major_collection_slope_counter->set_value(
   223       (jlong)(size_policy()->major_collection_slope() * 1000)
   224     );
   225   }
   227   void set_size_policy(AdaptiveSizePolicy* v) { _size_policy = v; }
   229   virtual GCPolicyCounters::Name kind() const {
   230     return GCPolicyCounters::GCAdaptivePolicyCountersKind;
   231   }
   232 };
   234 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_GCADAPTIVEPOLICYCOUNTERS_HPP

mercurial