How can I most accurately calculate the execution time of an ASP.NET page while also displaying it o

Posted by henningst on Stack Overflow See other posts from Stack Overflow or by henningst
Published on 2010-03-23T14:19:39Z Indexed on 2010/03/23 14:23 UTC
Read the original article Hit count: 232

I want to calculate the execution time of my ASP.NET pages and display it on the page. Currently I'm calculating the execution time using a System.Diagnostics.Stopwatch and then store the value in a log database.

The stopwatch is started in OnInit and stopped in OnPreRenderComplete. This seems to be working quite fine, and it's giving a similar execution time as the one shown in the page trace.

The problem now is that I'm not able to display the execution time on the page because the stopwatch is stopped too late in the life cycle.

What is the best way to do this?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about Performance