< prev index next >

src/hotspot/share/gc/g1/g1Analytics.cpp

Print this page
rev 56992 : imported patch 8227739-merge-scan-rs-update-rs-cost
rev 56993 : [mq]: 8227739-sjohanss-review


  27 #include "gc/g1/g1Predictions.hpp"
  28 #include "runtime/globals.hpp"
  29 #include "runtime/os.hpp"
  30 #include "utilities/debug.hpp"
  31 #include "utilities/numberSeq.hpp"
  32 
  33 // Different defaults for different number of GC threads
  34 // They were chosen by running GCOld and SPECjbb on debris with different
  35 //   numbers of GC threads and choosing them based on the results
  36 
  37 // all the same
  38 static double rs_length_diff_defaults[] = {
  39   0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
  40 };
  41 
  42 static double cost_per_logged_card_ms_defaults[] = {
  43   0.01, 0.005, 0.005, 0.003, 0.003, 0.002, 0.002, 0.0015
  44 };
  45 
  46 // all the same
  47 static double young_cards_per_entry_ratio_defaults[] = {
  48   1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
  49 };
  50 
  51 static double young_only_cost_per_remset_card_ms_defaults[] = {
  52   0.015, 0.01, 0.01, 0.008, 0.008, 0.0055, 0.0055, 0.005
  53 };
  54 
  55 static double cost_per_byte_ms_defaults[] = {
  56   0.00006, 0.00003, 0.00003, 0.000015, 0.000015, 0.00001, 0.00001, 0.000009
  57 };
  58 
  59 // these should be pretty consistent
  60 static double constant_other_time_ms_defaults[] = {
  61   5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0
  62 };
  63 
  64 
  65 static double young_other_cost_per_region_ms_defaults[] = {
  66   0.3, 0.2, 0.2, 0.15, 0.15, 0.12, 0.12, 0.1
  67 };
  68 
  69 static double non_young_other_cost_per_region_ms_defaults[] = {
  70   1.0, 0.7, 0.7, 0.5, 0.5, 0.42, 0.42, 0.30
  71 };
  72 
  73 G1Analytics::G1Analytics(const G1Predictions* predictor) :
  74     _predictor(predictor),
  75     _recent_gc_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
  76     _concurrent_mark_remark_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
  77     _concurrent_mark_cleanup_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
  78     _alloc_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  79     _prev_collection_pause_end_ms(0.0),
  80     _rs_length_diff_seq(new TruncatedSeq(TruncatedSeqLength)),
  81     _concurrent_refine_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  82     _logged_cards_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  83     _cost_per_logged_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  84     _cost_scan_hcc_seq(new TruncatedSeq(TruncatedSeqLength)),
  85     _young_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
  86     _mixed_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
  87     _young_only_cost_per_remset_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  88     _mixed_cost_per_remset_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  89     _cost_per_byte_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  90     _constant_other_time_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  91     _young_other_cost_per_region_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  92     _non_young_other_cost_per_region_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  93     _pending_cards_seq(new TruncatedSeq(TruncatedSeqLength)),
  94     _rs_length_seq(new TruncatedSeq(TruncatedSeqLength)),
  95     _cost_per_byte_ms_during_cm_seq(new TruncatedSeq(TruncatedSeqLength)),
  96     _recent_prev_end_times_for_all_gcs_sec(new TruncatedSeq(NumPrevPausesForHeuristics)),
  97     _recent_avg_pause_time_ratio(0.0),
  98     _last_pause_time_ratio(0.0) {
  99 
 100   // Seed sequences with initial values.
 101   _recent_prev_end_times_for_all_gcs_sec->add(os::elapsedTime());
 102   _prev_collection_pause_end_ms = os::elapsedTime() * 1000.0;
 103 
 104   int index = MIN2(ParallelGCThreads - 1, 7u);
 105 
 106   _rs_length_diff_seq->add(rs_length_diff_defaults[index]);
 107   // Start with inverse of maximum STW cost.
 108   _concurrent_refine_rate_ms_seq->add(1/cost_per_logged_card_ms_defaults[0]);
 109   // Some applications have very low rates for logging cards.
 110   _logged_cards_rate_ms_seq->add(0.0);
 111   _cost_per_logged_card_ms_seq->add(cost_per_logged_card_ms_defaults[index]);
 112   _cost_scan_hcc_seq->add(0.0);
 113   _young_cards_per_entry_ratio_seq->add(young_cards_per_entry_ratio_defaults[index]);
 114   _young_only_cost_per_remset_card_ms_seq->add(young_only_cost_per_remset_card_ms_defaults[index]);
 115   _cost_per_byte_ms_seq->add(cost_per_byte_ms_defaults[index]);
 116   _constant_other_time_ms_seq->add(constant_other_time_ms_defaults[index]);
 117   _young_other_cost_per_region_ms_seq->add(young_other_cost_per_region_ms_defaults[index]);
 118   _non_young_other_cost_per_region_ms_seq->add(non_young_other_cost_per_region_ms_defaults[index]);
 119 
 120   // start conservatively (around 50ms is about right)
 121   _concurrent_mark_remark_times_ms->add(0.05);
 122   _concurrent_mark_cleanup_times_ms->add(0.20);
 123 }
 124 
 125 double G1Analytics::get_new_prediction(TruncatedSeq const* seq) const {
 126   return _predictor->get_new_prediction(seq);
 127 }
 128 
 129 size_t G1Analytics::get_new_size_prediction(TruncatedSeq const* seq) const {
 130   return (size_t)get_new_prediction(seq);
 131 }
 132 
 133 int G1Analytics::num_alloc_rate_ms() const {
 134   return _alloc_rate_ms_seq->num();
 135 }


 156     }
 157   }
 158 
 159   // Compute the ratio of just this last pause time to the entire time range stored
 160   // in the vectors. Comparing this pause to the entire range, rather than only the
 161   // most recent interval, has the effect of smoothing over a possible transient 'burst'
 162   // of more frequent pauses that don't really reflect a change in heap occupancy.
 163   // This reduces the likelihood of a needless heap expansion being triggered.
 164   _last_pause_time_ratio =
 165     (pause_time_ms * _recent_prev_end_times_for_all_gcs_sec->num()) / interval_ms;
 166 }
 167 
 168 void G1Analytics::report_concurrent_refine_rate_ms(double cards_per_ms) {
 169   _concurrent_refine_rate_ms_seq->add(cards_per_ms);
 170 }
 171 
 172 void G1Analytics::report_logged_cards_rate_ms(double cards_per_ms) {
 173   _logged_cards_rate_ms_seq->add(cards_per_ms);
 174 }
 175 
 176 void G1Analytics::report_cost_per_logged_card_ms(double cost_per_logged_card_ms) {
 177   _cost_per_logged_card_ms_seq->add(cost_per_logged_card_ms);
 178 }
 179 
 180 void G1Analytics::report_cost_scan_hcc(double cost_scan_hcc) {
 181   _cost_scan_hcc_seq->add(cost_scan_hcc);
 182 }
 183 
 184 void G1Analytics::report_cost_per_remset_card_ms(double cost_per_remset_card_ms, bool for_young_gc) {
 185   if (for_young_gc) {
 186     _young_only_cost_per_remset_card_ms_seq->add(cost_per_remset_card_ms);
 187   } else {
 188     _mixed_cost_per_remset_card_ms_seq->add(cost_per_remset_card_ms);
 189   }
 190 }
 191 
 192 void G1Analytics::report_cards_per_entry_ratio(double cards_per_entry_ratio, bool for_young_gc) {
 193   if (for_young_gc) {
 194     _young_cards_per_entry_ratio_seq->add(cards_per_entry_ratio);
 195   } else {
 196     _mixed_cards_per_entry_ratio_seq->add(cards_per_entry_ratio);
 197   }
 198 }
 199 
 200 void G1Analytics::report_rs_length_diff(double rs_length_diff) {
 201   _rs_length_diff_seq->add(rs_length_diff);
 202 }
 203 
 204 void G1Analytics::report_cost_per_byte_ms(double cost_per_byte_ms, bool mark_or_rebuild_in_progress) {
 205   if (mark_or_rebuild_in_progress) {
 206     _cost_per_byte_ms_during_cm_seq->add(cost_per_byte_ms);
 207   } else {
 208     _cost_per_byte_ms_seq->add(cost_per_byte_ms);
 209   }
 210 }
 211 
 212 void G1Analytics::report_young_other_cost_per_region_ms(double other_cost_per_region_ms) {
 213   _young_other_cost_per_region_ms_seq->add(other_cost_per_region_ms);
 214 }
 215 
 216 void G1Analytics::report_non_young_other_cost_per_region_ms(double other_cost_per_region_ms) {
 217   _non_young_other_cost_per_region_ms_seq->add(other_cost_per_region_ms);
 218 }
 219 
 220 void G1Analytics::report_constant_other_time_ms(double constant_other_time_ms) {
 221   _constant_other_time_ms_seq->add(constant_other_time_ms);
 222 }
 223 
 224 void G1Analytics::report_pending_cards(double pending_cards) {
 225   _pending_cards_seq->add(pending_cards);
 226 }
 227 
 228 void G1Analytics::report_rs_length(double rs_length) {
 229   _rs_length_seq->add(rs_length);
 230 }
 231 
 232 double G1Analytics::predict_alloc_rate_ms() const {
 233   return get_new_prediction(_alloc_rate_ms_seq);
 234 }
 235 
 236 double G1Analytics::predict_concurrent_refine_rate_ms() const {
 237   return get_new_prediction(_concurrent_refine_rate_ms_seq);
 238 }
 239 
 240 double G1Analytics::predict_logged_cards_rate_ms() const {
 241   return get_new_prediction(_logged_cards_rate_ms_seq);
 242 }
 243 
 244 double G1Analytics::predict_cost_per_logged_card_ms() const {
 245   return get_new_prediction(_cost_per_logged_card_ms_seq);
 246 }
 247 
 248 double G1Analytics::predict_scan_hcc_ms() const {
 249   return get_new_prediction(_cost_scan_hcc_seq);
 250 }
 251 
 252 double G1Analytics::predict_rs_update_time_ms(size_t pending_cards) const {
 253   return pending_cards * predict_cost_per_logged_card_ms() + predict_scan_hcc_ms();
 254 }
 255 
 256 double G1Analytics::predict_young_cards_per_entry_ratio() const {
 257   return get_new_prediction(_young_cards_per_entry_ratio_seq);
 258 }
 259 
 260 double G1Analytics::predict_mixed_cards_per_entry_ratio() const {
 261   if (_mixed_cards_per_entry_ratio_seq->num() < 2) {
 262     return predict_young_cards_per_entry_ratio();
 263   } else {
 264     return get_new_prediction(_mixed_cards_per_entry_ratio_seq);
 265   }
 266 }
 267 
 268 size_t G1Analytics::predict_card_num(size_t rs_length, bool for_young_gc) const {
 269   if (for_young_gc) {
 270     return (size_t) (rs_length * predict_young_cards_per_entry_ratio());
 271   } else {
 272     return (size_t) (rs_length * predict_mixed_cards_per_entry_ratio());
 273   }
 274 }
 275 
 276 double G1Analytics::predict_rs_scan_time_ms(size_t card_num, bool for_young_gc) const {
 277   if (for_young_gc) {
 278     return card_num * get_new_prediction(_young_only_cost_per_remset_card_ms_seq);
 279   } else {
 280     return predict_mixed_rs_scan_time_ms(card_num);
 281   }
 282 }
 283 
 284 double G1Analytics::predict_mixed_rs_scan_time_ms(size_t card_num) const {
 285   if (_mixed_cost_per_remset_card_ms_seq->num() < 3) {
 286     return card_num * get_new_prediction(_young_only_cost_per_remset_card_ms_seq);
 287   } else {
 288     return card_num * get_new_prediction(_mixed_cost_per_remset_card_ms_seq);
 289   }
 290 }
 291 
 292 double G1Analytics::predict_object_copy_time_ms_during_cm(size_t bytes_to_copy) const {
 293   if (_cost_per_byte_ms_during_cm_seq->num() < 3) {
 294     return (1.1 * bytes_to_copy) * get_new_prediction(_cost_per_byte_ms_seq);
 295   } else {
 296     return bytes_to_copy * get_new_prediction(_cost_per_byte_ms_during_cm_seq);
 297   }
 298 }
 299 
 300 double G1Analytics::predict_object_copy_time_ms(size_t bytes_to_copy, bool during_concurrent_mark) const {
 301   if (during_concurrent_mark) {
 302     return predict_object_copy_time_ms_during_cm(bytes_to_copy);
 303   } else {
 304     return bytes_to_copy * get_new_prediction(_cost_per_byte_ms_seq);
 305   }
 306 }
 307 
 308 double G1Analytics::predict_cost_per_byte_ms() const {
 309   return get_new_prediction(_cost_per_byte_ms_seq);
 310 }
 311 
 312 double G1Analytics::predict_constant_other_time_ms() const {
 313   return get_new_prediction(_constant_other_time_ms_seq);
 314 }
 315 
 316 double G1Analytics::predict_young_other_time_ms(size_t young_num) const {
 317   return young_num * get_new_prediction(_young_other_cost_per_region_ms_seq);
 318 }
 319 
 320 double G1Analytics::predict_non_young_other_time_ms(size_t non_young_num) const {
 321   return non_young_num * get_new_prediction(_non_young_other_cost_per_region_ms_seq);
 322 }
 323 
 324 double G1Analytics::predict_remark_time_ms() const {
 325   return get_new_prediction(_concurrent_mark_remark_times_ms);
 326 }
 327 
 328 double G1Analytics::predict_cleanup_time_ms() const {
 329   return get_new_prediction(_concurrent_mark_cleanup_times_ms);




  27 #include "gc/g1/g1Predictions.hpp"
  28 #include "runtime/globals.hpp"
  29 #include "runtime/os.hpp"
  30 #include "utilities/debug.hpp"
  31 #include "utilities/numberSeq.hpp"
  32 
  33 // Different defaults for different number of GC threads
  34 // They were chosen by running GCOld and SPECjbb on debris with different
  35 //   numbers of GC threads and choosing them based on the results
  36 
  37 // all the same
  38 static double rs_length_diff_defaults[] = {
  39   0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
  40 };
  41 
  42 static double cost_per_logged_card_ms_defaults[] = {
  43   0.01, 0.005, 0.005, 0.003, 0.003, 0.002, 0.002, 0.0015
  44 };
  45 
  46 // all the same
  47 static double young_card_merge_to_scan_ratio_defaults[] = {
  48   1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
  49 };
  50 
  51 static double young_only_cost_per_card_scan_ms_defaults[] = {
  52   0.015, 0.01, 0.01, 0.008, 0.008, 0.0055, 0.0055, 0.005
  53 };
  54 
  55 static double cost_per_byte_ms_defaults[] = {
  56   0.00006, 0.00003, 0.00003, 0.000015, 0.000015, 0.00001, 0.00001, 0.000009
  57 };
  58 
  59 // these should be pretty consistent
  60 static double constant_other_time_ms_defaults[] = {
  61   5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0
  62 };
  63 

  64 static double young_other_cost_per_region_ms_defaults[] = {
  65   0.3, 0.2, 0.2, 0.15, 0.15, 0.12, 0.12, 0.1
  66 };
  67 
  68 static double non_young_other_cost_per_region_ms_defaults[] = {
  69   1.0, 0.7, 0.7, 0.5, 0.5, 0.42, 0.42, 0.30
  70 };
  71 
  72 G1Analytics::G1Analytics(const G1Predictions* predictor) :
  73     _predictor(predictor),
  74     _recent_gc_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
  75     _concurrent_mark_remark_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
  76     _concurrent_mark_cleanup_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
  77     _alloc_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  78     _prev_collection_pause_end_ms(0.0),
  79     _rs_length_diff_seq(new TruncatedSeq(TruncatedSeqLength)),
  80     _concurrent_refine_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  81     _logged_cards_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  82     _young_card_merge_to_scan_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
  83     _mixed_card_merge_to_scan_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
  84     _young_cost_per_card_scan_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  85     _mixed_cost_per_card_scan_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  86     _young_cost_per_card_merge_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  87     _mixed_cost_per_card_merge_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  88     _copy_cost_per_byte_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  89     _constant_other_time_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  90     _young_other_cost_per_region_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  91     _non_young_other_cost_per_region_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
  92     _pending_cards_seq(new TruncatedSeq(TruncatedSeqLength)),
  93     _rs_length_seq(new TruncatedSeq(TruncatedSeqLength)),
  94     _cost_per_byte_ms_during_cm_seq(new TruncatedSeq(TruncatedSeqLength)),
  95     _recent_prev_end_times_for_all_gcs_sec(new TruncatedSeq(NumPrevPausesForHeuristics)),
  96     _recent_avg_pause_time_ratio(0.0),
  97     _last_pause_time_ratio(0.0) {
  98 
  99   // Seed sequences with initial values.
 100   _recent_prev_end_times_for_all_gcs_sec->add(os::elapsedTime());
 101   _prev_collection_pause_end_ms = os::elapsedTime() * 1000.0;
 102 
 103   int index = MIN2(ParallelGCThreads - 1, 7u);
 104 
 105   _rs_length_diff_seq->add(rs_length_diff_defaults[index]);
 106   // Start with inverse of maximum STW cost.
 107   _concurrent_refine_rate_ms_seq->add(1/cost_per_logged_card_ms_defaults[0]);
 108   // Some applications have very low rates for logging cards.
 109   _logged_cards_rate_ms_seq->add(0.0);
 110   _young_card_merge_to_scan_ratio_seq->add(young_card_merge_to_scan_ratio_defaults[index]);
 111   _young_cost_per_card_scan_ms_seq->add(young_only_cost_per_card_scan_ms_defaults[index]);
 112 
 113   _copy_cost_per_byte_ms_seq->add(cost_per_byte_ms_defaults[index]);

 114   _constant_other_time_ms_seq->add(constant_other_time_ms_defaults[index]);
 115   _young_other_cost_per_region_ms_seq->add(young_other_cost_per_region_ms_defaults[index]);
 116   _non_young_other_cost_per_region_ms_seq->add(non_young_other_cost_per_region_ms_defaults[index]);
 117 
 118   // start conservatively (around 50ms is about right)
 119   _concurrent_mark_remark_times_ms->add(0.05);
 120   _concurrent_mark_cleanup_times_ms->add(0.20);
 121 }
 122 
 123 double G1Analytics::get_new_prediction(TruncatedSeq const* seq) const {
 124   return _predictor->get_new_prediction(seq);
 125 }
 126 
 127 size_t G1Analytics::get_new_size_prediction(TruncatedSeq const* seq) const {
 128   return (size_t)get_new_prediction(seq);
 129 }
 130 
 131 int G1Analytics::num_alloc_rate_ms() const {
 132   return _alloc_rate_ms_seq->num();
 133 }


 154     }
 155   }
 156 
 157   // Compute the ratio of just this last pause time to the entire time range stored
 158   // in the vectors. Comparing this pause to the entire range, rather than only the
 159   // most recent interval, has the effect of smoothing over a possible transient 'burst'
 160   // of more frequent pauses that don't really reflect a change in heap occupancy.
 161   // This reduces the likelihood of a needless heap expansion being triggered.
 162   _last_pause_time_ratio =
 163     (pause_time_ms * _recent_prev_end_times_for_all_gcs_sec->num()) / interval_ms;
 164 }
 165 
 166 void G1Analytics::report_concurrent_refine_rate_ms(double cards_per_ms) {
 167   _concurrent_refine_rate_ms_seq->add(cards_per_ms);
 168 }
 169 
 170 void G1Analytics::report_logged_cards_rate_ms(double cards_per_ms) {
 171   _logged_cards_rate_ms_seq->add(cards_per_ms);
 172 }
 173 
 174 void G1Analytics::report_cost_per_card_scan_ms(double cost_per_card_ms, bool for_young_gc) {
 175   if (for_young_gc) {
 176     _young_cost_per_card_scan_ms_seq->add(cost_per_card_ms);
 177   } else {
 178     _mixed_cost_per_card_scan_ms_seq->add(cost_per_card_ms);
 179   }
 180 }
 181 
 182 void G1Analytics::report_cost_per_card_merge_ms(double cost_per_card_ms, bool for_young_gc) {
 183   if (for_young_gc) {
 184     _young_cost_per_card_merge_ms_seq->add(cost_per_card_ms);
 185   } else {
 186     _mixed_cost_per_card_merge_ms_seq->add(cost_per_card_ms);
 187   }
 188 }
 189 
 190 void G1Analytics::report_card_merge_to_scan_ratio(double merge_to_scan_ratio, bool for_young_gc) {
 191   if (for_young_gc) {
 192     _young_card_merge_to_scan_ratio_seq->add(merge_to_scan_ratio);
 193   } else {
 194     _mixed_card_merge_to_scan_ratio_seq->add(merge_to_scan_ratio);
 195   }
 196 }
 197 
 198 void G1Analytics::report_rs_length_diff(double rs_length_diff) {
 199   _rs_length_diff_seq->add(rs_length_diff);
 200 }
 201 
 202 void G1Analytics::report_cost_per_byte_ms(double cost_per_byte_ms, bool mark_or_rebuild_in_progress) {
 203   if (mark_or_rebuild_in_progress) {
 204     _cost_per_byte_ms_during_cm_seq->add(cost_per_byte_ms);
 205   } else {
 206     _copy_cost_per_byte_ms_seq->add(cost_per_byte_ms);
 207   }
 208 }
 209 
 210 void G1Analytics::report_young_other_cost_per_region_ms(double other_cost_per_region_ms) {
 211   _young_other_cost_per_region_ms_seq->add(other_cost_per_region_ms);
 212 }
 213 
 214 void G1Analytics::report_non_young_other_cost_per_region_ms(double other_cost_per_region_ms) {
 215   _non_young_other_cost_per_region_ms_seq->add(other_cost_per_region_ms);
 216 }
 217 
 218 void G1Analytics::report_constant_other_time_ms(double constant_other_time_ms) {
 219   _constant_other_time_ms_seq->add(constant_other_time_ms);
 220 }
 221 
 222 void G1Analytics::report_pending_cards(double pending_cards) {
 223   _pending_cards_seq->add(pending_cards);
 224 }
 225 
 226 void G1Analytics::report_rs_length(double rs_length) {
 227   _rs_length_seq->add(rs_length);
 228 }
 229 
 230 double G1Analytics::predict_alloc_rate_ms() const {
 231   return get_new_prediction(_alloc_rate_ms_seq);
 232 }
 233 
 234 double G1Analytics::predict_concurrent_refine_rate_ms() const {
 235   return get_new_prediction(_concurrent_refine_rate_ms_seq);
 236 }
 237 
 238 double G1Analytics::predict_logged_cards_rate_ms() const {
 239   return get_new_prediction(_logged_cards_rate_ms_seq);
 240 }
 241 
 242 double G1Analytics::predict_young_card_merge_to_scan_ratio() const {
 243   return get_new_prediction(_young_card_merge_to_scan_ratio_seq);








 244 }
 245 
 246 size_t G1Analytics::predict_scan_card_num(size_t rs_length, bool for_young_gc) const {
 247   if (for_young_gc || !enough_samples_available(_mixed_card_merge_to_scan_ratio_seq)) {
 248     return (size_t) (rs_length * predict_young_card_merge_to_scan_ratio());












 249   } else {
 250     return (size_t) (rs_length * get_new_prediction(_mixed_card_merge_to_scan_ratio_seq));
 251   }
 252 }
 253 
 254 double G1Analytics::predict_card_merge_time_ms(size_t card_num, bool for_young_gc) const {
 255   if (for_young_gc || !enough_samples_available(_mixed_cost_per_card_merge_ms_seq->num())) {
 256     return card_num * get_new_prediction(_young_cost_per_card_merge_ms_seq);
 257   } else {
 258     return card_num * get_new_prediction(_mixed_cost_per_card_merge_ms_seq);
 259   }
 260 }
 261 
 262 double G1Analytics::predict_card_scan_time_ms(size_t card_num, bool for_young_gc) const {
 263   if (for_young_gc || !enough_samples_available(_mixed_cost_per_card_scan_ms_seq->num())) {
 264     return card_num * get_new_prediction(_young_cost_per_card_scan_ms_seq);
 265   } else {
 266     return card_num * get_new_prediction(_mixed_cost_per_card_scan_ms_seq);
 267   }
 268 }
 269 
 270 double G1Analytics::predict_object_copy_time_ms_during_cm(size_t bytes_to_copy) const {
 271   if (!enough_samples_available(_cost_per_byte_ms_during_cm_seq)) {
 272     return (1.1 * bytes_to_copy) * get_new_prediction(_copy_cost_per_byte_ms_seq);
 273   } else {
 274     return bytes_to_copy * get_new_prediction(_cost_per_byte_ms_during_cm_seq);
 275   }
 276 }
 277 
 278 double G1Analytics::predict_object_copy_time_ms(size_t bytes_to_copy, bool during_concurrent_mark) const {
 279   if (during_concurrent_mark) {
 280     return predict_object_copy_time_ms_during_cm(bytes_to_copy);
 281   } else {
 282     return bytes_to_copy * get_new_prediction(_copy_cost_per_byte_ms_seq);
 283   }




 284 }
 285 
 286 double G1Analytics::predict_constant_other_time_ms() const {
 287   return get_new_prediction(_constant_other_time_ms_seq);
 288 }
 289 
 290 double G1Analytics::predict_young_other_time_ms(size_t young_num) const {
 291   return young_num * get_new_prediction(_young_other_cost_per_region_ms_seq);
 292 }
 293 
 294 double G1Analytics::predict_non_young_other_time_ms(size_t non_young_num) const {
 295   return non_young_num * get_new_prediction(_non_young_other_cost_per_region_ms_seq);
 296 }
 297 
 298 double G1Analytics::predict_remark_time_ms() const {
 299   return get_new_prediction(_concurrent_mark_remark_times_ms);
 300 }
 301 
 302 double G1Analytics::predict_cleanup_time_ms() const {
 303   return get_new_prediction(_concurrent_mark_cleanup_times_ms);


< prev index next >