Reputation: 10959
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:
$(document).ready()
to fire off an AJAX call to a WebMethod that returns the server's date and time.span
element on the page.I do this so I can keep the client datetime in sync with the server datetime due to the fact that someone's machine time can easily be off by a few seconds. However, I think that AJAX call adds a little overhead itself which is counterproductive to performance measurement.
Is there an accurate method of using GMT to sync up the client time with the server time without having to report to the server to get it?
Upvotes: 1
Views: 436
Reputation: 13990
About the server side, you can set Trace=true in Page directive
http://msdn.microsoft.com/en-us/library/94c55d08(v=vs.100).aspx
Upvotes: 0