brutusvimes
New Member
I am measuring performance of an ASP.NET page. I need to measurement two parts: 1) The server page load time (to calculate the time it takes to bind controls from data loaded from database) and 2) measure the difference between the millisecond that the server's PageLoad event started and the millisecond that the client has finished loading (because I want to be able to calculate the time it took for the client browser to download and render the HTML).Measuring the serverside load time is easy with the StopWatch class. The part I need advice for is capturing the date and time that the client has loaded.Here's what I am doing in this order:
- As soon as server page load event runs, I write the current date and time to a hidden field.
- On the client, I use \[code\]$(document).ready()\[/code\] to fire off an AJAX call to a WebMethod that returns the server's date and time.
- I then parse the dates and times from the date string stored in the hidden field and the date string returned from the Webmethod call and write their differences to a \[code\]span\[/code\] element on the page.