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

Print this page


   1 /*
   2  * Copyright (c) 2004, 2005, 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  */
  24 








  25 // This class keeps statistical information and computes the
  26 // size of the heap.
  27 
  28 class GCAdaptivePolicyCounters : public GCPolicyCounters {
  29  protected:
  30   PerfVariable*         _eden_size_counter;
  31   PerfVariable*         _promo_size_counter;
  32 
  33   PerfVariable*         _young_capacity_counter;
  34 
  35   PerfVariable*         _minor_gc_cost_counter;
  36   PerfVariable*         _major_gc_cost_counter;
  37   PerfVariable*         _mutator_cost_counter;
  38 
  39   PerfVariable*         _avg_young_live_counter;
  40   PerfVariable*         _avg_old_live_counter;
  41 
  42   PerfVariable*         _avg_minor_pause_counter;
  43   PerfVariable*         _avg_minor_interval_counter;
  44 


 205   }
 206 
 207   inline void update_minor_collection_slope_counter() {
 208     _minor_collection_slope_counter->set_value(
 209       (jlong)(size_policy()->minor_collection_slope() * 1000)
 210     );
 211   }
 212 
 213   inline void update_major_collection_slope_counter() {
 214     _major_collection_slope_counter->set_value(
 215       (jlong)(size_policy()->major_collection_slope() * 1000)
 216     );
 217   }
 218 
 219   void set_size_policy(AdaptiveSizePolicy* v) { _size_policy = v; }
 220 
 221   virtual GCPolicyCounters::Name kind() const {
 222     return GCPolicyCounters::GCAdaptivePolicyCountersKind;
 223   }
 224 };


   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  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_GCADAPTIVEPOLICYCOUNTERS_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCADAPTIVEPOLICYCOUNTERS_HPP
  27 
  28 #ifndef SERIALGC
  29 #include "gc_implementation/shared/adaptiveSizePolicy.hpp"
  30 #include "gc_implementation/shared/gcPolicyCounters.hpp"
  31 #endif
  32 
  33 // This class keeps statistical information and computes the
  34 // size of the heap.
  35 
  36 class GCAdaptivePolicyCounters : public GCPolicyCounters {
  37  protected:
  38   PerfVariable*         _eden_size_counter;
  39   PerfVariable*         _promo_size_counter;
  40 
  41   PerfVariable*         _young_capacity_counter;
  42 
  43   PerfVariable*         _minor_gc_cost_counter;
  44   PerfVariable*         _major_gc_cost_counter;
  45   PerfVariable*         _mutator_cost_counter;
  46 
  47   PerfVariable*         _avg_young_live_counter;
  48   PerfVariable*         _avg_old_live_counter;
  49 
  50   PerfVariable*         _avg_minor_pause_counter;
  51   PerfVariable*         _avg_minor_interval_counter;
  52 


 213   }
 214 
 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   }
 220 
 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   }
 226 
 227   void set_size_policy(AdaptiveSizePolicy* v) { _size_policy = v; }
 228 
 229   virtual GCPolicyCounters::Name kind() const {
 230     return GCPolicyCounters::GCAdaptivePolicyCountersKind;
 231   }
 232 };
 233 
 234 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_GCADAPTIVEPOLICYCOUNTERS_HPP