Reputation:
I ran the Visual Studio 2008 profiler against my ASP.NET application and came up with the following result set.
CURRENT FUNCTION TIME (msec)
---------------------------------------------------|--------------
Data.GetItem(params) | 10,158.12
---------------------------------------------------|--------------
Functions that were called by Data.GetItem(params) TIME (msec)
---------------------------------------------------|--------------
Model.GetSubItem(params) | 0.83
Model.GetSubItem2(params) | 0.77
Model.GetSubItem3(params) | 0.76
etc.
The issue I'm facing is that the sum of the Functions called by Data.GetItem(params) do not sum up to the 10,158.12 msec total. This would lead me to believe that the bulk of the time is actually spent executing the code within that method.
My question is ... does Visual Studio provide a way to analyze the method itself so I can see which sections of code are taking the longest? if it does not are there any recommended tools to do this? or should I start writing my own timing scripts?
Thank you
Upvotes: 0
Views: 722
Reputation: 1792
An another approach would be to break up your GetItem method into a number of smaller methods (perhaps doing a binary chop) to narrow down where the time is being spent. Probably easier than writing some timing scripts.
Upvotes: 0
Reputation: 40679
Don't concentrate on timing the code. That's the top-down approach.
Bottom-up is way more effective. This method works just fine in Visual Studio.
Upvotes: 0
Reputation: 707
The VS 2008 profiler does not support block level profiling, but I believe that Red Gate's profiler does.
Upvotes: 1