< prev index next >

src/share/vm/gc/g1/g1IHOPControl.cpp

Print this page




   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 #include "precompiled.hpp"
  26 #include "gc/g1/g1CollectedHeap.inline.hpp"
  27 #include "gc/g1/g1ErgoVerbose.hpp"
  28 #include "gc/g1/g1IHOPControl.hpp"
  29 #include "gc/g1/g1Predictions.hpp"
  30 #include "gc/shared/gcTrace.hpp"

  31 
  32 G1IHOPControl::G1IHOPControl(double initial_ihop_percent, size_t target_occupancy) :
  33   _initial_ihop_percent(initial_ihop_percent),
  34   _target_occupancy(target_occupancy),
  35   _last_allocated_bytes(0),
  36   _last_allocation_time_s(0.0)
  37 {
  38   assert(_initial_ihop_percent >= 0.0 && _initial_ihop_percent <= 100.0, "Initial IHOP value must be between 0 and 100 but is %.3f", initial_ihop_percent);
  39 }
  40 
  41 void G1IHOPControl::update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size) {
  42   assert(allocation_time_s >= 0.0, "Allocation time must be positive but is %.3f", allocation_time_s);
  43 
  44   _last_allocation_time_s = allocation_time_s;
  45   _last_allocated_bytes = allocated_bytes;
  46 }
  47 
  48 void G1IHOPControl::print() {
  49   size_t cur_conc_mark_start_threshold = get_conc_mark_start_threshold();
  50   ergo_verbose6(ErgoIHOP,
  51                 "basic information",
  52                 ergo_format_reason("value update")
  53                 ergo_format_byte_perc("threshold")
  54                 ergo_format_byte("target occupancy")
  55                 ergo_format_byte("current occupancy")
  56                 ergo_format_double("recent old gen allocation rate")
  57                 ergo_format_double("recent marking phase length"),
  58                 cur_conc_mark_start_threshold,
  59                 cur_conc_mark_start_threshold * 100.0 / _target_occupancy,
  60                 _target_occupancy,
  61                 G1CollectedHeap::heap()->used(),
  62                 _last_allocation_time_s > 0.0 ? _last_allocated_bytes / _last_allocation_time_s : 0.0,
  63                 last_marking_length_s());
  64 }
  65 
  66 void G1IHOPControl::send_trace_event(G1NewTracer* tracer) {
  67   tracer->report_basic_ihop_statistics(get_conc_mark_start_threshold(),
  68                                        _target_occupancy,
  69                                        G1CollectedHeap::heap()->used(),
  70                                        _last_allocated_bytes,
  71                                        _last_allocation_time_s,
  72                                        last_marking_length_s());
  73 }
  74 
  75 G1StaticIHOPControl::G1StaticIHOPControl(double ihop_percent, size_t target_occupancy) :
  76   G1IHOPControl(ihop_percent, target_occupancy),
  77   _last_marking_length_s(0.0) {


 175   }
 176 }
 177 
 178 void G1AdaptiveIHOPControl::update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size) {
 179   G1IHOPControl::update_allocation_info(allocation_time_s, allocated_bytes, additional_buffer_size);
 180 
 181   double allocation_rate = (double) allocated_bytes / allocation_time_s;
 182   _allocation_rate_s.add(allocation_rate);
 183 
 184   _last_unrestrained_young_size = additional_buffer_size;
 185 }
 186 
 187 void G1AdaptiveIHOPControl::update_marking_length(double marking_length_s) {
 188    assert(marking_length_s >= 0.0, "Marking length must be larger than zero but is %.3f", marking_length_s);
 189   _marking_times_s.add(marking_length_s);
 190 }
 191 
 192 void G1AdaptiveIHOPControl::print() {
 193   G1IHOPControl::print();
 194   size_t actual_target = actual_target_threshold();
 195   ergo_verbose6(ErgoIHOP,
 196                 "adaptive IHOP information",
 197                 ergo_format_reason("value update")
 198                 ergo_format_byte_perc("threshold")
 199                 ergo_format_byte("internal target occupancy")
 200                 ergo_format_double("predicted old gen allocation rate")
 201                 ergo_format_double("predicted marking phase length")
 202                 ergo_format_str("prediction active"),
 203                 get_conc_mark_start_threshold(),
 204                 percent_of(get_conc_mark_start_threshold(), actual_target),
 205                 actual_target,
 206                 _predictor->get_new_prediction(&_allocation_rate_s),
 207                 _predictor->get_new_prediction(&_marking_times_s),
 208                 have_enough_data_for_prediction() ? "true" : "false"
 209                 );
 210 }
 211 
 212 void G1AdaptiveIHOPControl::send_trace_event(G1NewTracer* tracer) {
 213   G1IHOPControl::send_trace_event(tracer);
 214   tracer->report_adaptive_ihop_statistics(get_conc_mark_start_threshold(),
 215                                           actual_target_threshold(),
 216                                           G1CollectedHeap::heap()->used(),
 217                                           _last_unrestrained_young_size,
 218                                           _predictor->get_new_prediction(&_allocation_rate_s),
 219                                           _predictor->get_new_prediction(&_marking_times_s),
 220                                           have_enough_data_for_prediction());
 221 }
 222 
 223 #ifndef PRODUCT
 224 void G1AdaptiveIHOPControl::test() {
 225   size_t const initial_threshold = 45;
 226   size_t const young_size = 10;
 227   size_t const target_size = 100;
 228 
 229   // The final IHOP value is always




   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 #include "precompiled.hpp"
  26 #include "gc/g1/g1CollectedHeap.inline.hpp"

  27 #include "gc/g1/g1IHOPControl.hpp"
  28 #include "gc/g1/g1Predictions.hpp"
  29 #include "gc/shared/gcTrace.hpp"
  30 #include "logging/log.hpp"
  31 
  32 G1IHOPControl::G1IHOPControl(double initial_ihop_percent, size_t target_occupancy) :
  33   _initial_ihop_percent(initial_ihop_percent),
  34   _target_occupancy(target_occupancy),
  35   _last_allocated_bytes(0),
  36   _last_allocation_time_s(0.0)
  37 {
  38   assert(_initial_ihop_percent >= 0.0 && _initial_ihop_percent <= 100.0, "Initial IHOP value must be between 0 and 100 but is %.3f", initial_ihop_percent);
  39 }
  40 
  41 void G1IHOPControl::update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size) {
  42   assert(allocation_time_s >= 0.0, "Allocation time must be positive but is %.3f", allocation_time_s);
  43 
  44   _last_allocation_time_s = allocation_time_s;
  45   _last_allocated_bytes = allocated_bytes;
  46 }
  47 
  48 void G1IHOPControl::print() {
  49   size_t cur_conc_mark_start_threshold = get_conc_mark_start_threshold();
  50   log_debug(gc, ihop)("Basic information (value update), threshold: " SIZE_FORMAT "B (%1.2f), target occupancy: " SIZE_FORMAT "B, current occupancy: " SIZE_FORMAT "B,"
  51                       " recent old gen allocation rate: %1.2f, recent marking phase length: %1.2f",






  52                       cur_conc_mark_start_threshold,
  53                       cur_conc_mark_start_threshold * 100.0 / _target_occupancy,
  54                       _target_occupancy,
  55                       G1CollectedHeap::heap()->used(),
  56                       _last_allocation_time_s > 0.0 ? _last_allocated_bytes / _last_allocation_time_s : 0.0,
  57                       last_marking_length_s());
  58 }
  59 
  60 void G1IHOPControl::send_trace_event(G1NewTracer* tracer) {
  61   tracer->report_basic_ihop_statistics(get_conc_mark_start_threshold(),
  62                                        _target_occupancy,
  63                                        G1CollectedHeap::heap()->used(),
  64                                        _last_allocated_bytes,
  65                                        _last_allocation_time_s,
  66                                        last_marking_length_s());
  67 }
  68 
  69 G1StaticIHOPControl::G1StaticIHOPControl(double ihop_percent, size_t target_occupancy) :
  70   G1IHOPControl(ihop_percent, target_occupancy),
  71   _last_marking_length_s(0.0) {


 169   }
 170 }
 171 
 172 void G1AdaptiveIHOPControl::update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size) {
 173   G1IHOPControl::update_allocation_info(allocation_time_s, allocated_bytes, additional_buffer_size);
 174 
 175   double allocation_rate = (double) allocated_bytes / allocation_time_s;
 176   _allocation_rate_s.add(allocation_rate);
 177 
 178   _last_unrestrained_young_size = additional_buffer_size;
 179 }
 180 
 181 void G1AdaptiveIHOPControl::update_marking_length(double marking_length_s) {
 182    assert(marking_length_s >= 0.0, "Marking length must be larger than zero but is %.3f", marking_length_s);
 183   _marking_times_s.add(marking_length_s);
 184 }
 185 
 186 void G1AdaptiveIHOPControl::print() {
 187   G1IHOPControl::print();
 188   size_t actual_target = actual_target_threshold();
 189   log_debug(gc, ihop)("Adaptive IHOP information (value update), threshold: " SIZE_FORMAT "B (%1.2f), internal target occupancy: " SIZE_FORMAT "B,"
 190                       " predicted old gen allocation rate: %1.2f, predicted marking phase length: %1.2f, prediction active: %s",






 191                       get_conc_mark_start_threshold(),
 192                       percent_of(get_conc_mark_start_threshold(), actual_target),
 193                       actual_target,
 194                       _predictor->get_new_prediction(&_allocation_rate_s),
 195                       _predictor->get_new_prediction(&_marking_times_s),
 196                       have_enough_data_for_prediction() ? "true" : "false");

 197 }
 198 
 199 void G1AdaptiveIHOPControl::send_trace_event(G1NewTracer* tracer) {
 200   G1IHOPControl::send_trace_event(tracer);
 201   tracer->report_adaptive_ihop_statistics(get_conc_mark_start_threshold(),
 202                                           actual_target_threshold(),
 203                                           G1CollectedHeap::heap()->used(),
 204                                           _last_unrestrained_young_size,
 205                                           _predictor->get_new_prediction(&_allocation_rate_s),
 206                                           _predictor->get_new_prediction(&_marking_times_s),
 207                                           have_enough_data_for_prediction());
 208 }
 209 
 210 #ifndef PRODUCT
 211 void G1AdaptiveIHOPControl::test() {
 212   size_t const initial_threshold = 45;
 213   size_t const young_size = 10;
 214   size_t const target_size = 100;
 215 
 216   // The final IHOP value is always


< prev index next >