1 /* |
1 /* |
2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
164 |
164 |
165 void G1Analytics::report_cost_scan_hcc(double cost_scan_hcc) { |
165 void G1Analytics::report_cost_scan_hcc(double cost_scan_hcc) { |
166 _cost_scan_hcc_seq->add(cost_scan_hcc); |
166 _cost_scan_hcc_seq->add(cost_scan_hcc); |
167 } |
167 } |
168 |
168 |
169 void G1Analytics::report_cost_per_entry_ms(double cost_per_entry_ms, bool last_gc_was_young) { |
169 void G1Analytics::report_cost_per_entry_ms(double cost_per_entry_ms, bool for_young_gc) { |
170 if (last_gc_was_young) { |
170 if (for_young_gc) { |
171 _cost_per_entry_ms_seq->add(cost_per_entry_ms); |
171 _cost_per_entry_ms_seq->add(cost_per_entry_ms); |
172 } else { |
172 } else { |
173 _mixed_cost_per_entry_ms_seq->add(cost_per_entry_ms); |
173 _mixed_cost_per_entry_ms_seq->add(cost_per_entry_ms); |
174 } |
174 } |
175 } |
175 } |
176 |
176 |
177 void G1Analytics::report_cards_per_entry_ratio(double cards_per_entry_ratio, bool last_gc_was_young) { |
177 void G1Analytics::report_cards_per_entry_ratio(double cards_per_entry_ratio, bool for_young_gc) { |
178 if (last_gc_was_young) { |
178 if (for_young_gc) { |
179 _young_cards_per_entry_ratio_seq->add(cards_per_entry_ratio); |
179 _young_cards_per_entry_ratio_seq->add(cards_per_entry_ratio); |
180 } else { |
180 } else { |
181 _mixed_cards_per_entry_ratio_seq->add(cards_per_entry_ratio); |
181 _mixed_cards_per_entry_ratio_seq->add(cards_per_entry_ratio); |
182 } |
182 } |
183 } |
183 } |
184 |
184 |
185 void G1Analytics::report_rs_length_diff(double rs_length_diff) { |
185 void G1Analytics::report_rs_length_diff(double rs_length_diff) { |
186 _rs_length_diff_seq->add(rs_length_diff); |
186 _rs_length_diff_seq->add(rs_length_diff); |
187 } |
187 } |
188 |
188 |
189 void G1Analytics::report_cost_per_byte_ms(double cost_per_byte_ms, bool in_marking_window) { |
189 void G1Analytics::report_cost_per_byte_ms(double cost_per_byte_ms, bool mark_or_rebuild_in_progress) { |
190 if (in_marking_window) { |
190 if (mark_or_rebuild_in_progress) { |
191 _cost_per_byte_ms_during_cm_seq->add(cost_per_byte_ms); |
191 _cost_per_byte_ms_during_cm_seq->add(cost_per_byte_ms); |
192 } else { |
192 } else { |
193 _cost_per_byte_ms_seq->add(cost_per_byte_ms); |
193 _cost_per_byte_ms_seq->add(cost_per_byte_ms); |
194 } |
194 } |
195 } |
195 } |
244 } else { |
244 } else { |
245 return get_new_prediction(_mixed_cards_per_entry_ratio_seq); |
245 return get_new_prediction(_mixed_cards_per_entry_ratio_seq); |
246 } |
246 } |
247 } |
247 } |
248 |
248 |
249 size_t G1Analytics::predict_card_num(size_t rs_length, bool gcs_are_young) const { |
249 size_t G1Analytics::predict_card_num(size_t rs_length, bool for_young_gc) const { |
250 if (gcs_are_young) { |
250 if (for_young_gc) { |
251 return (size_t) (rs_length * predict_young_cards_per_entry_ratio()); |
251 return (size_t) (rs_length * predict_young_cards_per_entry_ratio()); |
252 } else { |
252 } else { |
253 return (size_t) (rs_length * predict_mixed_cards_per_entry_ratio()); |
253 return (size_t) (rs_length * predict_mixed_cards_per_entry_ratio()); |
254 } |
254 } |
255 } |
255 } |
256 |
256 |
257 double G1Analytics::predict_rs_scan_time_ms(size_t card_num, bool gcs_are_young) const { |
257 double G1Analytics::predict_rs_scan_time_ms(size_t card_num, bool for_young_gc) const { |
258 if (gcs_are_young) { |
258 if (for_young_gc) { |
259 return card_num * get_new_prediction(_cost_per_entry_ms_seq); |
259 return card_num * get_new_prediction(_cost_per_entry_ms_seq); |
260 } else { |
260 } else { |
261 return predict_mixed_rs_scan_time_ms(card_num); |
261 return predict_mixed_rs_scan_time_ms(card_num); |
262 } |
262 } |
263 } |
263 } |