Download time remaning predictor
-
22-07-2019 - |
Question
Are there any widgets for predicting when a download (or any other process) will finish based on percent done history?
The trivial version would just do a 2 point fit based on the start time, current time and percent done but better option are possible.
A GUI widgest would be nice but a class that just returns the value would be just fine.
Solution
For the theoretical algorithm that I would attempt, if I would write such a widget, would be something like:
- Record the amount of data transferred within a one second period (a literal KiB/s)
- Remember the last 5 or 10 such periods (to get an an recent average KiB/s)
- Subtract the total size from the transferred size (to get a "bytes remaining")
- ???
- Widget!
That oughta do it...
(the missing step being: kibibytes remaining divided by average KiB/s)
OTHER TIPS
Most progress bar widgets have an update() method which takes a percentage done.
They then calculate the time remainging based on the time since start and the latest percentage. If you have a process with a long setup time you might want to add more functionality so that it doesn't include this time, perhaps by having the prediction clock reset when sent a 0% update.
It would sort of have the same effect as some of the other proposals but by collecting percent done data as a function of time statistical methods could be used to generate a R^2 best fit line and project it to 100% done. To make it take into account the current operation a heavier weight could be placed on the newer data (or the older data could be thinned) and to make it ignore short term fluctuations, a heavy weighting can be put on the first data point.