Jump to content
Sign in to follow this  

Average Download Speed "Sampled Method"

Recommended Posts


I saw your comment about this on the Rapid Queuer post, and followed it here. If you want the true average since the download started, rather than for the last second or several seconds, I suggest the following:

ProgressOn("Testing", "Test", "Test", 1, 1, 16)
$iSize = InetGetSize("http://releases.ubuntu.com/jaunty/ubuntu-9.04-desktop-i386.iso")
InetGet("http://releases.ubuntu.com/jaunty/ubuntu-9.04-desktop-i386.iso", "ubuntu-9.04-desktop-i386.iso", 1, 1)

Func DownloadProcess($iSize)
    $Timer = TimerInit()
    While @InetGetActive
        $iBytesRead = @InetGetBytesRead
        $iPercent = Int(($iBytesRead / $iSize) * 100)
        ProgressSet($iPercent, $iBytesRead & " bytes read or " & $iSize &@LF& Int($iBytesRead / (TimerDiff($Timer) / 1000) / 1000) & " KB/s" &@LF& "(" & StringLeft(TimerDiff($Timer) / 1000, 5) & " seconds)", "test")
EndFunc   ;==>DownloadProcess



Share this post

Link to post
Share on other sites

ello pinchly! :) yupp yours is good, but mines targeted towards a more random flow of data, by that i mean..if i used your example and I'm downloading a file that's 500mb, at 250mb i start another download and loose half of my speed or my computer locks up and reports inaccurate speeds, that will throw off the accuracy of average in your script for the whole download process, using my method would trow it off for a couple of seconds until it fully recovers. Any "estimated time to finish" of such a file wouldn't be affected.

In an optimal transfer your script would be more accurate then mine, Increasing the size of stored speeds in my array increases the accuracy but lowers the speed and recovery rate from a possible speed disturbance.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this