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

Print this page




   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 // Forward decls
  29 class elapsedTimer;
  30 class CollectorPolicy;
  31 
  32 class AdaptiveSizePolicy : public CHeapObj {
  33  friend class GCAdaptivePolicyCounters;
  34  friend class PSGCAdaptivePolicyCounters;
  35  friend class CMSGCAdaptivePolicyCounters;
  36  protected:
  37 
  38   enum GCPolicyKind {
  39     _gc_adaptive_size_policy,
  40     _gc_ps_adaptive_size_policy,
  41     _gc_cms_adaptive_size_policy
  42   };
  43   virtual GCPolicyKind kind() const { return _gc_adaptive_size_policy; }
  44 


 486       _size_policy = NULL;
 487       _do_print = false;
 488     }
 489   }
 490   AdaptiveSizePolicyOutput(AdaptiveSizePolicy* size_policy,
 491                            uint count) :
 492     _size_policy(size_policy) {
 493     if (UseAdaptiveSizePolicy && (AdaptiveSizePolicyOutputInterval > 0)) {
 494       _do_print = print_test(count);
 495     } else {
 496       _do_print = false;
 497     }
 498   }
 499   ~AdaptiveSizePolicyOutput() {
 500     if (_do_print) {
 501       assert(UseAdaptiveSizePolicy, "Should not be in use");
 502       _size_policy->print_adaptive_size_policy_on(gclog_or_tty);
 503     }
 504   }
 505 };




   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_ADAPTIVESIZEPOLICY_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_ADAPTIVESIZEPOLICY_HPP
  27 
  28 #include "gc_implementation/shared/gcUtil.hpp"
  29 #include "gc_interface/collectedHeap.hpp"
  30 #include "gc_interface/gcCause.hpp"
  31 #include "memory/allocation.hpp"
  32 #include "memory/universe.hpp"
  33 
  34 // This class keeps statistical information and computes the
  35 // size of the heap.
  36 
  37 // Forward decls
  38 class elapsedTimer;
  39 class CollectorPolicy;
  40 
  41 class AdaptiveSizePolicy : public CHeapObj {
  42  friend class GCAdaptivePolicyCounters;
  43  friend class PSGCAdaptivePolicyCounters;
  44  friend class CMSGCAdaptivePolicyCounters;
  45  protected:
  46 
  47   enum GCPolicyKind {
  48     _gc_adaptive_size_policy,
  49     _gc_ps_adaptive_size_policy,
  50     _gc_cms_adaptive_size_policy
  51   };
  52   virtual GCPolicyKind kind() const { return _gc_adaptive_size_policy; }
  53 


 495       _size_policy = NULL;
 496       _do_print = false;
 497     }
 498   }
 499   AdaptiveSizePolicyOutput(AdaptiveSizePolicy* size_policy,
 500                            uint count) :
 501     _size_policy(size_policy) {
 502     if (UseAdaptiveSizePolicy && (AdaptiveSizePolicyOutputInterval > 0)) {
 503       _do_print = print_test(count);
 504     } else {
 505       _do_print = false;
 506     }
 507   }
 508   ~AdaptiveSizePolicyOutput() {
 509     if (_do_print) {
 510       assert(UseAdaptiveSizePolicy, "Should not be in use");
 511       _size_policy->print_adaptive_size_policy_on(gclog_or_tty);
 512     }
 513   }
 514 };
 515 
 516 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_ADAPTIVESIZEPOLICY_HPP