1 /* |
1 /* |
2 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2016, 2019, 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. |
37 // all the same |
37 // all the same |
38 static double rs_length_diff_defaults[] = { |
38 static double rs_length_diff_defaults[] = { |
39 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 |
39 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 |
40 }; |
40 }; |
41 |
41 |
42 static double cost_per_log_buffer_entry_ms_defaults[] = { |
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 |
43 0.01, 0.005, 0.005, 0.003, 0.003, 0.002, 0.002, 0.0015 |
44 }; |
44 }; |
45 |
45 |
46 // all the same |
46 // all the same |
47 static double young_cards_per_entry_ratio_defaults[] = { |
47 static double young_cards_per_entry_ratio_defaults[] = { |
76 _concurrent_mark_remark_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), |
76 _concurrent_mark_remark_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), |
77 _concurrent_mark_cleanup_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), |
77 _concurrent_mark_cleanup_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), |
78 _alloc_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)), |
78 _alloc_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)), |
79 _prev_collection_pause_end_ms(0.0), |
79 _prev_collection_pause_end_ms(0.0), |
80 _rs_length_diff_seq(new TruncatedSeq(TruncatedSeqLength)), |
80 _rs_length_diff_seq(new TruncatedSeq(TruncatedSeqLength)), |
81 _cost_per_log_buffer_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)), |
81 _cost_per_logged_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)), |
82 _cost_scan_hcc_seq(new TruncatedSeq(TruncatedSeqLength)), |
82 _cost_scan_hcc_seq(new TruncatedSeq(TruncatedSeqLength)), |
83 _young_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)), |
83 _young_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)), |
84 _mixed_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)), |
84 _mixed_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)), |
85 _young_only_cost_per_remset_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)), |
85 _young_only_cost_per_remset_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)), |
86 _mixed_cost_per_remset_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)), |
86 _mixed_cost_per_remset_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)), |
100 _prev_collection_pause_end_ms = os::elapsedTime() * 1000.0; |
100 _prev_collection_pause_end_ms = os::elapsedTime() * 1000.0; |
101 |
101 |
102 int index = MIN2(ParallelGCThreads - 1, 7u); |
102 int index = MIN2(ParallelGCThreads - 1, 7u); |
103 |
103 |
104 _rs_length_diff_seq->add(rs_length_diff_defaults[index]); |
104 _rs_length_diff_seq->add(rs_length_diff_defaults[index]); |
105 _cost_per_log_buffer_entry_ms_seq->add(cost_per_log_buffer_entry_ms_defaults[index]); |
105 _cost_per_logged_card_ms_seq->add(cost_per_logged_card_ms_defaults[index]); |
106 _cost_scan_hcc_seq->add(0.0); |
106 _cost_scan_hcc_seq->add(0.0); |
107 _young_cards_per_entry_ratio_seq->add(young_cards_per_entry_ratio_defaults[index]); |
107 _young_cards_per_entry_ratio_seq->add(young_cards_per_entry_ratio_defaults[index]); |
108 _young_only_cost_per_remset_card_ms_seq->add(young_only_cost_per_remset_card_ms_defaults[index]); |
108 _young_only_cost_per_remset_card_ms_seq->add(young_only_cost_per_remset_card_ms_defaults[index]); |
109 _cost_per_byte_ms_seq->add(cost_per_byte_ms_defaults[index]); |
109 _cost_per_byte_ms_seq->add(cost_per_byte_ms_defaults[index]); |
110 _constant_other_time_ms_seq->add(constant_other_time_ms_defaults[index]); |
110 _constant_other_time_ms_seq->add(constant_other_time_ms_defaults[index]); |
157 // This reduces the likelihood of a needless heap expansion being triggered. |
157 // This reduces the likelihood of a needless heap expansion being triggered. |
158 _last_pause_time_ratio = |
158 _last_pause_time_ratio = |
159 (pause_time_ms * _recent_prev_end_times_for_all_gcs_sec->num()) / interval_ms; |
159 (pause_time_ms * _recent_prev_end_times_for_all_gcs_sec->num()) / interval_ms; |
160 } |
160 } |
161 |
161 |
162 void G1Analytics::report_cost_per_log_buffer_entry_ms(double cost_per_log_buffer_entry_ms) { |
162 void G1Analytics::report_cost_per_logged_card_ms(double cost_per_logged_card_ms) { |
163 _cost_per_log_buffer_entry_ms_seq->add(cost_per_log_buffer_entry_ms); |
163 _cost_per_logged_card_ms_seq->add(cost_per_logged_card_ms); |
164 } |
164 } |
165 |
165 |
166 void G1Analytics::report_cost_scan_hcc(double cost_scan_hcc) { |
166 void G1Analytics::report_cost_scan_hcc(double cost_scan_hcc) { |
167 _cost_scan_hcc_seq->add(cost_scan_hcc); |
167 _cost_scan_hcc_seq->add(cost_scan_hcc); |
168 } |
168 } |
221 |
221 |
222 double G1Analytics::predict_alloc_rate_ms() const { |
222 double G1Analytics::predict_alloc_rate_ms() const { |
223 return get_new_prediction(_alloc_rate_ms_seq); |
223 return get_new_prediction(_alloc_rate_ms_seq); |
224 } |
224 } |
225 |
225 |
226 double G1Analytics::predict_cost_per_log_buffer_entry_ms() const { |
226 double G1Analytics::predict_cost_per_logged_card_ms() const { |
227 return get_new_prediction(_cost_per_log_buffer_entry_ms_seq); |
227 return get_new_prediction(_cost_per_logged_card_ms_seq); |
228 } |
228 } |
229 |
229 |
230 double G1Analytics::predict_scan_hcc_ms() const { |
230 double G1Analytics::predict_scan_hcc_ms() const { |
231 return get_new_prediction(_cost_scan_hcc_seq); |
231 return get_new_prediction(_cost_scan_hcc_seq); |
232 } |
232 } |
233 |
233 |
234 double G1Analytics::predict_rs_update_time_ms(size_t pending_cards) const { |
234 double G1Analytics::predict_rs_update_time_ms(size_t pending_cards) const { |
235 return pending_cards * predict_cost_per_log_buffer_entry_ms() + predict_scan_hcc_ms(); |
235 return pending_cards * predict_cost_per_logged_card_ms() + predict_scan_hcc_ms(); |
236 } |
236 } |
237 |
237 |
238 double G1Analytics::predict_young_cards_per_entry_ratio() const { |
238 double G1Analytics::predict_young_cards_per_entry_ratio() const { |
239 return get_new_prediction(_young_cards_per_entry_ratio_seq); |
239 return get_new_prediction(_young_cards_per_entry_ratio_seq); |
240 } |
240 } |