Reputation: 63815
commonly on say PHP or other web frameworks getting the total response time is easy, just start the timer at the top of the file and stop it at the end.
In ASP.Net there is the whole Page Lifecycle bit though so I'm not sure how to do this. I would like for this response time recording to take place in a master page and the response time show up in the footer of pages. What would be the best way of doing this? Is there something built in to ASP.Net for it? Is it even possible to include the OnRender time?
Upvotes: 3
Views: 3341
Reputation: 41823
If you're running Visual Studio Team System (perhaps other versions too now) you can also use the Visual Studio Profiler (http://msdn.microsoft.com/en-us/magazine/cc337887.aspx) to profile what is taking the most time.
Upvotes: 0
Reputation: 5048
You can either use
Some information available at:
Measure ASP.NET page load time
Upvotes: 2
Reputation: 2101
You can do it on the Global.asax, take a look at this article
void Application_BeginRequest(object sender, EventArgs e)
{
HttpContext.Current.Items["renderStartTime"] = DateTime.Now;
}
void Application_EndRequest(object sender, EventArgs e)
{
DateTime start = (DateTime) HttpContext.Current.Items["renderStartTime"];
TimeSpan renderTime = DateTime.Now - start;
HttpContext.Current.Response.Write("<!-- Render Time: " + renderTime + " -->");
}
Upvotes: 5