diff --git a/README.md b/README.md index 84c76d4..018c17c 100644 --- a/README.md +++ b/README.md @@ -55,8 +55,8 @@ for i := 0; i < total; i++ { start := time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - // ewma based decorators require work duration measurement - bar.IncrBy(1, time.Since(start)) + // since ewma decorator is used, we need to pass time.Since(start) + bar.Increment(time.Since(start)) } // wait for our bar to complete and flush p.Wait() @@ -95,8 +95,8 @@ for i := 0; i < total; i++ { start := time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - // ewma based decorators require work duration measurement - bar.IncrBy(1, time.Since(start)) + // since ewma decorator is used, we need to pass time.Since(start) + bar.Increment(time.Since(start)) } }() } diff --git a/_examples/barExtender/main.go b/_examples/barExtender/main.go index 9e44cab..c3a4688 100644 --- a/_examples/barExtender/main.go +++ b/_examples/barExtender/main.go @@ -50,8 +50,8 @@ for i := 0; i < total; i++ { start := time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - // ewma based decorators require work duration measurement - bar.IncrBy(1, time.Since(start)) + // since ewma decorator is used, we need to pass time.Since(start) + bar.Increment(time.Since(start)) } }() } diff --git a/_examples/cancel/main.go b/_examples/cancel/main.go index a911195..9ab3b6e 100644 --- a/_examples/cancel/main.go +++ b/_examples/cancel/main.go @@ -44,8 +44,8 @@ for !bar.Completed() { start := time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - // ewma based decorators require work duration measurement - bar.IncrBy(1, time.Since(start)) + // since ewma decorator is used, we need to pass time.Since(start) + bar.Increment(time.Since(start)) } }() } diff --git a/_examples/complex/main.go b/_examples/complex/main.go index 0a535cb..22e7637 100644 --- a/_examples/complex/main.go +++ b/_examples/complex/main.go @@ -72,7 +72,7 @@ for !b.Completed() { start := time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - // ewma based decorators require work duration measurement + // since ewma decorator is used, we need to pass time.Since(start) b.IncrBy(incrBy, time.Since(start)) } } diff --git a/_examples/differentWidth/main.go b/_examples/differentWidth/main.go index 20b4280..500c722 100644 --- a/_examples/differentWidth/main.go +++ b/_examples/differentWidth/main.go @@ -50,8 +50,8 @@ for i := 0; i < total; i++ { start := time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - // ewma based decorators require work duration measurement - bar.IncrBy(1, time.Since(start)) + // since ewma decorator is used, we need to pass time.Since(start) + bar.Increment(time.Since(start)) } }() } diff --git a/_examples/merge/main.go b/_examples/merge/main.go index 017755a..1cadc73 100644 --- a/_examples/merge/main.go +++ b/_examples/merge/main.go @@ -51,8 +51,8 @@ for i := 0; i < total; i++ { start := time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - // ewma based decorators require work duration measurement - bar.IncrBy(1, time.Since(start)) + // since ewma decorator is used, we need to pass time.Since(start) + bar.Increment(time.Since(start)) } }() } diff --git a/_examples/multiBars/main.go b/_examples/multiBars/main.go index 790a174..8337576 100644 --- a/_examples/multiBars/main.go +++ b/_examples/multiBars/main.go @@ -45,8 +45,8 @@ for i := 0; i < total; i++ { start := time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - // ewma based decorators require work duration measurement - bar.IncrBy(1, time.Since(start)) + // since ewma decorator is used, we need to pass time.Since(start) + bar.Increment(time.Since(start)) } }() } diff --git a/_examples/quietMode/main.go b/_examples/quietMode/main.go index 10502cd..ae527c5 100644 --- a/_examples/quietMode/main.go +++ b/_examples/quietMode/main.go @@ -60,8 +60,8 @@ for i := 0; i < total; i++ { start := time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - // ewma based decorators require work duration measurement - bar.IncrBy(1, time.Since(start)) + // since ewma decorator is used, we need to pass time.Since(start) + bar.Increment(time.Since(start)) } }() } diff --git a/_examples/remove/main.go b/_examples/remove/main.go index 0f1ce4c..e78fe40 100644 --- a/_examples/remove/main.go +++ b/_examples/remove/main.go @@ -41,8 +41,8 @@ b.Abort(true) } time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - // ewma based decorators require work duration measurement - b.IncrBy(1, time.Since(start)) + // since ewma decorator is used, we need to pass time.Since(start) + b.Increment(time.Since(start)) } }() } diff --git a/_examples/reverseBar/main.go b/_examples/reverseBar/main.go index 053e5bc..9bd513b 100644 --- a/_examples/reverseBar/main.go +++ b/_examples/reverseBar/main.go @@ -48,8 +48,8 @@ for i := 0; i < total; i++ { start := time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - // ewma based decorators require work duration measurement - bar.IncrBy(1, time.Since(start)) + // since ewma decorator is used, we need to pass time.Since(start) + bar.Increment(time.Since(start)) } }() } diff --git a/_examples/singleBar/main.go b/_examples/singleBar/main.go index fc76943..029b48b 100644 --- a/_examples/singleBar/main.go +++ b/_examples/singleBar/main.go @@ -34,8 +34,8 @@ for i := 0; i < total; i++ { start := time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - // ewma based decorators require work duration measurement - bar.IncrBy(1, time.Since(start)) + // since ewma decorator is used, we need to pass time.Since(start) + bar.Increment(time.Since(start)) } // wait for our bar to complete and flush p.Wait() diff --git a/_examples/sortBars/main.go b/_examples/sortBars/main.go index 05e963a..430f26c 100644 --- a/_examples/sortBars/main.go +++ b/_examples/sortBars/main.go @@ -43,8 +43,8 @@ priority := total - int(b.Current()) b.SetPriority(priority) } - // ewma based decorators require work duration measurement - b.IncrBy(1, time.Since(start)) + // since ewma decorator is used, we need to pass time.Since(start) + b.Increment(time.Since(start)) } }() } diff --git a/_examples/spinnerBar/main.go b/_examples/spinnerBar/main.go index fc28755..bb28d17 100644 --- a/_examples/spinnerBar/main.go +++ b/_examples/spinnerBar/main.go @@ -67,8 +67,8 @@ for i := 0; i < total; i++ { start := time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - // ewma based decorators require work duration measurement - bar.IncrBy(1, time.Since(start)) + // since ewma decorator is used, we need to pass time.Since(start) + bar.Increment(time.Since(start)) } }() } diff --git a/_examples/spinnerDecorator/main.go b/_examples/spinnerDecorator/main.go index 0b67239..71585e1 100644 --- a/_examples/spinnerDecorator/main.go +++ b/_examples/spinnerDecorator/main.go @@ -42,10 +42,8 @@ defer wg.Done() max := 100 * time.Millisecond for i := 0; i < total; i++ { - start := time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - // ewma based decorators require work duration measurement - bar.IncrBy(1, time.Since(start)) + bar.Increment() } }() } diff --git a/_examples/stress/main.go b/_examples/stress/main.go index e455c16..731f94e 100644 --- a/_examples/stress/main.go +++ b/_examples/stress/main.go @@ -45,10 +45,8 @@ defer wg.Done() max := 100 * time.Millisecond for !bar.Completed() { - start := time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - // ewma based decorators require work duration measurement - bar.IncrBy(1, time.Since(start)) + bar.Increment() } }() } diff --git a/example_test.go b/example_test.go index 2216fe9..5fb2cd4 100644 --- a/example_test.go +++ b/example_test.go @@ -37,8 +37,8 @@ for i := 0; i < total; i++ { start := time.Now() time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - // ewma based decorators require work duration measurement - bar.IncrBy(1, time.Since(start)) + // since ewma decorator is used, we need to pass time.Since(start) + bar.Increment(time.Since(start)) } // wait for our bar to complete and flush p.Wait()