Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 6 additions & 23 deletions src/hotspot/share/gc/g1/g1Analytics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,13 @@ G1Analytics::G1Analytics(const G1Predictions* predictor) :
_card_scan_to_merge_ratio_seq(TruncatedSeqLength),
_cost_per_card_scan_ms_seq(TruncatedSeqLength),
_cost_per_card_merge_ms_seq(TruncatedSeqLength),
_cost_per_byte_copied_ms_seq(TruncatedSeqLength),
_pending_cards_seq(TruncatedSeqLength),
_rs_length_seq(TruncatedSeqLength),
_rs_length_diff_seq(TruncatedSeqLength),
_copy_cost_per_byte_ms_seq(TruncatedSeqLength),
_constant_other_time_ms_seq(TruncatedSeqLength),
_young_other_cost_per_region_ms_seq(TruncatedSeqLength),
_non_young_other_cost_per_region_ms_seq(TruncatedSeqLength),
_cost_per_byte_ms_during_cm_seq(TruncatedSeqLength),
_recent_prev_end_times_for_all_gcs_sec(NumPrevPausesForHeuristics),
_long_term_pause_time_ratio(0.0),
_short_term_pause_time_ratio(0.0) {
Expand All @@ -107,8 +106,8 @@ G1Analytics::G1Analytics(const G1Predictions* predictor) :
_cost_per_card_scan_ms_seq.set_initial(young_only_cost_per_card_scan_ms_defaults[index]);
_rs_length_seq.set_initial(0);
_rs_length_diff_seq.set_initial(0.0);
_cost_per_byte_copied_ms_seq.set_initial(cost_per_byte_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]);
Expand Down Expand Up @@ -197,12 +196,8 @@ void G1Analytics::report_rs_length_diff(double rs_length_diff, bool for_young_on
_rs_length_diff_seq.add(rs_length_diff, for_young_only_phase);
}

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 {
_copy_cost_per_byte_ms_seq.add(cost_per_byte_ms);
}
void G1Analytics::report_cost_per_byte_ms(double cost_per_byte_ms, bool for_young_only_phase) {
_cost_per_byte_copied_ms_seq.add(cost_per_byte_ms, for_young_only_phase);
}

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

double G1Analytics::predict_object_copy_time_ms_during_cm(size_t bytes_to_copy) const {
if (!enough_samples_available(&_cost_per_byte_ms_during_cm_seq)) {
return (1.1 * bytes_to_copy) * predict_zero_bounded(&_copy_cost_per_byte_ms_seq);
} else {
return bytes_to_copy * predict_zero_bounded(&_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 * predict_zero_bounded(&_copy_cost_per_byte_ms_seq);
}
double G1Analytics::predict_object_copy_time_ms(size_t bytes_to_copy, bool for_young_only_phase) const {
return bytes_to_copy * predict_zero_bounded(&_cost_per_byte_copied_ms_seq, for_young_only_phase);
}

double G1Analytics::predict_constant_other_time_ms() const {
Expand Down
11 changes: 4 additions & 7 deletions src/hotspot/share/gc/g1/g1Analytics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,15 @@ class G1Analytics: public CHeapObj<mtGC> {

// The cost to scan a card during young-only and mixed gcs in ms.
G1PhaseDependentSeq _cost_per_card_scan_ms_seq;

// The cost to merge a card during young-only and mixed gcs in ms.
G1PhaseDependentSeq _cost_per_card_merge_ms_seq;
// The cost to copy a byte in ms.
G1PhaseDependentSeq _cost_per_byte_copied_ms_seq;

G1PhaseDependentSeq _pending_cards_seq;
G1PhaseDependentSeq _rs_length_seq;
G1PhaseDependentSeq _rs_length_diff_seq;

// The cost to copy a byte in ms.
TruncatedSeq _copy_cost_per_byte_ms_seq;
TruncatedSeq _constant_other_time_ms_seq;
TruncatedSeq _young_other_cost_per_region_ms_seq;
TruncatedSeq _non_young_other_cost_per_region_ms_seq;
Expand Down Expand Up @@ -131,7 +130,7 @@ class G1Analytics: public CHeapObj<mtGC> {
void report_cost_per_card_merge_ms(double cost_per_card_ms, bool for_young_only_phase);
void report_card_scan_to_merge_ratio(double cards_per_entry_ratio, bool for_young_only_phase);
void report_rs_length_diff(double rs_length_diff, bool for_young_only_phase);
void report_cost_per_byte_ms(double cost_per_byte_ms, bool mark_or_rebuild_in_progress);
void report_cost_per_byte_ms(double cost_per_byte_ms, bool for_young_only_phase);
void report_young_other_cost_per_region_ms(double other_cost_per_region_ms);
void report_non_young_other_cost_per_region_ms(double other_cost_per_region_ms);
void report_constant_other_time_ms(double constant_other_time_ms);
Expand All @@ -152,9 +151,7 @@ class G1Analytics: public CHeapObj<mtGC> {
double predict_card_merge_time_ms(size_t card_num, bool for_young_only_phase) const;
double predict_card_scan_time_ms(size_t card_num, bool for_young_only_phase) const;

double predict_object_copy_time_ms_during_cm(size_t bytes_to_copy) const;

double predict_object_copy_time_ms(size_t bytes_to_copy, bool during_concurrent_mark) const;
double predict_object_copy_time_ms(size_t bytes_to_copy, bool for_young_only_phase) const;

double predict_constant_other_time_ms() const;

Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/gc/g1/g1Policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ void G1Policy::record_young_collection_end(bool concurrent_operation_is_full_mar

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

if (_collection_set->young_region_length() > 0) {
Expand Down Expand Up @@ -1055,12 +1055,12 @@ double G1Policy::predict_eden_copy_time_ms(uint count, size_t* bytes_to_copy) co
if (bytes_to_copy != NULL) {
*bytes_to_copy = expected_bytes;
}
return _analytics->predict_object_copy_time_ms(expected_bytes, collector_state()->mark_or_rebuild_in_progress());
return _analytics->predict_object_copy_time_ms(expected_bytes, collector_state()->in_young_only_phase());
}

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

double G1Policy::predict_region_non_copy_time_ms(HeapRegion* hr,
Expand Down