From 76002747d5617bf63de39c5ed07ecbcc064e9c21 Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Tue, 8 Sep 2020 11:17:09 +0000 Subject: [PATCH] 8252859: Inconsistent use of alpha in class AbsSeq Reviewed-by: tschatzl, sjohanss --- src/hotspot/share/gc/g1/g1IHOPControl.cpp | 4 ++-- src/hotspot/share/gc/z/zStat.cpp | 2 +- src/hotspot/share/utilities/numberSeq.cpp | 5 ++--- src/hotspot/share/utilities/numberSeq.hpp | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1IHOPControl.cpp b/src/hotspot/share/gc/g1/g1IHOPControl.cpp index 5bc2eb8043d..25915cdd356 100644 --- a/src/hotspot/share/gc/g1/g1IHOPControl.cpp +++ b/src/hotspot/share/gc/g1/g1IHOPControl.cpp @@ -91,8 +91,8 @@ G1AdaptiveIHOPControl::G1AdaptiveIHOPControl(double ihop_percent, _heap_reserve_percent(heap_reserve_percent), _heap_waste_percent(heap_waste_percent), _predictor(predictor), - _marking_times_s(10, 0.95), - _allocation_rate_s(10, 0.95), + _marking_times_s(10, 0.05), + _allocation_rate_s(10, 0.05), _last_unrestrained_young_size(0) { } diff --git a/src/hotspot/share/gc/z/zStat.cpp b/src/hotspot/share/gc/z/zStat.cpp index 6346557c892..21eacbe2b52 100644 --- a/src/hotspot/share/gc/z/zStat.cpp +++ b/src/hotspot/share/gc/z/zStat.cpp @@ -1029,7 +1029,7 @@ public: uint64_t ZStatCycle::_nwarmup_cycles = 0; Ticks ZStatCycle::_start_of_last; Ticks ZStatCycle::_end_of_last; -NumberSeq ZStatCycle::_normalized_duration(0.3 /* alpha */); +NumberSeq ZStatCycle::_normalized_duration(0.7 /* alpha */); void ZStatCycle::at_start() { _start_of_last = Ticks::now(); diff --git a/src/hotspot/share/utilities/numberSeq.cpp b/src/hotspot/share/utilities/numberSeq.cpp index 9f3bae4c9e1..0098327c751 100644 --- a/src/hotspot/share/utilities/numberSeq.cpp +++ b/src/hotspot/share/utilities/numberSeq.cpp @@ -47,11 +47,10 @@ void AbsSeq::add(double val) { // mean := mean + incr // variance := (1 - alpha) * (variance + diff * incr) // PDF available at https://fanf2.user.srcf.net/hermes/doc/antiforgery/stats.pdf - // Note: alpha is actually (1.0 - _alpha) in our code double diff = val - _davg; - double incr = (1.0 - _alpha) * diff; + double incr = _alpha * diff; _davg += incr; - _dvariance = _alpha * (_dvariance + diff * incr); + _dvariance = (1.0 - _alpha) * (_dvariance + diff * incr); } } diff --git a/src/hotspot/share/utilities/numberSeq.hpp b/src/hotspot/share/utilities/numberSeq.hpp index aa692884baa..b57fdf45576 100644 --- a/src/hotspot/share/utilities/numberSeq.hpp +++ b/src/hotspot/share/utilities/numberSeq.hpp @@ -40,7 +40,7 @@ ** of the sequence and calculates avg, max, and sd only over them **/ -#define DEFAULT_ALPHA_VALUE 0.7 +#define DEFAULT_ALPHA_VALUE 0.3 class AbsSeq: public CHeapObj { private: