< prev index next >

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

Print this page

 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 #include "precompiled.hpp"
 26 
 27 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
 28 #include "gc/shenandoah/shenandoahGC.hpp"
 29 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
 30 #include "runtime/os.hpp"
 31 
 32 ShenandoahCollectorPolicy::ShenandoahCollectorPolicy() :
 33   _success_concurrent_gcs(0),




 34   _success_degenerated_gcs(0),
 35   _success_full_gcs(0),
 36   _alloc_failure_degenerated(0),
 37   _alloc_failure_degenerated_upgrade_to_full(0),
 38   _alloc_failure_full(0),
 39   _explicit_concurrent(0),
 40   _explicit_full(0),
 41   _implicit_concurrent(0),
 42   _implicit_full(0),
 43   _cycle_counter(0) {
 44 
 45   Copy::zero_to_bytes(_degen_points, sizeof(size_t) * ShenandoahGC::_DEGENERATED_LIMIT);
 46 
 47   _tracer = new ShenandoahTracer();
 48 
 49 }
 50 
 51 void ShenandoahCollectorPolicy::record_explicit_to_concurrent() {
 52   _explicit_concurrent++;
 53 }

 58 
 59 void ShenandoahCollectorPolicy::record_implicit_to_concurrent() {
 60   _implicit_concurrent++;
 61 }
 62 
 63 void ShenandoahCollectorPolicy::record_implicit_to_full() {
 64   _implicit_full++;
 65 }
 66 
 67 void ShenandoahCollectorPolicy::record_alloc_failure_to_full() {
 68   _alloc_failure_full++;
 69 }
 70 
 71 void ShenandoahCollectorPolicy::record_alloc_failure_to_degenerated(ShenandoahGC::ShenandoahDegenPoint point) {
 72   assert(point < ShenandoahGC::_DEGENERATED_LIMIT, "sanity");
 73   _alloc_failure_degenerated++;
 74   _degen_points[point]++;
 75 }
 76 
 77 void ShenandoahCollectorPolicy::record_degenerated_upgrade_to_full() {

 78   _alloc_failure_degenerated_upgrade_to_full++;
 79 }
 80 
 81 void ShenandoahCollectorPolicy::record_success_concurrent() {
 82   _success_concurrent_gcs++;
 83 }
 84 
















 85 void ShenandoahCollectorPolicy::record_success_degenerated() {
 86   _success_degenerated_gcs++;
 87 }
 88 
 89 void ShenandoahCollectorPolicy::record_success_full() {
 90   _success_full_gcs++;
 91 }
 92 
 93 size_t ShenandoahCollectorPolicy::cycle_counter() const {
 94   return _cycle_counter;
 95 }
 96 
 97 void ShenandoahCollectorPolicy::record_cycle_start() {
 98   _cycle_counter++;
 99 }
