Skip to content

Profiler: Tracing

lordmilko edited this page Mar 2, 2023 · 9 revisions

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.

Normal Trace

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

Watch Trace

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 Find-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

Project Overview

User Guide

Clone this wiki locally