Skip to content

Commit 8de3eda

Browse files
author
Thomas Schatzl
committed
8295476: Split G1 cost per byte predictor on gc phase
Reviewed-by: ayang, iwalulya, kbarrett
1 parent 2634eff commit 8de3eda

File tree

3 files changed

+13
-33
lines changed

3 files changed

+13
-33
lines changed

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

+6-23
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,13 @@ G1Analytics::G1Analytics(const G1Predictions* predictor) :
8080
_card_scan_to_merge_ratio_seq(TruncatedSeqLength),
8181
_cost_per_card_scan_ms_seq(TruncatedSeqLength),
8282
_cost_per_card_merge_ms_seq(TruncatedSeqLength),
83+
_cost_per_byte_copied_ms_seq(TruncatedSeqLength),
8384
_pending_cards_seq(TruncatedSeqLength),
8485
_rs_length_seq(TruncatedSeqLength),
8586
_rs_length_diff_seq(TruncatedSeqLength),
86-
_copy_cost_per_byte_ms_seq(TruncatedSeqLength),
8787
_constant_other_time_ms_seq(TruncatedSeqLength),
8888
_young_other_cost_per_region_ms_seq(TruncatedSeqLength),
8989
_non_young_other_cost_per_region_ms_seq(TruncatedSeqLength),
90-
_cost_per_byte_ms_during_cm_seq(TruncatedSeqLength),
9190
_recent_prev_end_times_for_all_gcs_sec(NumPrevPausesForHeuristics),
9291
_long_term_pause_time_ratio(0.0),
9392
_short_term_pause_time_ratio(0.0) {
@@ -107,8 +106,8 @@ G1Analytics::G1Analytics(const G1Predictions* predictor) :
107106
_cost_per_card_scan_ms_seq.set_initial(young_only_cost_per_card_scan_ms_defaults[index]);
108107
_rs_length_seq.set_initial(0);
109108
_rs_length_diff_seq.set_initial(0.0);
109+
_cost_per_byte_copied_ms_seq.set_initial(cost_per_byte_ms_defaults[index]);
110110

111-
_copy_cost_per_byte_ms_seq.add(cost_per_byte_ms_defaults[index]);
112111
_constant_other_time_ms_seq.add(constant_other_time_ms_defaults[index]);
113112
_young_other_cost_per_region_ms_seq.add(young_other_cost_per_region_ms_defaults[index]);
114113
_non_young_other_cost_per_region_ms_seq.add(non_young_other_cost_per_region_ms_defaults[index]);
@@ -197,12 +196,8 @@ void G1Analytics::report_rs_length_diff(double rs_length_diff, bool for_young_on
197196
_rs_length_diff_seq.add(rs_length_diff, for_young_only_phase);
198197
}
199198

200-
void G1Analytics::report_cost_per_byte_ms(double cost_per_byte_ms, bool mark_or_rebuild_in_progress) {
201-
if (mark_or_rebuild_in_progress) {
202-
_cost_per_byte_ms_during_cm_seq.add(cost_per_byte_ms);
203-
} else {
204-
_copy_cost_per_byte_ms_seq.add(cost_per_byte_ms);
205-
}
199+
void G1Analytics::report_cost_per_byte_ms(double cost_per_byte_ms, bool for_young_only_phase) {
200+
_cost_per_byte_copied_ms_seq.add(cost_per_byte_ms, for_young_only_phase);
206201
}
207202

208203
void G1Analytics::report_young_other_cost_per_region_ms(double other_cost_per_region_ms) {
@@ -257,20 +252,8 @@ double G1Analytics::predict_card_scan_time_ms(size_t card_num, bool for_young_on
257252
return card_num * predict_zero_bounded(&_cost_per_card_scan_ms_seq, for_young_only_phase);
258253
}
259254

260-
double G1Analytics::predict_object_copy_time_ms_during_cm(size_t bytes_to_copy) const {
261-
if (!enough_samples_available(&_cost_per_byte_ms_during_cm_seq)) {
262-
return (1.1 * bytes_to_copy) * predict_zero_bounded(&_copy_cost_per_byte_ms_seq);
263-
} else {
264-
return bytes_to_copy * predict_zero_bounded(&_cost_per_byte_ms_during_cm_seq);
265-
}
266-
}
267-
268-
double G1Analytics::predict_object_copy_time_ms(size_t bytes_to_copy, bool during_concurrent_mark) const {
269-
if (during_concurrent_mark) {
270-
return predict_object_copy_time_ms_during_cm(bytes_to_copy);
271-
} else {
272-
return bytes_to_copy * predict_zero_bounded(&_copy_cost_per_byte_ms_seq);
273-
}
255+
double G1Analytics::predict_object_copy_time_ms(size_t bytes_to_copy, bool for_young_only_phase) const {
256+
return bytes_to_copy * predict_zero_bounded(&_cost_per_byte_copied_ms_seq, for_young_only_phase);
274257
}
275258

276259
double G1Analytics::predict_constant_other_time_ms() const {

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

+4-7
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,15 @@ class G1Analytics: public CHeapObj<mtGC> {
5555

5656
// The cost to scan a card during young-only and mixed gcs in ms.
5757
G1PhaseDependentSeq _cost_per_card_scan_ms_seq;
58-
5958
// The cost to merge a card during young-only and mixed gcs in ms.
6059
G1PhaseDependentSeq _cost_per_card_merge_ms_seq;
60+
// The cost to copy a byte in ms.
61+
G1PhaseDependentSeq _cost_per_byte_copied_ms_seq;
6162

6263
G1PhaseDependentSeq _pending_cards_seq;
6364
G1PhaseDependentSeq _rs_length_seq;
6465
G1PhaseDependentSeq _rs_length_diff_seq;
6566

66-
// The cost to copy a byte in ms.
67-
TruncatedSeq _copy_cost_per_byte_ms_seq;
6867
TruncatedSeq _constant_other_time_ms_seq;
6968
TruncatedSeq _young_other_cost_per_region_ms_seq;
7069
TruncatedSeq _non_young_other_cost_per_region_ms_seq;
@@ -131,7 +130,7 @@ class G1Analytics: public CHeapObj<mtGC> {
131130
void report_cost_per_card_merge_ms(double cost_per_card_ms, bool for_young_only_phase);
132131
void report_card_scan_to_merge_ratio(double cards_per_entry_ratio, bool for_young_only_phase);
133132
void report_rs_length_diff(double rs_length_diff, bool for_young_only_phase);
134-
void report_cost_per_byte_ms(double cost_per_byte_ms, bool mark_or_rebuild_in_progress);
133+
void report_cost_per_byte_ms(double cost_per_byte_ms, bool for_young_only_phase);
135134
void report_young_other_cost_per_region_ms(double other_cost_per_region_ms);
136135
void report_non_young_other_cost_per_region_ms(double other_cost_per_region_ms);
137136
void report_constant_other_time_ms(double constant_other_time_ms);
@@ -152,9 +151,7 @@ class G1Analytics: public CHeapObj<mtGC> {
152151
double predict_card_merge_time_ms(size_t card_num, bool for_young_only_phase) const;
153152
double predict_card_scan_time_ms(size_t card_num, bool for_young_only_phase) const;
154153

155-
double predict_object_copy_time_ms_during_cm(size_t bytes_to_copy) const;
156-
157-
double predict_object_copy_time_ms(size_t bytes_to_copy, bool during_concurrent_mark) const;
154+
double predict_object_copy_time_ms(size_t bytes_to_copy, bool for_young_only_phase) const;
158155

159156
double predict_constant_other_time_ms() const;
160157

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ void G1Policy::record_young_collection_end(bool concurrent_operation_is_full_mar
851851

852852
if (copied_bytes > 0) {
853853
double cost_per_byte_ms = (average_time_ms(G1GCPhaseTimes::ObjCopy) + average_time_ms(G1GCPhaseTimes::OptObjCopy)) / copied_bytes;
854-
_analytics->report_cost_per_byte_ms(cost_per_byte_ms, collector_state()->mark_or_rebuild_in_progress());
854+
_analytics->report_cost_per_byte_ms(cost_per_byte_ms, is_young_only_pause);
855855
}
856856

857857
if (_collection_set->young_region_length() > 0) {
@@ -1055,12 +1055,12 @@ double G1Policy::predict_eden_copy_time_ms(uint count, size_t* bytes_to_copy) co
10551055
if (bytes_to_copy != NULL) {
10561056
*bytes_to_copy = expected_bytes;
10571057
}
1058-
return _analytics->predict_object_copy_time_ms(expected_bytes, collector_state()->mark_or_rebuild_in_progress());
1058+
return _analytics->predict_object_copy_time_ms(expected_bytes, collector_state()->in_young_only_phase());
10591059
}
10601060

10611061
double G1Policy::predict_region_copy_time_ms(HeapRegion* hr) const {
10621062
size_t const bytes_to_copy = predict_bytes_to_copy(hr);
1063-
return _analytics->predict_object_copy_time_ms(bytes_to_copy, collector_state()->mark_or_rebuild_in_progress());
1063+
return _analytics->predict_object_copy_time_ms(bytes_to_copy, collector_state()->in_young_only_phase());
10641064
}
10651065

10661066
double G1Policy::predict_region_non_copy_time_ms(HeapRegion* hr,

0 commit comments

Comments
 (0)