Abhishek B.
Abhishek B.

Reputation: 5202

How to calculate load time of Asp.net page using Jquery/Javascript?

I am developing one web application in that I want to check load time of each and every page or controls load time..

How much time taken to load whole page contents?
I want to calculate asp.net page load Time in Micro second/Second,

How can I know using Javascript/Jquery ?

Upvotes: 1

Views: 3193

Answers (2)

Pranay Rana
Pranay Rana

Reputation: 176956

Following script help you;

<SCRIPT LANGUAGE="JavaScript">
//calculate the time before calling the function in window.onload
beforeload = (new Date()).getTime();
function pageloadingtime()
{

     //calculate the current time in afterload 
    afterload = (new Date()).getTime();
     // now use the beforeload and afterload to calculate the seconds
    secondes = (afterload-beforeload)/1000;
     // If necessary update in window.status
    window.status='You Page Load took  ' + secondes + ' seconde(s).';
     // Place the seconds in the innerHTML to show the results
    document.getElementById("loadingtime").innerHTML = "<font color='red'>(You Page Load took " + secondes + " seconde(s).)</font>";

}

window.onload = pageloadingtime;
</SCRIPT>

Ref from : http://www.dreamincode.net/code/snippet1908.htm

or

If you just want to check the time make use of Firebug of firefox which display excution time. Something like this enter image description here

Upvotes: 5

Paddy
Paddy

Reputation: 33867

Developed by the good people at stackoverflow - handy little profiling tool - may work for you:

http://code.google.com/p/mvc-mini-profiler/

Upvotes: 1

Related Questions