| Author |
Message |
gsmalter
Joined: 04 Nov 2009 Posts: 6
|
Posted: Wed Nov 04, 2009 1:17 am Post subject: Having difficulty seeing what's important |
|
|
When working with code that uses anonymous methods or lambda expressions to wrap blocks of code, it is difficult to see what the problem spots are when profiling because these methods tend to make everything else look unimportant.
For example, if you have code like...
AppTools.ExecuteWithStandardExceptionHandling( delegate {
// Basically the entire program
}; );
.. where ExecuteWithStandardExceptionHandling is a simple method that does a try/catch and emails errors to developers in the case of an unhandled exception, the profiler makes it look like 99% of your processing power gets spent on ExecuteWithStandardExceptionHandling. This is technically true, but it's really not useful. Yes, the whole program executes inside it, but it spends almost no (usually, none) time running its own error emailing code - it's just running the code inside it.
So, everything the profiler is telling me is technically correct, and I can track down specific pieces of my "actual" code and see how many milliseconds it is consuming, but it is very difficult to quickly identify trouble spots when there are these wrapping methods hogging the charts.
Is there any way around this? Thank you. |
|
| Back to top |
|
 |
Chris.Allen
Joined: 12 Mar 2009 Posts: 443
|
Posted: Thu Nov 05, 2009 1:07 pm Post subject: |
|
|
Just a very quick check- are you using "line level" mode of profiling (most detail)?
(I think the problem is actually deeper than this so I'll check with the developer but I just thought I'd ask this one  |
|
| Back to top |
|
 |
gsmalter
Joined: 04 Nov 2009 Posts: 6
|
Posted: Thu Nov 05, 2009 3:40 pm Post subject: Defaults |
|
|
| I am using the defaults. So, Line-level and method-level timings; only methods with source (detailed), for the setting you are talking about, I think. |
|
| Back to top |
|
 |
Chris.Allen
Joined: 12 Mar 2009 Posts: 443
|
Posted: Fri Nov 06, 2009 12:21 pm Post subject: |
|
|
| Can you post a screenshot of what the results look like in the source code view please (wth line-level timings). |
|
| Back to top |
|
 |
gsmalter
Joined: 04 Nov 2009 Posts: 6
|
Posted: Fri Nov 06, 2009 3:39 pm Post subject: |
|
|
http://picasaweb.google.com/lh/photo/Xj6MjRTFAjbOGDg0Wa432Q?authkey=Gv1sRgCL2-vLHb2_mxEA&feat=directlink
Here's a view of the worst-offending single line of code I could find. It gets called 271 times, takes up 3.6 seconds of execution time cumulatively, and if were were to cache the result it would make for a big improvement. But look where it is in the big picture. It's like the 25th line in a list of methods that are mostly garbage. The methods above it include the ones that parse the command line arguments and invoke the operation, and methods that help you invoke a database operation.
I don't know how the profiler would know what methods I don't care about and which ones I do, and most of this problem is due to my lack of experience with the program, I'm sure. I'm just looking for ideas to help me find critical areas faster. I've had some luck sorting by Hit Count or Time rather than Time With Children.
The only thing that strikes me as outright wrong in this picture is that you'll notice the chart above shows Time With Children as 944ms, while the line in the code shows the time as 3,681. I'm not sure what's causing the difference there.
Thanks.
Last edited by gsmalter on Fri Nov 06, 2009 4:22 pm; edited 1 time in total |
|
| Back to top |
|
 |
StephenC
Joined: 15 Oct 2007 Posts: 314 Location: Cambridge
|
Posted: Fri Nov 06, 2009 3:58 pm Post subject: |
|
|
Hi,
I can't seem to access the image. Could you check the URL.
Thanks,
Stephen |
|
| Back to top |
|
 |
gsmalter
Joined: 04 Nov 2009 Posts: 6
|
Posted: Fri Nov 06, 2009 4:23 pm Post subject: |
|
|
| Picasa sucks. Try again. |
|
| Back to top |
|
 |
Chris.Allen
Joined: 12 Mar 2009 Posts: 443
|
Posted: Tue Nov 10, 2009 9:12 pm Post subject: |
|
|
| Yes- I see what you mean, when represented in the methods view grod, its only claiming 3.6 milliseconds but in the source code view its 3.6 seconds. This is rather odd, is it easily reproducible? |
|
| Back to top |
|
 |
gsmalter
Joined: 04 Nov 2009 Posts: 6
|
Posted: Tue Nov 10, 2009 9:59 pm Post subject: |
|
|
| I don't think it's as simple as it being off by a factor of 1000. But, regardless, this actually isn't central to the problem. There are other cases where the time is accurate but the fact remains that it is hard to sift through a dozen meaningless methods to find the real performance bottlenecks in the system. |
|
| Back to top |
|
 |
Brian Donahue
Joined: 23 Aug 2004 Posts: 6346 Location: Red Gate Software
|
Posted: Fri Nov 20, 2009 6:09 pm Post subject: |
|
|
Hello,
I got some information earlier in the week that the source code view does not employ the ANTS Performance Profiler's overhead compensation. If you "disable overhead compensation" in the options, you should notice that the source and grid times match up. _________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|
| Back to top |
|
 |
Chris.Allen
Joined: 12 Mar 2009 Posts: 443
|
Posted: Tue Dec 15, 2009 5:25 pm Post subject: |
|
|
| We've acknowledged this as a UI bug (PP-895) and will hopefully enhance the presentation of such data in the next version. |
|
| Back to top |
|
 |
|