8245086: G1: Rename measured pause time ratios
Reviewed-by: sjohanss, kbarrett
This commit is contained in:
parent
220061b13e
commit
47be3b098e
src/hotspot/share/gc/g1
test/hotspot/gtest/gc/g1
@ -94,8 +94,8 @@ G1Analytics::G1Analytics(const G1Predictions* predictor) :
|
||||
_rs_length_seq(new TruncatedSeq(TruncatedSeqLength)),
|
||||
_cost_per_byte_ms_during_cm_seq(new TruncatedSeq(TruncatedSeqLength)),
|
||||
_recent_prev_end_times_for_all_gcs_sec(new TruncatedSeq(NumPrevPausesForHeuristics)),
|
||||
_recent_avg_pause_time_ratio(0.0),
|
||||
_last_pause_time_ratio(0.0) {
|
||||
_long_term_pause_time_ratio(0.0),
|
||||
_short_term_pause_time_ratio(0.0) {
|
||||
|
||||
// Seed sequences with initial values.
|
||||
_recent_prev_end_times_for_all_gcs_sec->add(os::elapsedTime());
|
||||
@ -150,17 +150,16 @@ void G1Analytics::report_alloc_rate_ms(double alloc_rate) {
|
||||
}
|
||||
|
||||
void G1Analytics::compute_pause_time_ratio(double interval_ms, double pause_time_ms) {
|
||||
_recent_avg_pause_time_ratio = _recent_gc_times_ms->sum() / interval_ms;
|
||||
|
||||
// Clamp the result to [0.0 ... 1.0] to filter out nonsensical results due to bad input.
|
||||
_recent_avg_pause_time_ratio = clamp(_recent_avg_pause_time_ratio, 0.0, 1.0);
|
||||
_long_term_pause_time_ratio = _recent_gc_times_ms->sum() / interval_ms;
|
||||
// Filter out nonsensical results due to bad input.
|
||||
_long_term_pause_time_ratio = clamp(_long_term_pause_time_ratio, 0.0, 1.0);
|
||||
|
||||
// Compute the ratio of just this last pause time to the entire time range stored
|
||||
// in the vectors. Comparing this pause to the entire range, rather than only the
|
||||
// most recent interval, has the effect of smoothing over a possible transient 'burst'
|
||||
// of more frequent pauses that don't really reflect a change in heap occupancy.
|
||||
// This reduces the likelihood of a needless heap expansion being triggered.
|
||||
_last_pause_time_ratio =
|
||||
_short_term_pause_time_ratio =
|
||||
(pause_time_ms * _recent_prev_end_times_for_all_gcs_sec->num()) / interval_ms;
|
||||
}
|
||||
|
||||
|
@ -75,10 +75,10 @@ class G1Analytics: public CHeapObj<mtGC> {
|
||||
// Statistics kept per GC stoppage, pause or full.
|
||||
TruncatedSeq* _recent_prev_end_times_for_all_gcs_sec;
|
||||
|
||||
// The ratio of gc time to elapsed time, computed over recent pauses,
|
||||
// and the ratio for just the last pause.
|
||||
double _recent_avg_pause_time_ratio;
|
||||
double _last_pause_time_ratio;
|
||||
// Cached values for long and short term pause time ratios. See
|
||||
// compute_pause_time_ratios() for how they are computed.
|
||||
double _long_term_pause_time_ratio;
|
||||
double _short_term_pause_time_ratio;
|
||||
|
||||
// Returns whether the sequence have enough samples to get a "good" prediction.
|
||||
// The constant used is random but "small".
|
||||
@ -95,12 +95,12 @@ public:
|
||||
return _prev_collection_pause_end_ms;
|
||||
}
|
||||
|
||||
double recent_avg_pause_time_ratio() const {
|
||||
return _recent_avg_pause_time_ratio;
|
||||
double long_term_pause_time_ratio() const {
|
||||
return _long_term_pause_time_ratio;
|
||||
}
|
||||
|
||||
double last_pause_time_ratio() const {
|
||||
return _last_pause_time_ratio;
|
||||
double short_term_pause_time_ratio() const {
|
||||
return _short_term_pause_time_ratio;
|
||||
}
|
||||
|
||||
uint number_of_recorded_pause_times() const {
|
||||
|
@ -55,14 +55,14 @@ size_t G1HeapSizingPolicy::expansion_amount() {
|
||||
"we should have set it to a default value set_g1_gc_flags() "
|
||||
"if a user set it to 0");
|
||||
|
||||
double recent_gc_overhead = _analytics->recent_avg_pause_time_ratio() * 100.0;
|
||||
double last_gc_overhead = _analytics->last_pause_time_ratio() * 100.0;
|
||||
double long_term_gc_overhead = _analytics->long_term_pause_time_ratio() * 100.0;
|
||||
double short_term_gc_overhead = _analytics->short_term_pause_time_ratio() * 100.0;
|
||||
size_t expand_bytes = 0;
|
||||
|
||||
if (_g1h->capacity() == _g1h->max_capacity()) {
|
||||
log_trace(gc, ergo, heap)("Can not expand (heap already fully expanded) "
|
||||
"recent GC overhead: %1.2f %% committed: " SIZE_FORMAT "B",
|
||||
recent_gc_overhead, _g1h->capacity());
|
||||
"long term GC overhead: %1.2f %% committed: " SIZE_FORMAT "B",
|
||||
long_term_gc_overhead, _g1h->capacity());
|
||||
|
||||
clear_ratio_check_data();
|
||||
return expand_bytes;
|
||||
@ -83,9 +83,9 @@ size_t G1HeapSizingPolicy::expansion_amount() {
|
||||
// If the last GC time ratio is over the threshold, increment the count of
|
||||
// times it has been exceeded, and add this ratio to the sum of exceeded
|
||||
// ratios.
|
||||
if (last_gc_overhead > threshold) {
|
||||
if (short_term_gc_overhead > threshold) {
|
||||
_ratio_over_threshold_count++;
|
||||
_ratio_over_threshold_sum += last_gc_overhead;
|
||||
_ratio_over_threshold_sum += short_term_gc_overhead;
|
||||
}
|
||||
|
||||
// Check if we've had enough GC time ratio checks that were over the
|
||||
@ -95,7 +95,7 @@ size_t G1HeapSizingPolicy::expansion_amount() {
|
||||
// long enough to make the average exceed the threshold.
|
||||
bool filled_history_buffer = _pauses_since_start == _num_prev_pauses_for_heuristics;
|
||||
if ((_ratio_over_threshold_count == MinOverThresholdForGrowth) ||
|
||||
(filled_history_buffer && (recent_gc_overhead > threshold))) {
|
||||
(filled_history_buffer && (long_term_gc_overhead > threshold))) {
|
||||
size_t min_expand_bytes = HeapRegion::GrainBytes;
|
||||
size_t reserved_bytes = _g1h->max_capacity();
|
||||
size_t committed_bytes = _g1h->capacity();
|
||||
@ -129,7 +129,7 @@ size_t G1HeapSizingPolicy::expansion_amount() {
|
||||
|
||||
double ratio_delta;
|
||||
if (filled_history_buffer) {
|
||||
ratio_delta = recent_gc_overhead - threshold;
|
||||
ratio_delta = long_term_gc_overhead - threshold;
|
||||
} else {
|
||||
ratio_delta = (_ratio_over_threshold_sum/_ratio_over_threshold_count) - threshold;
|
||||
}
|
||||
@ -145,8 +145,8 @@ size_t G1HeapSizingPolicy::expansion_amount() {
|
||||
}
|
||||
|
||||
log_debug(gc, ergo, heap)("Attempt heap expansion (recent GC overhead higher than threshold after GC) "
|
||||
"recent GC overhead: %1.2f %% threshold: %1.2f %% uncommitted: " SIZE_FORMAT "B base expansion amount and scale: " SIZE_FORMAT "B (%1.2f%%)",
|
||||
recent_gc_overhead, threshold, uncommitted_bytes, expand_bytes, scale_factor * 100);
|
||||
"long term GC overhead: %1.2f %% threshold: %1.2f %% uncommitted: " SIZE_FORMAT "B base expansion amount and scale: " SIZE_FORMAT "B (%1.2f%%)",
|
||||
long_term_gc_overhead, threshold, uncommitted_bytes, expand_bytes, scale_factor * 100);
|
||||
|
||||
expand_bytes = static_cast<size_t>(expand_bytes * scale_factor);
|
||||
|
||||
|
@ -30,6 +30,6 @@
|
||||
TEST_VM(G1Analytics, is_initialized) {
|
||||
G1Predictions p(0.888888); // the actual sigma value doesn't matter
|
||||
G1Analytics a(&p);
|
||||
ASSERT_EQ(a.recent_avg_pause_time_ratio(), 0.0);
|
||||
ASSERT_EQ(a.last_pause_time_ratio(), 0.0);
|
||||
ASSERT_EQ(a.long_term_pause_time_ratio(), 0.0);
|
||||
ASSERT_EQ(a.short_term_pause_time_ratio(), 0.0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user