Codebase list golang-github-vbauerster-mpb / 23b8427
EwmaNormalizedETA Vladimir Bauer 1 year, 10 months ago
1 changed file(s) with 6 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
3232 // decorator to work correctly you have to measure each iteration's duration
3333 // and pass it to one of the (*Bar).EwmaIncr... family methods.
3434 func EwmaETA(style TimeStyle, age float64, wcc ...WC) Decorator {
35 return EwmaNormalizedETA(style, age, nil, wcc...)
36 }
37
38 // EwmaNormalizedETA same as EwmaETA but with TimeNormalizer option.
39 func EwmaNormalizedETA(style TimeStyle, age float64, normalizer TimeNormalizer, wcc ...WC) Decorator {
3540 var average ewma.MovingAverage
3641 if age == 0 {
3742 average = ewma.NewMovingAverage()
3843 } else {
3944 average = ewma.NewMovingAverage(age)
4045 }
41 return MovingAverageETA(style, NewThreadSafeMovingAverage(average), nil, wcc...)
46 return MovingAverageETA(style, NewThreadSafeMovingAverage(average), normalizer, wcc...)
4247 }
4348
4449 // MovingAverageETA decorator relies on MovingAverage implementation to calculate its average.