How to: Attach and Detach Performance Tools to Running Processes

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

The profiler can be used to attach to or detach from a running process to make sampling and gathering performance data easier. You can use this method to profile a process when you want to avoid gathering data about application load time, or to monitor the performance of a process after it reaches a specific state.

Note

The following steps apply to attaching and detaching processes from within the Visual Studio integrated development environmnent (IDE). For information about how to use command line tools, see Profiling from the Command-Line. For information about how to profile services, see Profiling Services.

The processes that are available to profile depend on the User Access Permissions that are set by an administrator of the computer. A User account may, for example, have permission for any of the following:

  • Advanced profiling features, when the administrator has set the driver and service to start.

  • Sample profiling only (domain users).

  • Deny access to profiling to everybody.

    For more information, see Profiling and Windows Vista Security and the ADMIN options in VSPerfCmd.

To attach to a running process

  1. On the Analyze menu, point to Profiler and then click Attach/Detach.

    - or -

    In Performance Explorer, right-click the performance session, and then click Attach/Detach.

    The Attach Profiler to Process dialog box appears.

  2. Click the name of the process that you want to attach to.

  3. Click Attach.

To detach from a running process

  1. On the Analyze menu, point to Profiler and then click Attach/Detach.

    - or -

    In Performance Explorer, right-click the performance session, and then click Attach/Detach.

    The Attach Profiler to Process dialog box appears.

  2. Click the image name from which you want to detach.

  3. Click Detach.

See Also

Controlling Data Collection
Performance Session Overview
How to: Start and End Performance Data Collection
Profiling and Windows Vista Security
VSPerfCmd