Can someone check this calculation?
I want to calculate the speed of my internet connection by downloading a file from a remote server.
My time unit is in 1/60th of a second. Let's say the file on the remote server is 32K.
timeBegin = ticks <- 1/60th of a second since beginning of some date
get.url( file ) timeEnd = ticksMbps = ( size of file * 8) / ( timeEnd - timeBegin ) / 60 / 1048576
Does anyone know of a way to test bandwid开发者_StackOverflow中文版th (upload/download) from the command line (unix)?
Don't know the exact command off the top to do what you want. But, you may not get a very accurate reading of your internet BW based on this test.
There are 2 issues I see:
1) You could be limited by latency. Download time is a factor of both latency (the amount of time for a packet to do a round trip between source and destination) and BW.
2) The server and not you may have limited BW.
You probably can get a more accurate number by checking out sights like this: speakeasy
Your calculation is not quite correct, you are missing some parentheses.
Mbps = ( size of file * 8) / ( ( timeEnd - timeBegin ) / 60 ) / 1048576
I see DasBoot already pointed out some of the potential sources of inaccuracy in this method. I'll just add to #2 that the critical bandwidth limitation may also exist at some hop in between you and the server.
One way I use to check "bandwidth" between servers is to look at the results from scp between remote and local (and vice versa). You could also consider using a large file like 30-40MB... Another way is to use the wget command which show the speed of download too (like 1Mb/s)
hope it helps
Try to use IPTRAF to monitor it.
精彩评论