I'm making a program and I want to give to the user information about the estimated times every 1000 elements processed. I'm calculating time in this way:
In theory, the relation between elements processed and elapsed time is equal to the relation between the rest of the elements and the rest of time, so my formula is:
(C/Tp) = (MAX - C)/(Te - Tp)
So I need to solve Te by doing:
(Te - Tp) = (MAX - C)Tp/C
And finally:
Te = (MAX - C)Tp/C + Tp
I think that resolution is correct but clearly, operation doesn't tend to 0 as C and Tp grows, so I'm sure that I'm doing a stupid mistake but I couldn't find.
Some ideas please?
I think your initial equation is slightly off, rather than what you have it should be
(C/Tp) = (MAX - C)/Te
since we're estimating the time required to process each item, and this should be constant and equal in the past and the future. This will give you a final equation
Te = (MAX - C)*(Tp/C)
which tends to zero as expected.
(This is assuming that Te is the estimated time left, not estimated total time)
I think it's fine. You're probably thinking about "time remaining", which in your case would be Tr = Te - Tp. That one does tend to 0.
Start: C = 0, results in divide by zero. Makes sense, you have no speed indication so there's no estimate.
End: C = MAX, MAX-C=0, so Te=Tp. Makes sense, estimate is now equal to elapsed time.
Halfway, C=MAX/2, MAX-C = C, so Te=C*Tp/C + Tp, or about twice the current amount passed. Makes sense.
One quarter, C = MAX/4, MAX-C=3*C, so Te=3*C*Tp / C + Tp, or Te = 4*Tp. Makes sense, again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With