src/share/vm/gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp

Print this page


   1 /*
   2  * Copyright (c) 2004, 2006, 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 for the concurrent mark sweep collector.
  27 //
  28 // Cost for garbage collector include cost for
  29 //   minor collection
  30 //   concurrent collection
  31 //      stop-the-world component
  32 //      concurrent component
  33 //   major compacting collection
  34 //      uses decaying cost
  35 
  36 // Forward decls
  37 class elapsedTimer;
  38 
  39 class CMSAdaptiveSizePolicy : public AdaptiveSizePolicy {
  40  friend class CMSGCAdaptivePolicyCounters;
  41  friend class CMSCollector;
  42  private:
  43 
  44   // Total number of processors available


 450   size_t adjust_eden_for_throughput(size_t cur_eden);
 451   size_t adjust_eden_for_footprint(size_t cur_eden);
 452 
 453   size_t promo_decrement_aligned_down(size_t cur_promo);
 454   size_t promo_increment_aligned_up(size_t cur_promo);
 455 
 456   size_t adjust_promo_for_pause_time(size_t cur_promo);
 457   size_t adjust_promo_for_throughput(size_t cur_promo);
 458   size_t adjust_promo_for_footprint(size_t cur_promo, size_t cur_eden);
 459 
 460   // Scale down the input size by the ratio of the cost to collect the
 461   // generation to the total GC cost.
 462   size_t scale_by_gen_gc_cost(size_t base_change, double gen_gc_cost);
 463 
 464   // Return the value and clear it.
 465   bool get_and_clear_first_after_collection();
 466 
 467   // Printing support
 468   virtual bool print_adaptive_size_policy_on(outputStream* st) const;
 469 };


   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_CONCURRENTMARKSWEEP_CMSADAPTIVESIZEPOLICY_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSADAPTIVESIZEPOLICY_HPP
  27 
  28 #include "gc_implementation/shared/adaptiveSizePolicy.hpp"
  29 #include "runtime/timer.hpp"
  30 
  31 // This class keeps statistical information and computes the
  32 // size of the heap for the concurrent mark sweep collector.
  33 //
  34 // Cost for garbage collector include cost for
  35 //   minor collection
  36 //   concurrent collection
  37 //      stop-the-world component
  38 //      concurrent component
  39 //   major compacting collection
  40 //      uses decaying cost
  41 
  42 // Forward decls
  43 class elapsedTimer;
  44 
  45 class CMSAdaptiveSizePolicy : public AdaptiveSizePolicy {
  46  friend class CMSGCAdaptivePolicyCounters;
  47  friend class CMSCollector;
  48  private:
  49 
  50   // Total number of processors available


 456   size_t adjust_eden_for_throughput(size_t cur_eden);
 457   size_t adjust_eden_for_footprint(size_t cur_eden);
 458 
 459   size_t promo_decrement_aligned_down(size_t cur_promo);
 460   size_t promo_increment_aligned_up(size_t cur_promo);
 461 
 462   size_t adjust_promo_for_pause_time(size_t cur_promo);
 463   size_t adjust_promo_for_throughput(size_t cur_promo);
 464   size_t adjust_promo_for_footprint(size_t cur_promo, size_t cur_eden);
 465 
 466   // Scale down the input size by the ratio of the cost to collect the
 467   // generation to the total GC cost.
 468   size_t scale_by_gen_gc_cost(size_t base_change, double gen_gc_cost);
 469 
 470   // Return the value and clear it.
 471   bool get_and_clear_first_after_collection();
 472 
 473   // Printing support
 474   virtual bool print_adaptive_size_policy_on(outputStream* st) const;
 475 };
 476 
 477 #endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSADAPTIVESIZEPOLICY_HPP