ProcessOn and ProcessOff

The VSPerfCmd.exe ProcessOff and ProcessOn optionoptions pause and resume profiling for the specified process in a command-line profiling session. ProcessOff stops profiling the process and ProcessOn starts profiling the process.

In most cases, you specify ProcessOn or ProcessOff as the only option in a VSPerfCmd.exe command line, but they can also be combined with the GlobalOn, GlobalOff, ThreadOn, and ThreadOff options.

The ProcessOn and ProcessOff options interact with the GlobalOn and GlobalOff options that control data collection for all processes in a command-line profiling session, and the ThreadOn and ThreadOff options that control data collection for a specified thread.

The ProcessOff and ProcessOn options also affect the Process Start/Stop count that is manipulated by profiler API functions.

  • ProcessOff immediately sets the Process Start/Stop Count to 0 and therefore halts profiling collection.

  • ProcessOn immediately sets the Process Start/Stop Count to 1 and therefore starts profiling collection.

For more information, see Profiling Tools APIs.

VSPerfCmd.exe /{ProcessOff|ProcessOn}:PID [Options]

Parameters

  • PID
    The integer identifier of the process to start or stop. Process IDs are listed on the Process tab of Windows Task Manager.

Required Options

None

Valid Options

ProcessOn and ProcessOff can be specified on command lines that also contain the following options.

  • **Start:**Method
    Initializes the command-line profiling 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.

  • GlobalOff|GlobalOn
    Stops or starts profiling for all processes in a command-line profiling session.

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

Example

In this example, the ProcessOff option is used to collect profiling data only for application startup.

; Initialize the profiler.
VSPerfCmd.exe /Start:Trace /Output:Instrument.vsp 
; Start the instrumented application.
; Stop profiling the process after startup.
VSPerfCmd.exe /ProcessOff:12345
; Shut down the target application.
; Close the profiler.
VSPerfCmd /Shutdown

See Also

Reference

VSPerfCmd

Other Resources

Command-Line Profiling of Stand-Alone Applications

Command-Line Profiling of ASP.NET Web Applications

Command-Line Profiling of Services