Jump to content

Bandwidth calculation script Please help


jeet_0077

Recommended Posts

i suppose in javascript you could make a function that sets a var with the current time (to the millisecond) then load an image (of which you know the size) and thenuse an onload() to record the time it finished loading.  with a little math you could figure out how long it takes per byte to download.

Link to comment
Share on other sites

Thanks for the idea,

I made something like this. Does this make sense?

 

<script type="text/javascript">

var began_loading = (new Date()).getTime();

function done_loading() {

new Image().src = 'images/loading_test.JPG';

var end_loading; 

  end_loading= (((new Date()).getTime() - began_loading) / 1000);

  alert("395 Bytes/"+end_loading+" sec");

}

</script>

</head>

<body onload="done_loading()">

</body>

Link to comment
Share on other sites

Hi All,

I have written the script with jquery to load a known size file and on request complete calculated the time difference just as loading an image as before.

 

Till this it works fine. Now I am getting like

 

6.4 mb file is getting loaded between ajax request and request complete as 0.278 secs.

 

which means the bandwidth is 6.4/0.278 = (approx) 23mbps.

 

Is my calculation is correct. If not please advice

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.