Codebase list golang-github-vbauerster-mpb / ea00d65
use bar.Increment Vladimir Bauer 6 years ago
16 changed file(s) with 31 addition(s) and 35 deletion(s). Raw diff Collapse all Expand all
5454 for i := 0; i < total; i++ {
5555 start := time.Now()
5656 time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10)
57 // ewma based decorators require work duration measurement
58 bar.IncrBy(1, time.Since(start))
57 // since ewma decorator is used, we need to pass time.Since(start)
58 bar.Increment(time.Since(start))
5959 }
6060 // wait for our bar to complete and flush
6161 p.Wait()
9494 for i := 0; i < total; i++ {
9595 start := time.Now()
9696 time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10)
97 // ewma based decorators require work duration measurement
98 bar.IncrBy(1, time.Since(start))
97 // since ewma decorator is used, we need to pass time.Since(start)
98 bar.Increment(time.Since(start))
9999 }
100100 }()
101101 }
4949 for i := 0; i < total; i++ {
5050 start := time.Now()
5151 time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10)
52 // ewma based decorators require work duration measurement
53 bar.IncrBy(1, time.Since(start))
52 // since ewma decorator is used, we need to pass time.Since(start)
53 bar.Increment(time.Since(start))
5454 }
5555 }()
5656 }
4343 for !bar.Completed() {
4444 start := time.Now()
4545 time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10)
46 // ewma based decorators require work duration measurement
47 bar.IncrBy(1, time.Since(start))
46 // since ewma decorator is used, we need to pass time.Since(start)
47 bar.Increment(time.Since(start))
4848 }
4949 }()
5050 }
7171 for !b.Completed() {
7272 start := time.Now()
7373 time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10)
74 // ewma based decorators require work duration measurement
74 // since ewma decorator is used, we need to pass time.Since(start)
7575 b.IncrBy(incrBy, time.Since(start))
7676 }
7777 }
4949 for i := 0; i < total; i++ {
5050 start := time.Now()
5151 time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10)
52 // ewma based decorators require work duration measurement
53 bar.IncrBy(1, time.Since(start))
52 // since ewma decorator is used, we need to pass time.Since(start)
53 bar.Increment(time.Since(start))
5454 }
5555 }()
5656 }
5050 for i := 0; i < total; i++ {
5151 start := time.Now()
5252 time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10)
53 // ewma based decorators require work duration measurement
54 bar.IncrBy(1, time.Since(start))
53 // since ewma decorator is used, we need to pass time.Since(start)
54 bar.Increment(time.Since(start))
5555 }
5656 }()
5757 }
4444 for i := 0; i < total; i++ {
4545 start := time.Now()
4646 time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10)
47 // ewma based decorators require work duration measurement
48 bar.IncrBy(1, time.Since(start))
47 // since ewma decorator is used, we need to pass time.Since(start)
48 bar.Increment(time.Since(start))
4949 }
5050 }()
5151 }
5959 for i := 0; i < total; i++ {
6060 start := time.Now()
6161 time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10)
62 // ewma based decorators require work duration measurement
63 bar.IncrBy(1, time.Since(start))
62 // since ewma decorator is used, we need to pass time.Since(start)
63 bar.Increment(time.Since(start))
6464 }
6565 }()
6666 }
4040 b.Abort(true)
4141 }
4242 time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10)
43 // ewma based decorators require work duration measurement
44 b.IncrBy(1, time.Since(start))
43 // since ewma decorator is used, we need to pass time.Since(start)
44 b.Increment(time.Since(start))
4545 }
4646 }()
4747 }
4747 for i := 0; i < total; i++ {
4848 start := time.Now()
4949 time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10)
50 // ewma based decorators require work duration measurement
51 bar.IncrBy(1, time.Since(start))
50 // since ewma decorator is used, we need to pass time.Since(start)
51 bar.Increment(time.Since(start))
5252 }
5353 }()
5454 }
3333 for i := 0; i < total; i++ {
3434 start := time.Now()
3535 time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10)
36 // ewma based decorators require work duration measurement
37 bar.IncrBy(1, time.Since(start))
36 // since ewma decorator is used, we need to pass time.Since(start)
37 bar.Increment(time.Since(start))
3838 }
3939 // wait for our bar to complete and flush
4040 p.Wait()
4242 priority := total - int(b.Current())
4343 b.SetPriority(priority)
4444 }
45 // ewma based decorators require work duration measurement
46 b.IncrBy(1, time.Since(start))
45 // since ewma decorator is used, we need to pass time.Since(start)
46 b.Increment(time.Since(start))
4747 }
4848 }()
4949 }
6666 for i := 0; i < total; i++ {
6767 start := time.Now()
6868 time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10)
69 // ewma based decorators require work duration measurement
70 bar.IncrBy(1, time.Since(start))
69 // since ewma decorator is used, we need to pass time.Since(start)
70 bar.Increment(time.Since(start))
7171 }
7272 }()
7373 }
4141 defer wg.Done()
4242 max := 100 * time.Millisecond
4343 for i := 0; i < total; i++ {
44 start := time.Now()
4544 time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10)
46 // ewma based decorators require work duration measurement
47 bar.IncrBy(1, time.Since(start))
45 bar.Increment()
4846 }
4947 }()
5048 }
4444 defer wg.Done()
4545 max := 100 * time.Millisecond
4646 for !bar.Completed() {
47 start := time.Now()
4847 time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10)
49 // ewma based decorators require work duration measurement
50 bar.IncrBy(1, time.Since(start))
48 bar.Increment()
5149 }
5250 }()
5351 }
3636 for i := 0; i < total; i++ {
3737 start := time.Now()
3838 time.Sleep(time.Duration(rand.Intn(10)+1) * max / 10)
39 // ewma based decorators require work duration measurement
40 bar.IncrBy(1, time.Since(start))
39 // since ewma decorator is used, we need to pass time.Since(start)
40 bar.Increment(time.Since(start))
4141 }
4242 // wait for our bar to complete and flush
4343 p.Wait()