File src/algs.cpp changed (mode: 100644) (index 4f218e8..f158a85) |
... |
... |
ExponentialAlg::estimate(int current, int total, int time) |
540 |
540 |
if (lastProgress == 0) { |
if (lastProgress == 0) { |
541 |
541 |
// If first invocation, initialize the estimate. |
// If first invocation, initialize the estimate. |
542 |
542 |
rateEst = rate; |
rateEst = rate; |
543 |
|
lastProgress = current; |
|
544 |
|
return 0; |
|
545 |
543 |
} else { |
} else { |
546 |
544 |
float weight = std::exp(-dt/decay); |
float weight = std::exp(-dt/decay); |
547 |
545 |
rateEst = rateEst*weight + rate*(1.0f - weight); |
rateEst = rateEst*weight + rate*(1.0f - weight); |
548 |
|
eta = (1.0f - 1.0f*current/total)/rateEst; |
|
549 |
546 |
} |
} |
550 |
547 |
|
|
|
548 |
|
eta = (1.0f - 1.0f*current/total)/rateEst; |
|
549 |
|
|
551 |
550 |
lastProgress = current; |
lastProgress = current; |
552 |
551 |
lastTime = time; |
lastTime = time; |
553 |
552 |
lastEta = eta; |
lastEta = eta; |