< prev index next >

src/hotspot/share/gc/shared/adaptiveSizePolicy.hpp

Print this page
rev 52963 : 8212206: Refactor AdaptiveSizePolicy to separate out code related to GC overhead
Summary: Move check_gc_overhead_limit() and related code to its own class
Reviewed-by:


   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_SHARED_ADAPTIVESIZEPOLICY_HPP
  26 #define SHARE_VM_GC_SHARED_ADAPTIVESIZEPOLICY_HPP
  27 
  28 #include "gc/shared/gcCause.hpp"

  29 #include "gc/shared/gcUtil.hpp"
  30 #include "gc/shared/overheadChecker.hpp"
  31 #include "memory/allocation.hpp"
  32 
  33 // This class keeps statistical information and computes the
  34 // size of the heap.
  35 
  36 // Forward decls
  37 class elapsedTimer;
  38 
  39 class AdaptiveSizePolicy : public CHeapObj<mtGC> {
  40  friend class GCAdaptivePolicyCounters;
  41  friend class PSGCAdaptivePolicyCounters;
  42  friend class CMSGCAdaptivePolicyCounters;
  43  protected:
  44 
  45   enum GCPolicyKind {
  46     _gc_adaptive_size_policy,
  47     _gc_ps_adaptive_size_policy,
  48     _gc_cms_adaptive_size_policy
  49   };
  50   virtual GCPolicyKind kind() const { return _gc_adaptive_size_policy; }


  65 
  66     increase_old_gen_for_throughput_true = 4,
  67     increase_young_gen_for_througput_true = 5,
  68 
  69     decrease_young_gen_for_footprint_true = 6,
  70     decrease_old_gen_for_footprint_true = 7,
  71     decide_at_full_gc_true = 8
  72   };
  73 
  74   // Goal for the fraction of the total time during which application
  75   // threads run
  76   const double _throughput_goal;
  77 
  78   // Last calculated sizes, in bytes, and aligned
  79   size_t _eden_size;        // calculated eden free space in bytes
  80   size_t _promo_size;       // calculated cms gen free space in bytes
  81 
  82   size_t _survivor_size;    // calculated survivor size in bytes
  83 
  84   // Support for UseGCOverheadLimit
  85   OverheadChecker _overhead_checker;
  86 
  87   // Minor collection timers used to determine both
  88   // pause and interval times for collections
  89   static elapsedTimer _minor_timer;
  90 
  91   // Major collection timers, used to determine both
  92   // pause and interval times for collections
  93   static elapsedTimer _major_timer;
  94 
  95   // Time statistics
  96   AdaptivePaddedAverage*   _avg_minor_pause;
  97   AdaptiveWeightedAverage* _avg_minor_interval;
  98   AdaptiveWeightedAverage* _avg_minor_gc_cost;
  99 
 100   AdaptiveWeightedAverage* _avg_major_interval;
 101   AdaptiveWeightedAverage* _avg_major_gc_cost;
 102 
 103   // Footprint statistics
 104   AdaptiveWeightedAverage* _avg_young_live;
 105   AdaptiveWeightedAverage* _avg_eden_live;




   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_SHARED_ADAPTIVESIZEPOLICY_HPP
  26 #define SHARE_VM_GC_SHARED_ADAPTIVESIZEPOLICY_HPP
  27 
  28 #include "gc/shared/gcCause.hpp"
  29 #include "gc/shared/gcOverheadChecker.hpp"
  30 #include "gc/shared/gcUtil.hpp"

  31 #include "memory/allocation.hpp"
  32 
  33 // This class keeps statistical information and computes the
  34 // size of the heap.
  35 
  36 // Forward decls
  37 class elapsedTimer;
  38 
  39 class AdaptiveSizePolicy : public CHeapObj<mtGC> {
  40  friend class GCAdaptivePolicyCounters;
  41  friend class PSGCAdaptivePolicyCounters;
  42  friend class CMSGCAdaptivePolicyCounters;
  43  protected:
  44 
  45   enum GCPolicyKind {
  46     _gc_adaptive_size_policy,
  47     _gc_ps_adaptive_size_policy,
  48     _gc_cms_adaptive_size_policy
  49   };
  50   virtual GCPolicyKind kind() const { return _gc_adaptive_size_policy; }


  65 
  66     increase_old_gen_for_throughput_true = 4,
  67     increase_young_gen_for_througput_true = 5,
  68 
  69     decrease_young_gen_for_footprint_true = 6,
  70     decrease_old_gen_for_footprint_true = 7,
  71     decide_at_full_gc_true = 8
  72   };
  73 
  74   // Goal for the fraction of the total time during which application
  75   // threads run
  76   const double _throughput_goal;
  77 
  78   // Last calculated sizes, in bytes, and aligned
  79   size_t _eden_size;        // calculated eden free space in bytes
  80   size_t _promo_size;       // calculated cms gen free space in bytes
  81 
  82   size_t _survivor_size;    // calculated survivor size in bytes
  83 
  84   // Support for UseGCOverheadLimit
  85   GCOverheadChecker _overhead_checker;
  86 
  87   // Minor collection timers used to determine both
  88   // pause and interval times for collections
  89   static elapsedTimer _minor_timer;
  90 
  91   // Major collection timers, used to determine both
  92   // pause and interval times for collections
  93   static elapsedTimer _major_timer;
  94 
  95   // Time statistics
  96   AdaptivePaddedAverage*   _avg_minor_pause;
  97   AdaptiveWeightedAverage* _avg_minor_interval;
  98   AdaptiveWeightedAverage* _avg_minor_gc_cost;
  99 
 100   AdaptiveWeightedAverage* _avg_major_interval;
 101   AdaptiveWeightedAverage* _avg_major_gc_cost;
 102 
 103   // Footprint statistics
 104   AdaptiveWeightedAverage* _avg_young_live;
 105   AdaptiveWeightedAverage* _avg_eden_live;


< prev index next >