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<mtGC> {
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
525 _do_print = false;
526 }
527 }
528 AdaptiveSizePolicyOutput(AdaptiveSizePolicy* size_policy,
529 uint count) :
530 _size_policy(size_policy) {
531 if (UseAdaptiveSizePolicy && (AdaptiveSizePolicyOutputInterval > 0)) {
532 _do_print = print_test(count);
533 } else {
534 _do_print = false;
535 }
536 }
537 ~AdaptiveSizePolicyOutput() {
538 if (_do_print) {
539 assert(UseAdaptiveSizePolicy, "Should not be in use");
540 _size_policy->print_adaptive_size_policy_on(gclog_or_tty);
541 }
542 }
543 };
544
545 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_ADAPTIVESIZEPOLICY_HPP
|
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_SHARED_ADAPTIVESIZEPOLICY_HPP
26 #define SHARE_VM_GC_SHARED_ADAPTIVESIZEPOLICY_HPP
27
28 #include "gc/shared/collectedHeap.hpp"
29 #include "gc/shared/gcCause.hpp"
30 #include "gc/shared/gcUtil.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<mtGC> {
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
525 _do_print = false;
526 }
527 }
528 AdaptiveSizePolicyOutput(AdaptiveSizePolicy* size_policy,
529 uint count) :
530 _size_policy(size_policy) {
531 if (UseAdaptiveSizePolicy && (AdaptiveSizePolicyOutputInterval > 0)) {
532 _do_print = print_test(count);
533 } else {
534 _do_print = false;
535 }
536 }
537 ~AdaptiveSizePolicyOutput() {
538 if (_do_print) {
539 assert(UseAdaptiveSizePolicy, "Should not be in use");
540 _size_policy->print_adaptive_size_policy_on(gclog_or_tty);
541 }
542 }
543 };
544
545 #endif // SHARE_VM_GC_SHARED_ADAPTIVESIZEPOLICY_HPP
|