durPerByte
Vladimir Bauer
6 years ago
| 72 | 72 | return d.FormatMsg(*d.completeMsg) |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | v := d.average.Value() | |
| 76 | remaining := time.Duration((st.Total - st.Current) * int64(math.Round(v))) | |
| 75 | v := math.Round(d.average.Value()) | |
| 76 | remaining := time.Duration((st.Total - st.Current) * int64(v)) | |
| 77 | 77 | if d.normalizer != nil { |
| 78 | 78 | remaining = d.normalizer.Normalize(remaining) |
| 79 | 79 | } |
| 85 | 85 | for _, wd := range wdd { |
| 86 | 86 | workDuration = wd |
| 87 | 87 | } |
| 88 | lastItemEstimate := float64(workDuration) / float64(n) | |
| 89 | if math.IsInf(lastItemEstimate, 0) || math.IsNaN(lastItemEstimate) { | |
| 88 | durPerByte := float64(workDuration) / float64(n) | |
| 89 | if math.IsInf(durPerByte, 0) || math.IsNaN(durPerByte) { | |
| 90 | 90 | return |
| 91 | 91 | } |
| 92 | d.average.Add(lastItemEstimate) | |
| 92 | d.average.Add(durPerByte) | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | func (d *movingAverageETA) OnCompleteMessage(msg string) { |