< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahCollectorPolicy.hpp

Print this page

 1 /*
 2  * Copyright (c) 2013, 2021, Red Hat, Inc. 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_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP
26 #define SHARE_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP
27 
28 #include "gc/shared/gcTrace.hpp"
29 #include "gc/shenandoah/shenandoahGC.hpp"
30 #include "gc/shenandoah/shenandoahSharedVariables.hpp"
31 #include "memory/allocation.hpp"
32 #include "utilities/ostream.hpp"
33 
34 class ShenandoahTracer : public GCTracer, public CHeapObj<mtGC> {
35 public:
36   ShenandoahTracer() : GCTracer(Shenandoah) {}
37 };
38 
39 class ShenandoahCollectorPolicy : public CHeapObj<mtGC> {
40 private:
41   size_t _success_concurrent_gcs;




42   size_t _success_degenerated_gcs;
43   size_t _success_full_gcs;
44   size_t _alloc_failure_degenerated;
45   size_t _alloc_failure_degenerated_upgrade_to_full;
46   size_t _alloc_failure_full;
47   size_t _explicit_concurrent;
48   size_t _explicit_full;
49   size_t _implicit_concurrent;
50   size_t _implicit_full;

51   size_t _degen_points[ShenandoahGC::_DEGENERATED_LIMIT];
52 
53   ShenandoahSharedFlag _in_shutdown;
54 
55   ShenandoahTracer* _tracer;
56 
57   size_t _cycle_counter;
58 
59 public:
60   ShenandoahCollectorPolicy();
61 
62   // TODO: This is different from gc_end: that one encompasses one VM operation.
63   // These two encompass the entire cycle.
64   void record_cycle_start();
65 


66   void record_success_concurrent();


67   void record_success_degenerated();
68   void record_success_full();
69   void record_alloc_failure_to_degenerated(ShenandoahGC::ShenandoahDegenPoint point);
70   void record_alloc_failure_to_full();
71   void record_degenerated_upgrade_to_full();
72   void record_explicit_to_concurrent();
73   void record_explicit_to_full();
74   void record_implicit_to_concurrent();
75   void record_implicit_to_full();
76 
77   void record_shutdown();
78   bool is_at_shutdown();
79 
80   ShenandoahTracer* tracer() {return _tracer;}
81 
82   size_t cycle_counter() const;
83 


84   void print_gc_stats(outputStream* out) const;
85 };
86 
87 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP

 1 /*
 2  * Copyright (c) 2013, 2021, Red Hat, Inc. All rights reserved.
 3  * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
 4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 5  *
 6  * This code is free software; you can redistribute it and/or modify it
 7  * under the terms of the GNU General Public License version 2 only, as
 8  * published by the Free Software Foundation.
 9  *
10  * This code is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13  * version 2 for more details (a copy is included in the LICENSE file that
14  * accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License version
17  * 2 along with this work; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19  *
20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21  * or visit www.oracle.com if you need additional information or have any
22  * questions.
23  *
24  */
25 
26 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP
27 #define SHARE_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP
28 
29 #include "gc/shared/gcTrace.hpp"
30 #include "gc/shenandoah/shenandoahGC.hpp"
31 #include "gc/shenandoah/shenandoahSharedVariables.hpp"
32 #include "memory/allocation.hpp"
33 #include "utilities/ostream.hpp"
34 
35 class ShenandoahTracer : public GCTracer, public CHeapObj<mtGC> {
36 public:
37   ShenandoahTracer() : GCTracer(Shenandoah) {}
38 };
39 
40 class ShenandoahCollectorPolicy : public CHeapObj<mtGC> {
41 private:
42   size_t _success_concurrent_gcs;
43   size_t _mixed_gcs;
44   size_t _abbreviated_cycles;
45   size_t _success_old_gcs;
46   size_t _interrupted_old_gcs;
47   size_t _success_degenerated_gcs;
48   volatile size_t _success_full_gcs;
49   size_t _alloc_failure_degenerated;
50   volatile size_t _alloc_failure_degenerated_upgrade_to_full;
51   size_t _alloc_failure_full;
52   size_t _explicit_concurrent;
53   size_t _explicit_full;
54   size_t _implicit_concurrent;
55   size_t _implicit_full;
56   size_t _cycle_counter;
57   size_t _degen_points[ShenandoahGC::_DEGENERATED_LIMIT];
58 
59   ShenandoahSharedFlag _in_shutdown;

60   ShenandoahTracer* _tracer;
61 


62 public:
63   ShenandoahCollectorPolicy();
64 
65   // TODO: This is different from gc_end: that one encompasses one VM operation.
66   // These two encompass the entire cycle.
67   void record_cycle_start();
68 
69   void record_mixed_cycle();
70   void record_abbreviated_cycle();
71   void record_success_concurrent();
72   void record_success_old();
73   void record_interrupted_old();
74   void record_success_degenerated();
75   void record_success_full();
76   void record_alloc_failure_to_degenerated(ShenandoahGC::ShenandoahDegenPoint point);
77   void record_alloc_failure_to_full();
78   void record_degenerated_upgrade_to_full();
79   void record_explicit_to_concurrent();
80   void record_explicit_to_full();
81   void record_implicit_to_concurrent();
82   void record_implicit_to_full();
83 
84   void record_shutdown();
85   bool is_at_shutdown();
86 
87   ShenandoahTracer* tracer() {return _tracer;}
88 
89   size_t cycle_counter() const;
90 
91   size_t get_fullgc_count();
92 
93   void print_gc_stats(outputStream* out) const;
94 };
95 
96 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP
< prev index next >