100 
101 void ShenandoahCollectorPolicy::record_shutdown() {
102   _in_shutdown.set();
103 }
104 
105 bool ShenandoahCollectorPolicy::is_at_shutdown() {
106   return _in_shutdown.is_set();
107 }
108 
109 void ShenandoahCollectorPolicy::print_gc_stats(outputStream* out) const {
110   out->print_cr("Under allocation pressure, concurrent cycles may cancel, and either continue cycle");
111   out->print_cr("under stop-the-world pause or result in stop-the-world Full GC. Increase heap size,");
112   out->print_cr("tune GC heuristics, set more aggressive pacing delay, or lower allocation rate");
113   out->print_cr("to avoid Degenerated and Full GC cycles.");

114   out->cr();
115 
116   out->print_cr(SIZE_FORMAT_W(5) " successful concurrent GCs",         _success_concurrent_gcs);
117   out->print_cr("  " SIZE_FORMAT_W(5) " invoked explicitly",           _explicit_concurrent);
118   out->print_cr("  " SIZE_FORMAT_W(5) " invoked implicitly",           _implicit_concurrent);
119   out->cr();
120 





121   out->print_cr(SIZE_FORMAT_W(5) " Degenerated GCs",                   _success_degenerated_gcs);
122   out->print_cr("  " SIZE_FORMAT_W(5) " caused by allocation failure", _alloc_failure_degenerated);
123   for (int c = 0; c < ShenandoahGC::_DEGENERATED_LIMIT; c++) {
124     if (_degen_points[c] > 0) {
125       const char* desc = ShenandoahGC::degen_point_to_string((ShenandoahGC::ShenandoahDegenPoint)c);
126       out->print_cr("    " SIZE_FORMAT_W(5) " happened at %s",         _degen_points[c], desc);
127     }
128   }
129   out->print_cr("  " SIZE_FORMAT_W(5) " upgraded to Full GC",          _alloc_failure_degenerated_upgrade_to_full);
130   out->cr();
131 



132   out->print_cr(SIZE_FORMAT_W(5) " Full GCs",                          _success_full_gcs + _alloc_failure_degenerated_upgrade_to_full);
133   out->print_cr("  " SIZE_FORMAT_W(5) " invoked explicitly",           _explicit_full);
134   out->print_cr("  " SIZE_FORMAT_W(5) " invoked implicitly",           _implicit_full);
135   out->print_cr("  " SIZE_FORMAT_W(5) " caused by allocation failure", _alloc_failure_full);
136   out->print_cr("  " SIZE_FORMAT_W(5) " upgraded from Degenerated GC", _alloc_failure_degenerated_upgrade_to_full);
137 }

 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 #include "precompiled.hpp"
 26 
 27 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
 28 #include "gc/shenandoah/shenandoahGC.hpp"
 29 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
 30 #include "runtime/os.hpp"
 31 
 32 ShenandoahCollectorPolicy::ShenandoahCollectorPolicy() :
 33   _success_concurrent_gcs(0),
 34   _mixed_gcs(0),
 35   _abbreviated_cycles(0),
 36   _success_old_gcs(0),
 37   _interrupted_old_gcs(0),
 38   _success_degenerated_gcs(0),
 39   _success_full_gcs(0),
 40   _alloc_failure_degenerated(0),
 41   _alloc_failure_degenerated_upgrade_to_full(0),
 42   _alloc_failure_full(0),
 43   _explicit_concurrent(0),
 44   _explicit_full(0),
 45   _implicit_concurrent(0),
 46   _implicit_full(0),
 47   _cycle_counter(0) {
 48 
 49   Copy::zero_to_bytes(_degen_points, sizeof(size_t) * ShenandoahGC::_DEGENERATED_LIMIT);
 50 
 51   _tracer = new ShenandoahTracer();
 52 
 53 }
 54 
 55 void ShenandoahCollectorPolicy::record_explicit_to_concurrent() {
 56   _explicit_concurrent++;
 57 }

 62 
 63 void ShenandoahCollectorPolicy::record_implicit_to_concurrent() {
 64   _implicit_concurrent++;
 65 }
 66 
 67 void ShenandoahCollectorPolicy::record_implicit_to_full() {
 68   _implicit_full++;
 69 }
 70 
 71 void ShenandoahCollectorPolicy::record_alloc_failure_to_full() {
 72   _alloc_failure_full++;
 73 }
 74 
 75 void ShenandoahCollectorPolicy::record_alloc_failure_to_degenerated(ShenandoahGC::ShenandoahDegenPoint point) {
 76   assert(point < ShenandoahGC::_DEGENERATED_LIMIT, "sanity");
 77   _alloc_failure_degenerated++;
 78   _degen_points[point]++;
 79 }
 80 
 81 void ShenandoahCollectorPolicy::record_degenerated_upgrade_to_full() {
 82   ShenandoahHeap::heap()->record_upgrade_to_full();
 83   _alloc_failure_degenerated_upgrade_to_full++;
 84 }
 85 
 86 void ShenandoahCollectorPolicy::record_success_concurrent() {
 87   _success_concurrent_gcs++;
 88 }
 89 
 90 void ShenandoahCollectorPolicy::record_mixed_cycle() {
 91   _mixed_gcs++;
 92 }
 93 
 94 void ShenandoahCollectorPolicy::record_abbreviated_cycle() {
 95   _abbreviated_cycles++;
 96 }
 97 
 98 void ShenandoahCollectorPolicy::record_success_old() {
 99   _success_old_gcs++;
100 }
101 
102 void ShenandoahCollectorPolicy::record_interrupted_old() {
103   _interrupted_old_gcs++;
104 }
105 
106 void ShenandoahCollectorPolicy::record_success_degenerated() {
107   _success_degenerated_gcs++;
108 }
109 
110 void ShenandoahCollectorPolicy::record_success_full() {
111   _success_full_gcs++;
112 }
113 
114 size_t ShenandoahCollectorPolicy::cycle_counter() const {
115   return _cycle_counter;
116 }
117 
118 void ShenandoahCollectorPolicy::record_cycle_start() {
119   _cycle_counter++;
120 }
121 
122 void ShenandoahCollectorPolicy::record_shutdown() {
123   _in_shutdown.set();
124 }
125 
126 bool ShenandoahCollectorPolicy::is_at_shutdown() {
127   return _in_shutdown.is_set();
128 }
129 
130 void ShenandoahCollectorPolicy::print_gc_stats(outputStream* out) const {
131   out->print_cr("Under allocation pressure, concurrent cycles may cancel, and either continue cycle");
132   out->print_cr("under stop-the-world pause or result in stop-the-world Full GC. Increase heap size,");
133   out->print_cr("tune GC heuristics, set more aggressive pacing delay, or lower allocation rate");
134   out->print_cr("to avoid Degenerated and Full GC cycles. Abbreviated cycles are those which found");
135   out->print_cr("enough regions with no live objects to skip evacuation.");
136   out->cr();
137 
138   out->print_cr(SIZE_FORMAT_W(5) " Successful Concurrent GCs",         _success_concurrent_gcs);
139   out->print_cr("  " SIZE_FORMAT_W(5) " invoked explicitly",           _explicit_concurrent);
140   out->print_cr("  " SIZE_FORMAT_W(5) " invoked implicitly",           _implicit_concurrent);
141   out->cr();
142 
143   out->print_cr(SIZE_FORMAT_W(5) " Completed Old GCs",                 _success_old_gcs);
144   out->print_cr("  " SIZE_FORMAT_W(5) " mixed",                        _mixed_gcs);
145   out->print_cr("  " SIZE_FORMAT_W(5) " interruptions",                _interrupted_old_gcs);
146   out->cr();
147 
148   out->print_cr(SIZE_FORMAT_W(5) " Degenerated GCs",                   _success_degenerated_gcs);
149   out->print_cr("  " SIZE_FORMAT_W(5) " caused by allocation failure", _alloc_failure_degenerated);
150   for (int c = 0; c < ShenandoahGC::_DEGENERATED_LIMIT; c++) {
151     if (_degen_points[c] > 0) {
152       const char* desc = ShenandoahGC::degen_point_to_string((ShenandoahGC::ShenandoahDegenPoint)c);
153       out->print_cr("    " SIZE_FORMAT_W(5) " happened at %s",         _degen_points[c], desc);
154     }
155   }
156   out->print_cr("  " SIZE_FORMAT_W(5) " upgraded to Full GC",          _alloc_failure_degenerated_upgrade_to_full);
157   out->cr();
158 
159   out->print_cr(SIZE_FORMAT_W(5) " Abbreviated GCs",                   _abbreviated_cycles);
160   out->cr();
161 
162   out->print_cr(SIZE_FORMAT_W(5) " Full GCs",                          _success_full_gcs + _alloc_failure_degenerated_upgrade_to_full);
163   out->print_cr("  " SIZE_FORMAT_W(5) " invoked explicitly",           _explicit_full);
164   out->print_cr("  " SIZE_FORMAT_W(5) " invoked implicitly",           _implicit_full);
165   out->print_cr("  " SIZE_FORMAT_W(5) " caused by allocation failure", _alloc_failure_full);
166   out->print_cr("  " SIZE_FORMAT_W(5) " upgraded from Degenerated GC", _alloc_failure_degenerated_upgrade_to_full);
167 }
< prev index next >