Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 469887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:49:46+00:00 2026-05-12T23:49:46+00:00

While displaying the download status in a window, I have information like: 1) Total

  • 0

While displaying the download status in a window, I have information like:

1) Total file size (f)

2) Downloaded file size (f’)

3) Current download speed (s)

A naive time-remaining calculation would be (f-f’)/(s), but this value is way-to-shaky (6m remaining / 2h remaining / 5m remaining! deja vu?! 🙂

Would there be a calculation which is both stabler and not extremely wrong (showing 1h even when the download is about to complete)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T23:49:47+00:00Added an answer on May 12, 2026 at 11:49 pm

    We solved a similar problem in the following way. We weren’t interested in how fast the download was over the entire time, just roughly how long it was expected to take based on recent activity but, as you say, not so recent that the figures would be jumping all over the place.

    The reason we weren’t interested in the entire time frame was that a download could so 1M/s for half an hour then switch up to 10M/s for the next ten minutes. That first half hour will drag down the average speed quite severely, despite the fact that you’re now honkin’ along at quite a pace.

    We created a circular buffer with each cell holding the amount downloaded in a 1-second period. The circular buffer size was 300, allowing for 5 minutes of historical data, and every cell was initialized to zero.

    We also maintained a total (the sum of all entries in the buffer, so also initially zero) and the count (zero, obviously).

    Every second, we would figure out how much data had been downloaded since the last second and then:

    • subtract the current cell from the total.
    • put the current figure into that cell and advance the cell pointer.
    • add that current figure to the total.
    • increase the count if it wasn’t already 300.
    • update the figure displayed to the user, based on total / count.

    Basically, in pseudo-code:

    def init (sz):
        buffer = new int[sz]
        for i = 0 to sz - 1:
            buffer[i] = 0 
        total = 0
        count = 0
        index = 0
        maxsz = sz
    
    def update (kbps):
        total = total - buffer[index] + kbps
        buffer[index] = kbps
        index = (index + 1) % maxsz
        if count < maxsz:
            count = count + 1
        return total / count
    

    You can change your resolution (1 second) and history (300) to suit your situation but we found 5 minutes was more than long enough that it smoothed out the irregularities but still gradually adjusted to more permanent changes in a timely fashion.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

To redirect (and append) stdout and stderr to a file, while also displaying it
I have a webpage with a report that is paginated while displaying on the
I have an image which has a slight border on corners. While displaying this
I have following css code for layout. td img {display: block;} While displaying images
how to change the output encoding, while displaying a file through php
I Have a string in the form 123456789. While displaying it on the screen
I'd like to have the matplotlib show command return to the command line while
I have a ListView that is displaying images downloaded from the internet. My UI
I want to add attributes (like Browsable(false)) dynamically while displaying in the grid. Scenario
Uploading and downloading a file is easy enough. Doing so while displaying progress and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.