tags:

views:

134

answers:

3

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.

A: 

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.

Martin Beckett
+1  A: 

For the theoretical algorithm that I would attempt, if I would write such a widget, would be something like:

  1. Record the amount of data transferred within a one second period (a literal KiB/s)
  2. Remember the last 5 or 10 such periods (to get an an recent average KiB/s)
  3. Subtract the total size from the transferred size (to get a "bytes remaining")
  4. ???
  5. Widget!

That oughta do it...

(the missing step being: kibibytes remaining divided by average KiB/s)

Henrik Paul
That's something like what I have thought of. In step 4 I'd use some sort of walking average with a heavier bias towards the ends (current speed and long run average).
BCS
A: 

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.

BCS