Datenshi Posted August 24, 2009 Share Posted August 24, 2009 Calculation for the Moving Average transfer speed. It calculates the average of speed samples taken approx over the last 5 seconds. #include <Array.au3> Func MovingAverage() ; updates stats during download Dim $SpeedSamples[5] $Accuracytimer = timerInit() ; for first loop While @InetGetActive $CalcAverage = 0 $BytesRead1 = @InetGetBytesRead Sleep(1000) $BytesRead2 = @InetGetBytesRead _ArrayPush($SpeedSamples,Int($BytesRead2 - $BytesRead1)*(TimerDiff($Accuracytimer)/1000)) $Accuracytimer = timerInit() $Ubound = Ubound($SpeedSamples) -1 For $x = 0 To $Ubound $CalcAverage += $SpeedSamples[$x] Next $CalcAverage = $CalcAverage/$Ubound $AverageSpeed = Int($CalcAverage/1024) ConsoleWrite($AverageSpeed&" kb/s"&@CRLF) WEnd EndFunc RapidQueuer 2.4 - For Rapidshare.comOpensubtitles Hashing FuncRevision3 PlayerGTPlayer BetaIMDB & Poster Grabber v1.3Fetgrek.com - My Website Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now