We recommend using Visual Studio 2017

Detach

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Detach.

The VSPerfCmd.exe Detach option disconnects the profiler fromthe specified processes or all processes if none are specifed. Profiling must have been initialized by using the sampling method.

Profiling that was started with either the Launch or the Attach options can be disconnected with Detach. The profiler can be reattched by using subsequent Attach commands.

Detach does not close the profiling data file. Use the Shutdown option to end profiling and close the data file.

System_CAPS_ICON_note.jpg Note

If the Start option was specified with the Crosssession option, any calls to VSPerfCmd /Attach or to VSPerfCmd /Detach must also specify Crosssession.

VSPerfCmd.exe /Detach[:PIDs|ProcessNames]  

Parameters

PIDs|ProcessNames
PID - The numeric system identifer of one or more processes.

ProcessNames - the name of the process. If multiple instances of the named process are running, results are unpredictable.

Separate multiple processes with commas.

If no process is specified, the profiler is detached from all profiled process.

The following VSPerfCmd options can be combined with the Attach option on a single command line.

Crosssession
Enables profiling applications in sessions other than the logon session. Required if the Start option was specified with the Crosssession option.

In this example, the Detach command suspends profiling and the Shutdown command closes the profiler data file.

VSPerfCmd.exe /Start:Sample /Output:TestApp.exe.vsp  
VSPerfCmd.exe /Launch:TestApp.exe  
;REM Excercise the application  
VSPerfCmd.exe /Detach  
VSPerfCmd.exe /Shutdown  

VSPerfCmd
Profiling Stand-Alone Applications
Profiling ASP.NET Web Applications
Profiling Services

Show: