< 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
@@ -42,15 +42,15 @@
static double cost_per_logged_card_ms_defaults[] = {
0.01, 0.005, 0.005, 0.003, 0.003, 0.002, 0.002, 0.0015
};
// all the same
-static double young_cards_per_entry_ratio_defaults[] = {
+static double young_card_merge_to_scan_ratio_defaults[] = {
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
};
-static double young_only_cost_per_remset_card_ms_defaults[] = {
+static double young_only_cost_per_card_scan_ms_defaults[] = {
0.015, 0.01, 0.01, 0.008, 0.008, 0.0055, 0.0055, 0.005
};
static double cost_per_byte_ms_defaults[] = {
0.00006, 0.00003, 0.00003, 0.000015, 0.000015, 0.00001, 0.00001, 0.000009
@@ -59,11 +59,10 @@
// these should be pretty consistent
static double constant_other_time_ms_defaults[] = {
5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0
};
-
static double young_other_cost_per_region_ms_defaults[] = {
0.3, 0.2, 0.2, 0.15, 0.15, 0.12, 0.12, 0.1
};
static double non_young_other_cost_per_region_ms_defaults[] = {
@@ -78,17 +77,17 @@
_alloc_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
_prev_collection_pause_end_ms(0.0),
_rs_length_diff_seq(new TruncatedSeq(TruncatedSeqLength)),
_concurrent_refine_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
_logged_cards_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
- _cost_per_logged_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
- _cost_scan_hcc_seq(new TruncatedSeq(TruncatedSeqLength)),
- _young_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
- _mixed_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
- _young_only_cost_per_remset_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
- _mixed_cost_per_remset_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
- _cost_per_byte_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
+ _young_card_merge_to_scan_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
+ _mixed_card_merge_to_scan_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
+ _young_cost_per_card_scan_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
+ _mixed_cost_per_card_scan_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
+ _young_cost_per_card_merge_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
+ _mixed_cost_per_card_merge_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
+ _copy_cost_per_byte_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
_constant_other_time_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
_young_other_cost_per_region_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
_non_young_other_cost_per_region_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
_pending_cards_seq(new TruncatedSeq(TruncatedSeqLength)),
_rs_length_seq(new TruncatedSeq(TruncatedSeqLength)),
@@ -106,15 +105,14 @@
_rs_length_diff_seq->add(rs_length_diff_defaults[index]);
// Start with inverse of maximum STW cost.
_concurrent_refine_rate_ms_seq->add(1/cost_per_logged_card_ms_defaults[0]);
// Some applications have very low rates for logging cards.
_logged_cards_rate_ms_seq->add(0.0);
- _cost_per_logged_card_ms_seq->add(cost_per_logged_card_ms_defaults[index]);
- _cost_scan_hcc_seq->add(0.0);
- _young_cards_per_entry_ratio_seq->add(young_cards_per_entry_ratio_defaults[index]);
- _young_only_cost_per_remset_card_ms_seq->add(young_only_cost_per_remset_card_ms_defaults[index]);
- _cost_per_byte_ms_seq->add(cost_per_byte_ms_defaults[index]);
+ _young_card_merge_to_scan_ratio_seq->add(young_card_merge_to_scan_ratio_defaults[index]);
+ _young_cost_per_card_scan_ms_seq->add(young_only_cost_per_card_scan_ms_defaults[index]);
+
+ _copy_cost_per_byte_ms_seq->add(cost_per_byte_ms_defaults[index]);
_constant_other_time_ms_seq->add(constant_other_time_ms_defaults[index]);
_young_other_cost_per_region_ms_seq->add(young_other_cost_per_region_ms_defaults[index]);
_non_young_other_cost_per_region_ms_seq->add(non_young_other_cost_per_region_ms_defaults[index]);
// start conservatively (around 50ms is about right)
@@ -171,31 +169,31 @@
void G1Analytics::report_logged_cards_rate_ms(double cards_per_ms) {
_logged_cards_rate_ms_seq->add(cards_per_ms);
}
-void G1Analytics::report_cost_per_logged_card_ms(double cost_per_logged_card_ms) {
- _cost_per_logged_card_ms_seq->add(cost_per_logged_card_ms);
-}
-
-void G1Analytics::report_cost_scan_hcc(double cost_scan_hcc) {
- _cost_scan_hcc_seq->add(cost_scan_hcc);
+void G1Analytics::report_cost_per_card_scan_ms(double cost_per_card_ms, bool for_young_gc) {
+ if (for_young_gc) {
+ _young_cost_per_card_scan_ms_seq->add(cost_per_card_ms);
+ } else {
+ _mixed_cost_per_card_scan_ms_seq->add(cost_per_card_ms);
+ }
}
-void G1Analytics::report_cost_per_remset_card_ms(double cost_per_remset_card_ms, bool for_young_gc) {
+void G1Analytics::report_cost_per_card_merge_ms(double cost_per_card_ms, bool for_young_gc) {
if (for_young_gc) {
- _young_only_cost_per_remset_card_ms_seq->add(cost_per_remset_card_ms);
+ _young_cost_per_card_merge_ms_seq->add(cost_per_card_ms);
} else {
- _mixed_cost_per_remset_card_ms_seq->add(cost_per_remset_card_ms);
+ _mixed_cost_per_card_merge_ms_seq->add(cost_per_card_ms);
}
}
-void G1Analytics::report_cards_per_entry_ratio(double cards_per_entry_ratio, bool for_young_gc) {
+void G1Analytics::report_card_merge_to_scan_ratio(double merge_to_scan_ratio, bool for_young_gc) {
if (for_young_gc) {
- _young_cards_per_entry_ratio_seq->add(cards_per_entry_ratio);
+ _young_card_merge_to_scan_ratio_seq->add(merge_to_scan_ratio);
} else {
- _mixed_cards_per_entry_ratio_seq->add(cards_per_entry_ratio);
+ _mixed_card_merge_to_scan_ratio_seq->add(merge_to_scan_ratio);
}
}
void G1Analytics::report_rs_length_diff(double rs_length_diff) {
_rs_length_diff_seq->add(rs_length_diff);
@@ -203,11 +201,11 @@
void G1Analytics::report_cost_per_byte_ms(double cost_per_byte_ms, bool mark_or_rebuild_in_progress) {
if (mark_or_rebuild_in_progress) {
_cost_per_byte_ms_during_cm_seq->add(cost_per_byte_ms);
} else {
- _cost_per_byte_ms_seq->add(cost_per_byte_ms);
+ _copy_cost_per_byte_ms_seq->add(cost_per_byte_ms);
}
}
void G1Analytics::report_young_other_cost_per_region_ms(double other_cost_per_region_ms) {
_young_other_cost_per_region_ms_seq->add(other_cost_per_region_ms);
@@ -239,78 +237,54 @@
double G1Analytics::predict_logged_cards_rate_ms() const {
return get_new_prediction(_logged_cards_rate_ms_seq);
}
-double G1Analytics::predict_cost_per_logged_card_ms() const {
- return get_new_prediction(_cost_per_logged_card_ms_seq);
-}
-
-double G1Analytics::predict_scan_hcc_ms() const {
- return get_new_prediction(_cost_scan_hcc_seq);
-}
-
-double G1Analytics::predict_rs_update_time_ms(size_t pending_cards) const {
- return pending_cards * predict_cost_per_logged_card_ms() + predict_scan_hcc_ms();
+double G1Analytics::predict_young_card_merge_to_scan_ratio() const {
+ return get_new_prediction(_young_card_merge_to_scan_ratio_seq);
}
-double G1Analytics::predict_young_cards_per_entry_ratio() const {
- return get_new_prediction(_young_cards_per_entry_ratio_seq);
-}
-
-double G1Analytics::predict_mixed_cards_per_entry_ratio() const {
- if (_mixed_cards_per_entry_ratio_seq->num() < 2) {
- return predict_young_cards_per_entry_ratio();
- } else {
- return get_new_prediction(_mixed_cards_per_entry_ratio_seq);
- }
-}
-
-size_t G1Analytics::predict_card_num(size_t rs_length, bool for_young_gc) const {
- if (for_young_gc) {
- return (size_t) (rs_length * predict_young_cards_per_entry_ratio());
+size_t G1Analytics::predict_scan_card_num(size_t rs_length, bool for_young_gc) const {
+ if (for_young_gc || !enough_samples_available(_mixed_card_merge_to_scan_ratio_seq)) {
+ return (size_t) (rs_length * predict_young_card_merge_to_scan_ratio());
} else {
- return (size_t) (rs_length * predict_mixed_cards_per_entry_ratio());
+ return (size_t) (rs_length * get_new_prediction(_mixed_card_merge_to_scan_ratio_seq));
}
}
-double G1Analytics::predict_rs_scan_time_ms(size_t card_num, bool for_young_gc) const {
- if (for_young_gc) {
- return card_num * get_new_prediction(_young_only_cost_per_remset_card_ms_seq);
+double G1Analytics::predict_card_merge_time_ms(size_t card_num, bool for_young_gc) const {
+ if (for_young_gc || !enough_samples_available(_mixed_cost_per_card_merge_ms_seq->num())) {
+ return card_num * get_new_prediction(_young_cost_per_card_merge_ms_seq);
} else {
- return predict_mixed_rs_scan_time_ms(card_num);
+ return card_num * get_new_prediction(_mixed_cost_per_card_merge_ms_seq);
}
}
-double G1Analytics::predict_mixed_rs_scan_time_ms(size_t card_num) const {
- if (_mixed_cost_per_remset_card_ms_seq->num() < 3) {
- return card_num * get_new_prediction(_young_only_cost_per_remset_card_ms_seq);
+double G1Analytics::predict_card_scan_time_ms(size_t card_num, bool for_young_gc) const {
+ if (for_young_gc || !enough_samples_available(_mixed_cost_per_card_scan_ms_seq->num())) {
+ return card_num * get_new_prediction(_young_cost_per_card_scan_ms_seq);
} else {
- return card_num * get_new_prediction(_mixed_cost_per_remset_card_ms_seq);
+ return card_num * get_new_prediction(_mixed_cost_per_card_scan_ms_seq);
}
}
double G1Analytics::predict_object_copy_time_ms_during_cm(size_t bytes_to_copy) const {
- if (_cost_per_byte_ms_during_cm_seq->num() < 3) {
- return (1.1 * bytes_to_copy) * get_new_prediction(_cost_per_byte_ms_seq);
+ if (!enough_samples_available(_cost_per_byte_ms_during_cm_seq)) {
+ return (1.1 * bytes_to_copy) * get_new_prediction(_copy_cost_per_byte_ms_seq);
} else {
return bytes_to_copy * get_new_prediction(_cost_per_byte_ms_during_cm_seq);
}
}
double G1Analytics::predict_object_copy_time_ms(size_t bytes_to_copy, bool during_concurrent_mark) const {
if (during_concurrent_mark) {
return predict_object_copy_time_ms_during_cm(bytes_to_copy);
} else {
- return bytes_to_copy * get_new_prediction(_cost_per_byte_ms_seq);
+ return bytes_to_copy * get_new_prediction(_copy_cost_per_byte_ms_seq);
}
}
-double G1Analytics::predict_cost_per_byte_ms() const {
- return get_new_prediction(_cost_per_byte_ms_seq);
-}
-
double G1Analytics::predict_constant_other_time_ms() const {
return get_new_prediction(_constant_other_time_ms_seq);
}
double G1Analytics::predict_young_other_time_ms(size_t young_num) const {
< prev index next >