3

Occasionally when investigating SQL Server issues I find it useful to be able to attach the Visual Studio debugger to it and try and figure out what it is doing by looking at the call stack (the public symbols are available and often it is possible to infer useful information from the method names).

A great example of the type of internals information that can be inferred is in this blog post which inspired my attempts.

This can be quite a time consuming and tedious process however. Generally I run the code of interest in a loop attach the debugger then continually break and continue until I hit a call stack that looks interesting to the matter under investigation. I can then step through the code and look at the method names being called. This takes ages however.

Is there any way of automating this so I can simply log all the methods called for a short period then review the log file afterwards?

2 Answers 2

3

If I am not mistaken, you're probably looking for Process Monitor (a.k.a. procmon). You can get it from this Microsoft website.

Specifically the "Stack Summary" menu option has this kind of information. More details in section PM2-6: Unrolling the stack

enter image description here

3
  • 1
    How about Process Explorer, much more powerful...technet.microsoft.com/en-us/sysinternals/bb896653
    – Moab
    Apr 30, 2012 at 0:10
  • 1
    @Moab - AFAIK Process Explorer can load the public symbols from the MS symbol server and show the current call stack but has no capabilities to log calls over time? Apr 30, 2012 at 6:31
  • @MartinSmith not sure, I am not an expert in using that software unfortunately.
    – Moab
    Apr 30, 2012 at 13:58
2

The profiler in higher versions of Visual Studio can be used to do this.

Example Output

Screenshot

(And the answer here shows why this is useful)

Or additionally the Windows Performance Toolkit is free and can also do much the same and more. A good series of videos on this can be found at https://channel9.msdn.com/Search?term=Defrag%20tools%20wpt#ch9Search

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .