CoderBlog.NET
Tengiz Tutisani's blog.

 
Useful Links:
 
LanguageBox 
 
Language

 
SearchBox 
 
 
ArchiveBox 
 
Archive
<February 2012>
SuMoTuWeThFrSa
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910
 
CategoriesBox 
 
Categories
  ASP.NET (5)
  Ajax (1)
  C# (7)
  Common (1)
  HTML (3)
  JavaScript (5)
  Products (1)
  SEO (1)
  SQL (1)
  Visual Studio (1)
  Windows (1)
 
FriendSitesBox 
 
Friend Sites
  AdMoney Project
  Cайт о гитаре и музыке!
  Design Studio IMAGINE
 
CustomContentBox [1] 
 



 
 
How to calculate estimated time left for some operation to complete?
Interesting question
Posted By:   tengo
At:   5/7/2009 10:55:00 AM
 

You might have seen the download dialog of windows, which informs about the download progress as well as the estimated time left to complete the download.
How would you calculate that time?
I would do it like this:

During the download progress, the full size of the file downloaded is known of course. Download is done package by package. Package is a small part of the full file.
So, when the package arrives, we can find out the size of the package. Of course getting the package takes some amount of time, as the download is done through internet network and depends on the speed and other factors.
When starting getting the next package you should somehow save the time when this particular operation started, and when the package is already on our side of the wire, you should check how long have you been waiting for the package to arrive. In other words, using the size of package and the time you can calculate the current download speed (which, in fact, changes during the download).
For example: package size = 4kb, time used = 1 second.
So, the speed is 4 kb per second, or 1 kb per 0.25 seconds.
So, the only thing you must calculate is how much kb-s you have left to download. That means the estimated time will be 0.25 seconds multiplied by the size in kilobytes of the download resource.

If I would have to create a download manager, this information would be a little useful for me.

And, as an answer to the title, I must say, if given the whole amount of operation, and it can be divided approximately in the same size of sub-operations, this way we can calculate the estimated time left for any operation to complete.


Filed Under:   Common |
Post Tags:   complete | download | estimate | manager | operation | resource | time |
  Comments [0]



 

 

Add Your Comment
Note: The comment will be shown only after an Administrator Approval.
Your name:
URL:
Your comment:
Enter the code:

 
CustomContentBox [2] 
 
Useful Links:
 
CategoryViewBox 
 
CoderBlog.NET
  Get your own Blog Engine
  SMS Sending Service
  What do you want to see on CoderBlog.NET?
  IMAGINE.GE created a header image for CoderBlog.NET
  CoderBlog.NET offers link exchange
  Quick language selection added
  CoderBlog.NET ‘s what is what
  Welcome to CoderBlog.NET

  Jump to Category...
 
TagsBox 
 
Popular Tags
aspnetblogcsharpdesigndivengineerrorformhtmljavascript
 
AuthorsBox 
 
Authors
  Tengiz Tutisani  (25)
 
SubscriptionsBox 
 
Subscriptions
Your Email:
 
LoginStatusBox 
 
Site Members
Login
 
Copyright © 2009 . CoderBlog.NET