Visual Studio offers a choice of performance measurement and profiling
tools. Some tools, like CPU Usage and Memory Usage, can run with or without the
debugger, and on release or debug build configurations. Tools that appear in
the Diagnostics Tools window run only during a
debugging session. Tools that appear in the Performance Profiler run
without the debugger and you analyze the results after you choose to stop and
collect data (for post-mortem analysis).
You can use the non-debugger performance tools with Windows 7 and later. Windows 8 or later is required to run the debugger-integrated profiling tools.
The non-debugger Performance Profiler and the
debugger-integrated Diagnostic Tools provide different information and
experiences. Debugger-integrated tools show you variable values and let you use
breakpoints. Non-debugger tools give you results closer to the end-user
To help decide which tools and results to use,
consider the following:
tool vs. non-debugger tool
External performance problems, like file I/O or
network responsiveness issues, won't look much different in the debugger or
The debugger itself changes performance times,
as it does necessary debugger operations like intercepting exception and module
Release build performance numbers in the
Performance Profiler are the most precise and accurate. Debugger-integrated
tool results are most useful to compare with other debugging-related
measurements, or to use debugger features.
Some tools, such as the .NET Object Allocation
tool, are only available for non-debugger scenarios.
vs. release build
For problems caused by CPU-intensive calls,
there might be considerable performance differences between release and debug
builds. Check to see whether the issue exists in release builds.
If the problem occurs only during debug builds,
you probably don't need to run the non-debugger tools. For release build
problems, decide whether features provided by the debugger-integrated tools
will help to pinpoint the problem.
Release builds provide optimizations like
inlining function calls and constants, pruning unused code paths, and storing
variables in ways that can't be used by the debugger. Performance numbers in
the debug builds are less accurate, because debug builds lack these
Collect profiling data while
When you start debugging in Visual Studio by
selecting Debug > Start Debugging, or
Tools window appears by default. To open it manually, select Debug > Windows > Show Diagnostic Tools.
Tools window shows information about events, process memory, and
the Settings icon
in the toolbar to select whether to view Memory Usage, UI Analysis, and CPU Usage.
· Select Settings in
the Settings drop-down
list to open the Diagnostic
Tools Property Pages with more options.
you're running Visual Studio Enterprise, you can enable or disable IntelliTrace
by going to Tools > Options > IntelliTrace.
The diagnostic session ends when you stop debugging.
For more information, see:
The Events tab
During a debugging session, the Events tab of the
Diagnostic Tools window lists the diagnostic events that occur. The category
prefixes Breakpoint, File, and others, let
you quickly scan the list for a category, or skip the categories you don't care
Use the Filter drop-down list to filter events in
and out of view, by selecting or clearing specific categories of events.
Use the search box to find a specific string in the
event list. Here are the results of a search for the string name that matched
For more information, see Searching and filtering the Events tab of the Diagnostic
Collect profiling data without
To collect performance data without debugging, you
can run the Performance Profiler tools.
a project open in Visual Studio, set the solution configuration to Release, and
Windows Debugger (or Local Machine) as the deployment target.
2. Select Debug > Performance Profiler,
or press Alt+F2.
the diagnostic tools launch page, select one or more tools to run. Only the
tools that are applicable to the project type, operating system, and
programming language are shown. Select Show all tools to also see tools that are
disabled for this diagnostic session.
start the diagnostic session, select Start.
While the session is running,
some tools show graphs of real-time data on the diagnostic tools page, as well
as controls to pause and resume data collection.
end the diagnostic session, select Stop Collection.
The analyzed data appears on
the Report page.
You can save the reports, and open them from the Recently Opened Sessions list
on the Diagnostic Tools launch page.
For more information, see:
Collect profiling data from the
To measure performance data from the command line,
you can use VSDiagnostics.exe, which is included with either Visual Studio or
the Remote Tools. This is useful for capturing performance traces on systems
where Visual Studio isn't installed, or for scripting the collection of
performance traces. For detailed instructions, see Measure application performance from the command line.