views:

699

answers:

2

could anybody advice me, are there any approaches to calculate the methods execution time in asp.net page?

ASP.Net Trace doesn't suit me since it ignores ajax partial postbacks though just they are the tight place.

I have the page event which for some unknown reason executes slowly. Since the logic and event execution chain is rather complicated, I still unable to merely determine the culprit in debugger.

I'd like to measure the execution time of each method throughout the page, but I still see no way but insert redundant code lines (like timeBegin = DateTime.Now.... timeEnd=DateTime.Now = timeBegin etc) in the beginning and ending of each method. It seems to be ugly approach, does anybody know how to do it automatically? Are there tools which measure the methods execution time available?

A: 

This may not be what you are looking for, but RedGate has a product called Performance Profiler that does exactly that. They do have a 15 day trial so you can even download it and try it out on your current issue. IMHO, it's worth every penny.

hacker
thanks.but 'profile method-level performance' menu item causes message box 'The target of the active project is not an executable file. Choose a project that builds an executable program, or set an external program in the project settings.(the active project is my web application).So I don't know how to make it work.
Well, depending on where you are trying to run the project (IIS or Visual Studio Web), you can select a different option for where to have the profiler tie into the running app. I've been able to successfully debug both VS and IIS sites. Check out the demo videos as they will step you through how to do it.
hacker
A: 

You can use asp.net performance counters and other things also. But that will not measure a page speed but they will measure a over all application performance.

jalpesh