VSPerfCmd

The VSPerfCmd.exe tool is used to start and stop performance data collection. It uses the following syntax:

VSPerfCmd [/U] [/options]

The following tables describe VSPerfCmd.exe tool options.

Option

Description

U

Redirected console output is written as Unicode. Must be the first option specified.

Start:mode

Starts the profiling service in the specified mode.

Output:filename

Specifies the output file name. Use only with Start.

CrossSession|CS|CS

Enables profiling across Windows sessions. Use only with Start, Attach, or Launch.

User:[domain\]username

Enables the specified account access to the profiler service. Use only with Start.

WaitStart[:n]

Waits for the data collection logger to initialize. If n is specified, VSPerfCmd will wait at most n seconds. If n is not specified, VSPerfCmd will wait indefinitely. This eases use of VSPerfCmd as part of a batch process.

Counter:cfg

When the sample profiling method is used, specifies a CPU counter and the number of events to use as the sampling interval. You can sample only one counter value.

When the instrumentation profiling method is used, specifies a CPU counter to be collected at each instrumentation point. Use only with Start:Trace, Attach, or Launch.

QueryCounters

Displays a list of valid CPU counters for the current machine.

WinCounter:path

Specifies a Windows performance counter event to include with profile mark data. Use only with Start.

AutoMark:n

Specifies the time interval (in milliseconds) between Windows performance counter data collection events. Use with WinCounter.

Events:option

Controls collection of specified Event Tracing for Windows (ETW) events. ETW data is collected to an .itl file that is not the profiling data (.vsp) file.

Status

Displays the state of the profiler, information about processes that are currently being profiled, and accounts that have authority to control the profiler.

Shutdown [:n]

Closes the profiling data file and turns the profiler off.

GlobalOn

Resumes data collection after a call to VSPerfCmdGlobalOff.

GlobalOff

Stops all data collection, but does not end the profiling session.

ProcessOn:pid

Resumes data collection for the specified process after profiling was paused by a call to VSPerfCmdProcessOff.

ProcessOff:pid

Stops data collection for the specified process.

ThreadOn and ThreadOff:tid

Resumes profiling for the specified process after profiling was paused by a call to VSPerfCmdThreadOff. Use ThreadOn only when profiling with the instrumentation method.

ThreadOn and ThreadOff:tid

Pauses profiling for the specified thread. Use ThreadOff only when profiling with the instrumentation method.

Mark:MarkNum[,MarkText]

Inserts a mark into the profiling data file, with optional text.

Sampling Method Options

The following options are only available when you are using the sampling profiling method.

Option

Description

Launch:Executable

Starts the specified application and begins profiling.

Args:Arguments

Specifies command line arguments to pass to the launched application.

Console

Starts the specified command in a new command prompt window.

Attach:PID[,PID]

Begins profiling the specified processes. Processes can be identified by the process id or by the process name.

Detach[:PID[,PID]]

Stops profiling the specified processes. Processes can be identified by the process id or by the process name. If no process is specified, profiling is halted for all processes.

GC[:{Allocation|Lifetime}]

Collects .NET memory allocation and object lifetime data. Use only with the VSPerfCmdLaunch option.

Sampling Interval Options

The following options specify the type and duration of sampling intervals. The default is Timer. You can also specify a CPU counter as the interval by using the CounterLaunchAttach

Option

Description

PF[:n]

Samples on every n-th page fault (default=10).

Sys (VSPerfCmd)[:n]

Samples on every n-th system call (default=10).

Timer[:n]

Samples on every n-th processor cycle (default=10000000).

Service Component and Kernel Mode Device Options

The following Admin options support profiling service components or kernel mode device drivers. The Admin options set profiling permissions and control the profiled service or device driver.

Admin options must be executed at a command prompt that is running with administrative credentials.

Option

Description

Admin:Security <ALLOW|DENY> Right[ Right] <User|Group>

Allows or denies the specified user or group access to profiling services.

Right can be:

CrossSession - gives the user access to the service to do cross session profiling.

SampleProfiling - gives the user access to the driver to enable sampling profiling. Also used to access kernel transition information during trace profiling.

FullAccess - gives the user both CrossSession and SampleProfiling access.

Admin:Security, List

Lists the current state of profiling services and lists user permissions.

Admin:<Service|Driver><START|STOP|INSTALL|UNINSTALL>

Starts, stops, installs, or uninstalls the profiling service component (service) or kernel mode device driver (driver).

Admin:<Service|Driver>AutoStart<ON|OFF>

Enables or disables automatically starting the profiling service (service) or kernel mode device driver (driver) after a restart.

VSPerfCmd /Driver

The VSPerfCmd /Driver option is now obsolete. Use the VsPerfCmdAdmin options for this functionality.

See Also

Reference

VSInstr

VSPerfMon

VSPerfReport

Profiling Tools Report Column Definitions