Robonglious Posted June 28, 2012 Share Posted June 28, 2012 (edited) I'm having some real trouble getting my speed test to work. All I want to do is download/upload a file and time how long it takes. Seems easy but it just isn't working. Am I supposed to release Timerinit()? Do I keep adding to the same variable somehow? That's really what it looks like is happening but I'm pretty new to this. $DownTime = TimerInit() FileCopy("data1FrontUtilitytestfilerandom.jpg","c:testfile.jpg",1) $DownTimeEnd = TimerDiff($DownTime) $PreRound = TimerDiff($DownTimeEnd / 1000) $DSpeed = Round($PreRound,2) $UptTime = TimerInit() FileCopy("c:testfile.jpg","data1FrontUtilitytestfileuser.jpg",1) $UptTimeEnd = Round(TimerDiff($UptTime / 1000),2) ; Is this too many things to do at once?? FileDelete("data1FrontUtilitytestfileuser.jpg") MsgBox(1,"Down " & $DSpeed, "Up " & $UptTimeEnd) I'm really banging my head against the wall on this. I had a different version that also worked ok but certainly better than the upper code did. The upper solution is a much better solution if it would work. Local $begin = TimerInit() Local $hDownload = InetGet("http://upload.wikimedia.org/wikipedia/en/2/2f/EN004_Moon_with_a_Past.jpg", @TempDir & "Moon.jpg", 1, 0) $EndCount = TimerDiff($begin / 1000) $hDownloadSize = InetGetSize("http://upload.wikimedia.org/wikipedia/en/2/2f/EN004_Moon_with_a_Past.jpg", 1) $avg = ($hDownloadSize / ($EndCount / 1000)) Local $nBytes = InetGetInfo($hDownload, 0) InetClose($hDownload) ; Close the handle to release resources. FileWrite($file, "Bytes read: " & (Round(($hDownloadSize / 1024), 2)) & "KB" & " , at " & Round($avg, 2) & "MB per second" & @CRLF) Edited June 28, 2012 by Robonglious Link to comment Share on other sites More sharing options...
Malkey Posted June 29, 2012 Share Posted June 29, 2012 I'm having some real trouble getting my speed test to work. All I want to do is download/upload a file and time how long it takes. Seems easy but it just isn't working. Am I supposed to release Timerinit()? Do I keep adding to the same variable somehow? That's really what it looks like is happening but I'm pretty new to this. $DownTime = TimerInit() FileCopy("\\data1\Front\Utility\test\file\random.jpg","c:\test\file.jpg",1) $DownTimeEnd = TimerDiff($DownTime) $PreRound = TimerDiff($DownTimeEnd / 1000) $DSpeed = Round($PreRound,2) $UptTime = TimerInit() FileCopy("c:\test\file.jpg","\\data1\Front\Utility\test\file\user.jpg",1) $UptTimeEnd = Round(TimerDiff($UptTime / 1000),2) ; Is this too many things to do at once?? FileDelete("\\data1\Front\Utility\test\file\user.jpg") MsgBox(1,"Down " & $DSpeed, "Up " & $UptTimeEnd) I'm really banging my head against the wall on this. I had a different version that also worked ok but certainly better than the upper code did. The upper solution is a much better solution if it would work. Local $begin = TimerInit() Local $hDownload = InetGet("http://upload.wikimedia.org/wikipedia/en/2/2f/EN004_Moon_with_a_Past.jpg", @TempDir & "\Moon.jpg", 1, 0) $EndCount = TimerDiff($begin / 1000) $hDownloadSize = InetGetSize("http://upload.wikimedia.org/wikipedia/en/2/2f/EN004_Moon_with_a_Past.jpg", 1) $avg = ($hDownloadSize / ($EndCount / 1000)) Local $nBytes = InetGetInfo($hDownload, 0) InetClose($hDownload) ; Close the handle to release resources. FileWrite($file, "Bytes read: " & (Round(($hDownloadSize / 1024), 2)) & "KB" & " , at " & Round($avg, 2) & "MB per second" & @CRLF) See TimerDiff function in AutoIt help file. Dividing the handle parameter by 1000 is wrong. Link to comment Share on other sites More sharing options...
Robonglious Posted June 29, 2012 Author Share Posted June 29, 2012 Excellent, I did read the help file many times but didn't realize what was actually happening. Thank you! Link to comment Share on other sites More sharing options...
Robonglious Posted July 9, 2012 Author Share Posted July 9, 2012 (edited) It still doesn't work very well. I've changed the code around a few times but I've probably just made another mistake. Most of the time the result of the web lookup is zero, other times the result is way too fast or slow. You won't be able to run this code but any help would be very helpful. This code should have three tests, one internet download test, one network file download test and one network upload test. ;internet download test $begin = TimerInit() $hDownload = InetGet("https://*****.com/Office%20Listing/Corporate%20Directory/Corporate%20Directory%202012.xls", "c:filespackages.xls", 1, 0) $EndCount = TimerDiff($begin) $hDownloadSize = FileGetSize("c:filespackages.xls") FileDelete("c:filespackages.xls") $EndCountSec = $EndCount / 1000 $avg = (($hDownloadSize / 1024) / $EndCountSec) InetClose($hDownload) GUICtrlSetData($Progress1, ($i / $Time) * 100) ;network download test $DownTime = TimerInit() FileCopy("data1FrontUtilitytestfilerandom.jpg", "c:filesfile.jpg", 1) $DownTimeEnd = TimerDiff($DownTime) $hData1DLS = FileGetSize("c:filesfile.jpg") $hDataKB = $hData1DLS / 1024 $PreRound = $DownTimeEnd / 1000 $DSpeed = Round($PreRound, 2) ;network upload test $UpTime = TimerInit() FileCopy("c:filesfile.jpg", "data1FrontUtilitytestfileuser" & $Ran & ".jpg", 1) $UptTimeEnd = TimerDiff($UpTime) $PreRoundUp = $UptTimeEnd / 1000 $UPSpeed = Round($PreRoundUp, 2) FileDelete("data1FrontUtilitytestfileuser" & $Ran & ".jpg") Edited July 9, 2012 by Robonglious Link to comment Share on other sites More sharing options...
yupepa Posted July 11, 2012 Share Posted July 11, 2012 What is the OS and BS where you run the script? Did you measure the time manually? I have a similar problem, see 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