GlobalOn and GlobalOff

 

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 GlobalOn and GlobalOff.

The VSPerfCmd.exe GlobalOff and GlobalOn options pause and resume profiling for all processes and threads in a command-line profiling session.

You can specify GlobalOn and GlobalOff as the only options in a VSPerfCmd.exe command line, or you can include them in command lines that also contain the Start, Launch, or Attach options.

GlobalOn and GlobalOff can also be combined with the ProcessOn, ProcessOff, ThreadOn, and ThreadOff options.

The GlobalOn and GlobalOff options interact with the ProcessOn and ProcessOff options that control data collection for a specified process, and with the ThreadOn and ThreadOff options that control data collection for a specified thread.

The GlobalOff and GlobalOn options also affect the Global Start/Stop count that is manipulated by the profiler's API functions.

  • GlobalOff immediately sets the Global Start/Stop Count to 0 and therefore pauses profiling.

  • GlobalOn immediately sets the Global Start/Stop Count to 1 and therefore resumes profiling.

For more information, see Profiling Tools APIs.

VSPerfCmd.exe /{GlobalOff|GlobalOn}  
  
VSPerfCmd.exe /Start:Method /{GlobalOff|GlobalOn} [Options]  
  
VSPerfCmd.exe {Launch:AppName|Attach:PID} /{GlobalOff|GlobalOn}[Options]  

Parameters

None

GlobalOn and GlobalOff can be specified on command lines that also contain the following options.

Start: Method
Initializes the command-line profiler session and sets the specified profiling method.

Launch: AppName
Starts the specified application and begins profiling with the sampling method.

Attach: PID
Begins profiling the specified process.

{ProcessOff|ProcessOn}:PID
Stops or starts profiling for the specified process.

{ThreadOff|ThreadOn}:TID
Stops or starts profiling for the specified process (instrumentation method only).

In this example, the GlobalOff and GlobalOn options are used to avoid collecting profiling data for application startup and shutdown.

; Initialize the profiler with profiling stopped.  
VSPerfCmd.exe /Start:Trace /Output:Instrument.vsp /GlobalOff  
; Start an instrumented application and wait for it to warm up.  
; Start profiling.  
VSPerfCmd.exe /GlobalOn  
; Exercise the application functionality that you want to profile.  
; Stop profiling.  
VSPerfCmd.exe /GlobalOff  
; Shut down the target application.  
; Close the profiler.  
VSPerfCmd /Shutdown  
  

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

Show: