Skip to content

Commit 23b8427

Browse files
committed
EwmaNormalizedETA
1 parent 9502d24 commit 23b8427

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

decor/eta.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,18 @@ func (f TimeNormalizerFunc) Normalize(src time.Duration) time.Duration {
3333
// decorator to work correctly you have to measure each iteration's duration
3434
// and pass it to one of the (*Bar).EwmaIncr... family methods.
3535
func EwmaETA(style TimeStyle, age float64, wcc ...WC) Decorator {
36+
return EwmaNormalizedETA(style, age, nil, wcc...)
37+
}
38+
39+
// EwmaNormalizedETA same as EwmaETA but with TimeNormalizer option.
40+
func EwmaNormalizedETA(style TimeStyle, age float64, normalizer TimeNormalizer, wcc ...WC) Decorator {
3641
var average ewma.MovingAverage
3742
if age == 0 {
3843
average = ewma.NewMovingAverage()
3944
} else {
4045
average = ewma.NewMovingAverage(age)
4146
}
42-
return MovingAverageETA(style, NewThreadSafeMovingAverage(average), nil, wcc...)
47+
return MovingAverageETA(style, NewThreadSafeMovingAverage(average), normalizer, wcc...)
4348
}
4449

4550
// MovingAverageETA decorator relies on MovingAverage implementation to calculate its average.

0 commit comments

Comments
 (0)