How can I trace/profile a process in Windows?

5,305

Solution 1

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

Solution 2

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

Share:
5,305

Related videos on Youtube

Nikita Chernykh
Author by

Nikita Chernykh

Updated on September 18, 2022

Comments

  • Nikita Chernykh
    Nikita Chernykh over 1 year

    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?

  • Moab
    Moab about 12 years
    How about Process Explorer, much more powerful...technet.microsoft.com/en-us/sysinternals/bb896653
  • Nikita Chernykh
    Nikita Chernykh about 12 years
    @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?
  • Moab
    Moab about 12 years
    @MartinSmith not sure, I am not an expert in using that software unfortunately.