diff --git a/examples/io/multiple/main.go b/examples/io/multiple/main.go index 397fd41..e5d5bed 100644 --- a/examples/io/multiple/main.go +++ b/examples/io/multiple/main.go @@ -66,8 +66,8 @@ decor.CountersKibiByte("%6.1f / %6.1f", decor.WCSyncWidth), ), mpb.AppendDecorators( - decor.EwmaETA(decor.ET_STYLE_HHMMSS, 2048, sbEta, decor.WCSyncWidth), - decor.TotalAverageSpeed(decor.UnitKiB, "% .2f"), + decor.EwmaETA(decor.ET_STYLE_HHMMSS, 1024*4, sbEta, decor.WCSyncWidth), + decor.AverageSpeed(decor.UnitKiB, "% .2f"), ), ) diff --git a/examples/io/single/main.go b/examples/io/single/main.go index f56a98c..0e159de 100644 --- a/examples/io/single/main.go +++ b/examples/io/single/main.go @@ -49,9 +49,9 @@ decor.CountersKibiByte("% 6.1f / % 6.1f"), ), mpb.AppendDecorators( - decor.EwmaETA(decor.ET_STYLE_MMSS, 2048, sbEta), + decor.EwmaETA(decor.ET_STYLE_MMSS, 1024*8, sbEta), decor.Name(" ] "), - decor.TotalAverageSpeed(decor.UnitKiB, "% .2f"), + decor.AverageSpeed(decor.UnitKiB, "% .2f"), ), ) diff --git a/examples/prependETA/main.go b/examples/prependETA/main.go deleted file mode 100644 index dd8dfe0..0000000 --- a/examples/prependETA/main.go +++ /dev/null @@ -1,55 +0,0 @@ -package main - -import ( - "fmt" - "math/rand" - "sync" - "time" - - "github.com/vbauerster/mpb" - "github.com/vbauerster/mpb/decor" -) - -func init() { - rand.Seed(time.Now().UnixNano()) -} - -func main() { - var wg sync.WaitGroup - p := mpb.New(mpb.WithWaitGroup(&wg)) - total := 100 - numBars := 3 - wg.Add(numBars) - - for i := 0; i < numBars; i++ { - var name string - if i != 1 { - name = fmt.Sprintf("Bar#%d:", i) - } - sbEta := make(chan time.Time) - b := p.AddBar(int64(total), - mpb.PrependDecorators( - decor.Name(name, decor.WCSyncWidth), - decor.OnComplete( - decor.EwmaETA(decor.ET_STYLE_MMSS, 60, sbEta, decor.WC{W: 6}), - "Done", - decor.WCSyncSpace, - ), - ), - mpb.AppendDecorators( - decor.Percentage(decor.WC{W: 5}), - ), - ) - go func() { - defer wg.Done() - max := 100 * time.Millisecond - for i := 0; i < total; i++ { - sbEta <- time.Now() - time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - b.Increment() - } - }() - } - - p.Wait() -} diff --git a/examples/prependElapsed/main.go b/examples/prependElapsed/main.go deleted file mode 100644 index 5399ed3..0000000 --- a/examples/prependElapsed/main.go +++ /dev/null @@ -1,49 +0,0 @@ -package main - -import ( - "fmt" - "math/rand" - "sync" - "time" - - "github.com/vbauerster/mpb" - "github.com/vbauerster/mpb/decor" -) - -func init() { - rand.Seed(time.Now().UnixNano()) -} - -func main() { - var wg sync.WaitGroup - p := mpb.New(mpb.WithWaitGroup(&wg)) - total := 100 - numBars := 3 - wg.Add(numBars) - - for i := 0; i < numBars; i++ { - var name string - if i != 1 { - name = fmt.Sprintf("Bar#%d:", i) - } - b := p.AddBar(int64(total), - mpb.PrependDecorators( - decor.Name(name, decor.WCSyncWidthR), - decor.Elapsed(decor.ET_STYLE_GO, decor.WCSyncSpace), - ), - mpb.AppendDecorators( - decor.Percentage(decor.WC{W: 5}), - ), - ) - go func() { - defer wg.Done() - max := 100 * time.Millisecond - for i := 0; i < total; i++ { - time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10) - b.Increment() - } - }() - } - - p.Wait() -}