-
Notifications
You must be signed in to change notification settings - Fork 0
Profiler: Tracing
Once a process containing the DebugTools Profiler has been launched, it will constantly report key events (such as module loads and method JITs) to the profiler controller. In order to actually capture frame data however you need to run a trace. There are several ways to start a trace.
Regardless of how the trace is started, to stop collecting frames, press Ctrl+C
in the profiler controller PowerShell prompt.
By default, the DebugTools Profiler will only capture the name of each method frame that is called. In order to capture method parameters and return values, detailed profiling must be enabled. Detailed profiling can only be specified prior to process startup. If a process is launched without detailed profiling, it will need to be relaunched with detailed profiling enabled in order to capture this additional information.
When -TraceStart
is specified to Start-DbgProfiler
, all managed frames will be reported to the profiler controller immediately from process startup.
Start-DbgProfiler powershell -TraceStart
A trace can also be started after the process has initialized using the Trace-DbgProfilerStack
cmdlet
C:\> Trace-DbgProfilerStack
By default, DebugTools will use ETW for achieving high performance communication between the profiler controller and the target process. Due to the asynchronous nature of ETW however, when too many events are being generated this may lead to events being dropped (and an exception being thrown by DebugTools). For more information, and how to potentially workaround such issues, please see Troubleshooting.
In both of the above cases, you don't have any visibility into the frames that are being recorded until after you stop the collection and start analyzing the returned results. However, it is also possible to watch frames stream in in real time using the Watch-DbgProfilerStack
cmdlet.
Watch-DbgProfilerStack
allows specifying all of the same parameters that can be specified to Get-DbgProfilerStackFrame
and Show-DbgProfilerStackTrace
. This allows you to filter the frames displayed to just those that match a specific set of criteria.
# Display all frames that are passed the string value "gci"
Watch-DbgProfilerStack -StringValue gci