By
- starting a timer
- downloading a resource
- stopping the timer
- dividing (stopTime-startTime) by numOfBytes in resource
E.g
start timer - 18:47.00
download http://www.codeproject.com/Questions/440219/show-speed-of-internet-in-graphical-page - 105kb
stop timer - 18:47.01
Speed of _this_ download = 105kb / (18:47.01 - 18:47.00)
= 105kb / 1second
= 105kb/s
Just do this a couple of times for different resources then tally the results
avgSpeed(kb/s) = (size of totalDownloads kb) / (time of downloads s)
Then, you simply graph the result(s)