Calculate Progress Time Remaining?

Discussion in 'OT Technology' started by Dio Seijuro, Nov 16, 2007.

  1. Dio Seijuro

    Dio Seijuro New Member

    Joined:
    Oct 18, 2006
    Messages:
    898
    Likes Received:
    0
    What are some good algorithms to calculate the time remaining of downloads? I have an app that may have a bunch of downloads at the same time (with max concurrent run limit), and I want to display an estimate of how much time left.

    The cheap way is I can easily assume the speed will be (bytes downloaded so far/ time took so far) and compute that against how much bytes are left. I can update this information every 2~3 seconds. The thing is I would like to know what are some better ways?
     
  2. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    that's a tough one, simply because the bandwidth can vary so much depending on network load.

    The two most popular ways:

    a) Take the file size remaining, and divide by the current download speed.
    b) Take the file size remaining, and divide by "average" speed as weighted by the time. (if you did 100KB/sec for 60 seconds, and 150KB/sec you averaged ((100*60+150*20)/(60+20))= 112.5 KB/sec average.

    Overall, method "B" is the most common.
     
  3. deusexaethera

    deusexaethera OT Supporter

    Joined:
    Jan 27, 2005
    Messages:
    19,712
    Likes Received:
    0
    I like (Total Data - Downloaded Data) / (Downloaded Data / Elapsed Time).

    Example: (50MB - 25MB) / (25MB / 300s) = 25MB / .0833MB/s = 300s

    It's the same as Method B described by Jolly, it just doesn't perform the weighted-average calculation separately. Makes the equation simpler.
     
  4. Dnepr

    Dnepr Guest

    I would say method "A" is actually most common.
     
  5. Dio Seijuro

    Dio Seijuro New Member

    Joined:
    Oct 18, 2006
    Messages:
    898
    Likes Received:
    0
    I was using the easy way already. Is there any source that analyzes how much better is the method that uses weighted average over only recent transmission (instead of speed so far), compare to the easy method in the long run?
     

Share This Page