tags:

views:

370

answers:

3

What is the easiest way to monitor how long it is taking to render my asp.net pages (I'm using webforms still if it matters)?

I know that the page lifecycle is pretty involved, but I'm basically just looking for one number that tells me how long my code took to run and to display that at the bottom (or wherever) of the page.

Edit

Several people have mentioned the asp.net trace config, which is awesome and I'm not sure how I missed it. The one thing I am still looking for is how to output just the final render time: ie

Response.Write(Context.Trace.FinalRenderTimeFromFirst)

But I can't figure out how to inspect the contents of the trace element.

+1  A: 

You want to enable tracing.

From The Basics of .NET Tracing:

[M]odify the trace element in web.config as follows:

<trace enabled="true" .../>

Andrew Hare
And if you use this config, you'll be able to find your results by going to http://YOUR_APP_ROOT/trace.axd
Dillie-O
+1  A: 

put trace=true in the first line of you .aspx file and use response.trace("") in your code behind to add additonal information to it.

Middletone
+1  A: 

I use Fiddler (http://www.fiddler2.com/Fiddler2/version.asp) for such things. It's not specific for ASP.NET, but it will break down your page as it get rendered to the client, and show the amount of time it took to load each piece of your page as it comes in to the browser.

Hope this helps!

Adam McKee