diff --git a/README.md b/README.md index e979ecf..410f694 100644 --- a/README.md +++ b/README.md @@ -96,9 +96,8 @@ // EWMA's unit of measure is an iteration's duration start := time.Now() time.Sleep(time.Duration(rng.Intn(10)+1) * max / 10) - bar.Increment() - // we need to call DecoratorEwmaUpdate to fulfill ewma decorator's contract - bar.DecoratorEwmaUpdate(time.Since(start)) + // we need to call EwmaIncrement to fulfill ewma decorator's contract + bar.EwmaIncrement(time.Since(start)) } }() } diff --git a/_examples/barExtender/main.go b/_examples/barExtender/main.go index 3fbf4a8..77cd05d 100644 --- a/_examples/barExtender/main.go +++ b/_examples/barExtender/main.go @@ -52,9 +52,8 @@ // EWMA's unit of measure is an iteration's duration start := time.Now() time.Sleep(time.Duration(rng.Intn(10)+1) * max / 10) - bar.Increment() - // since EWMA based decorator is used, DecoratorEwmaUpdate should be called - bar.DecoratorEwmaUpdate(time.Since(start)) + // we need to call EwmaIncrement to fulfill ewma decorator's contract + bar.EwmaIncrement(time.Since(start)) } }() } diff --git a/_examples/cancel/main.go b/_examples/cancel/main.go index 28cc8bd..9b280ab 100644 --- a/_examples/cancel/main.go +++ b/_examples/cancel/main.go @@ -44,9 +44,8 @@ // EWMA's unit of measure is an iteration's duration start := time.Now() time.Sleep(time.Duration(rng.Intn(10)+1) * max / 10) - bar.Increment() - // since EWMA based decorator is used, DecoratorEwmaUpdate should be called - bar.DecoratorEwmaUpdate(time.Since(start)) + // we need to call EwmaIncrement to fulfill ewma decorator's contract + bar.EwmaIncrement(time.Since(start)) } }() } diff --git a/_examples/complex/main.go b/_examples/complex/main.go index 380dcaf..39d98e4 100644 --- a/_examples/complex/main.go +++ b/_examples/complex/main.go @@ -58,8 +58,7 @@ // EWMA's unit of measure is an iteration's duration start := time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - bar.IncrInt64(rand.Int63n(5) + 1) - // we need to call DecoratorEwmaUpdate to fulfill ewma decorator's contract - bar.DecoratorEwmaUpdate(time.Since(start)) + // we need to call EwmaIncrement to fulfill ewma decorator's contract + bar.EwmaIncrInt64(rand.Int63n(5)+1, time.Since(start)) } } diff --git a/_examples/differentWidth/main.go b/_examples/differentWidth/main.go index 56e65a4..5f87f14 100644 --- a/_examples/differentWidth/main.go +++ b/_examples/differentWidth/main.go @@ -49,9 +49,8 @@ // EWMA's unit of measure is an iteration's duration start := time.Now() time.Sleep(time.Duration(rng.Intn(10)+1) * max / 10) - bar.Increment() - // we need to call DecoratorEwmaUpdate to fulfill ewma decorator's contract - bar.DecoratorEwmaUpdate(time.Since(start)) + // we need to call EwmaIncrement to fulfill ewma decorator's contract + bar.EwmaIncrement(time.Since(start)) } }() } diff --git a/_examples/merge/main.go b/_examples/merge/main.go index bd2a26a..5f60a59 100644 --- a/_examples/merge/main.go +++ b/_examples/merge/main.go @@ -53,9 +53,8 @@ // EWMA's unit of measure is an iteration's duration start := time.Now() time.Sleep(time.Duration(rng.Intn(10)+1) * max / 10) - bar.Increment() - // we need to call DecoratorEwmaUpdate to fulfill ewma decorator's contract - bar.DecoratorEwmaUpdate(time.Since(start)) + // we need to call EwmaIncrement to fulfill ewma decorator's contract + bar.EwmaIncrement(time.Since(start)) } }() } diff --git a/_examples/multiBars/main.go b/_examples/multiBars/main.go index c725c5e..229f4bc 100644 --- a/_examples/multiBars/main.go +++ b/_examples/multiBars/main.go @@ -44,9 +44,8 @@ // EWMA's unit of measure is an iteration's duration start := time.Now() time.Sleep(time.Duration(rng.Intn(10)+1) * max / 10) - bar.Increment() - // we need to call DecoratorEwmaUpdate to fulfill ewma decorator's contract - bar.DecoratorEwmaUpdate(time.Since(start)) + // we need to call EwmaIncrement to fulfill ewma decorator's contract + bar.EwmaIncrement(time.Since(start)) } }() } diff --git a/_examples/poplog/main.go b/_examples/poplog/main.go index 51cfdf9..5802ff4 100644 --- a/_examples/poplog/main.go +++ b/_examples/poplog/main.go @@ -35,9 +35,8 @@ // EWMA's unit of measure is an iteration's duration start := time.Now() time.Sleep(time.Duration(rng.Intn(10)+1) * max / 10) - bar.Increment() - // we need to call DecoratorEwmaUpdate to fulfill ewma decorator's contract - bar.DecoratorEwmaUpdate(time.Since(start)) + // we need to call EwmaIncrement to fulfill ewma decorator's contract + bar.EwmaIncrement(time.Since(start)) } } diff --git a/_examples/progressAsWriter/main.go b/_examples/progressAsWriter/main.go index 261a958..543843c 100644 --- a/_examples/progressAsWriter/main.go +++ b/_examples/progressAsWriter/main.go @@ -47,9 +47,8 @@ // EWMA's unit of measure is an iteration's duration start := time.Now() time.Sleep(time.Duration(rng.Intn(10)+1) * max / 10) - bar.Increment() - // we need to call DecoratorEwmaUpdate to fulfill ewma decorator's contract - bar.DecoratorEwmaUpdate(time.Since(start)) + // we need to call EwmaIncrement to fulfill ewma decorator's contract + bar.EwmaIncrement(time.Since(start)) } log.Println(name, "done") }() diff --git a/_examples/quietMode/main.go b/_examples/quietMode/main.go index 321734d..658fbbe 100644 --- a/_examples/quietMode/main.go +++ b/_examples/quietMode/main.go @@ -62,9 +62,8 @@ // EWMA's unit of measure is an iteration's duration start := time.Now() time.Sleep(time.Duration(rng.Intn(10)+1) * max / 10) - bar.Increment() - // we need to call DecoratorEwmaUpdate to fulfill ewma decorator's contract - bar.DecoratorEwmaUpdate(time.Since(start)) + // we need to call EwmaIncrement to fulfill ewma decorator's contract + bar.EwmaIncrement(time.Since(start)) } }() } diff --git a/_examples/reverseBar/main.go b/_examples/reverseBar/main.go index 4ae5f9f..8eafb85 100644 --- a/_examples/reverseBar/main.go +++ b/_examples/reverseBar/main.go @@ -44,9 +44,8 @@ // EWMA's unit of measure is an iteration's duration start := time.Now() time.Sleep(time.Duration(rng.Intn(10)+1) * max / 10) - bar.Increment() - // we need to call DecoratorEwmaUpdate to fulfill ewma decorator's contract - bar.DecoratorEwmaUpdate(time.Since(start)) + // we need to call EwmaIncrement to fulfill ewma decorator's contract + bar.EwmaIncrement(time.Since(start)) } }() } diff --git a/_examples/spinnerBar/main.go b/_examples/spinnerBar/main.go index 6f0ccad..07526cd 100644 --- a/_examples/spinnerBar/main.go +++ b/_examples/spinnerBar/main.go @@ -45,9 +45,8 @@ // EWMA's unit of measure is an iteration's duration start := time.Now() time.Sleep(time.Duration(rng.Intn(10)+1) * max / 10) - bar.Increment() - // we need to call DecoratorEwmaUpdate to fulfill ewma decorator's contract - bar.DecoratorEwmaUpdate(time.Since(start)) + // we need to call EwmaIncrement to fulfill ewma decorator's contract + bar.EwmaIncrement(time.Since(start)) } }() } diff --git a/example_test.go b/example_test.go index a76a6ec..6d6ccfe 100644 --- a/example_test.go +++ b/example_test.go @@ -25,8 +25,7 @@ decor.Name(name, decor.WC{W: len(name) + 1, C: decor.DidentRight}), // replace ETA decorator with "done" message, OnComplete event decor.OnComplete( - // ETA decorator with ewma age of 60, and width reservation of 4 - decor.EwmaETA(decor.ET_STYLE_GO, 60, decor.WC{W: 4}), "done", + decor.AverageETA(decor.ET_STYLE_GO, decor.WC{W: 4}), "done", ), ), mpb.AppendDecorators(decor.Percentage()), @@ -34,13 +33,8 @@ // simulating some work max := 100 * time.Millisecond for i := 0; i < total; i++ { - // start variable is solely for EWMA calculation - // EWMA's unit of measure is an iteration's duration - start := time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) bar.Increment() - // we need to call DecoratorEwmaUpdate to fulfill ewma decorator's contract - bar.DecoratorEwmaUpdate(time.Since(start)) } // wait for our bar to complete and flush p.Wait() diff --git a/progress_test.go b/progress_test.go index 9f3227c..01743a7 100644 --- a/progress_test.go +++ b/progress_test.go @@ -157,8 +157,7 @@ } } time.Sleep(randomDuration(100 * time.Millisecond)) - bar.IncrInt64(rand.Int63n(5) + 1) - bar.DecoratorEwmaUpdate(time.Since(start)) + bar.EwmaIncrInt64(rand.Int63n(5)+1, time.Since(start)) } }() }