Search code examples
c#.netjetbrains-idedottrace

dotTrace: Who's calling my method?


I'm using dotTrace to profile a compiler that's having some performance issues. Being a compiler, the call stack is heavily recursive, and folding in call tree view just tends to make things even more confusing more often than not.

When I sort the Plain List view by Own Time, I find that a certain method is using a large amount of the run time. Looking at the code, there isn't much I can do to make that method faster, but I believe that adding some memoization could make it so it doesn't need to be called nearly as often. The problem is, I'm having a heck of a time figuring out where to add it.

When you click on a method in the top pane in Plain List view, it shows methods that this method calls in the bottom pane, which is kind of useful, but as near as I can tell it doesn't give you the far more useful information of what methods are calling this method. Is there any way to get statistical information on that, so I know where to focus on adding memoization?


Solution

  • In the plain list view of the All Calls tab just right click on your method and select Open Current Method Instance (or select the method and press CTRL+T). This opens a new tab for your method in dotTrace.

    In this new tab click on the Backtrace view on the left side to see all calls to that method.