VSPerfCLREnv

The VSPerfCLREnv tool is used to set environment variables that are required to profile a .NET application. It uses the following syntax:

VsPerfCLREnv [/option]

The option that you choose depends on which of the three types of profiling you use: sampling, instrumentation, or global. The syntax for each option is described in the following tables.

Note

When you are finished profiling, run VSPerfCLREnv with the /off or /globaloff option to delete the environment variables necessary for profiling. For more information, see VSPerfCLREnv Options to Delete Environment Settings shown here.

VSPerfCLREnv Options for Process Instrumentation Profiling

The following table describes VSPerfCLREnv options for instrumentation profiling:

Option

Description

TraceOn

Enables profiling using the instrumentation method. Does not enable memory allocation profiling or collecting object lifetime data.

TraceGC

Enables memory allocation profiling using the instrumentation method. Does not enable collecting object lifetime data.

TraceGCLife

Enables memory allocation profiling and collecting object lifetime data using the instrumentation method.

VSPerfCLREnv Options for Process Sampling Profiling

The following table describes VSPerfCLREnv options for sampling profiling:

Option

Description

SampleOn

Enables profiling using the sampling method. Does not enable memory allocation profiling or collecting object lifetime data.

SampleGC

Enables memory allocation profiling using the sampling method. Does not enable collecting object lifetime data.

SampleGCLife

Enables memory allocation profiling using the sampling method. Also enables collecting object lifetime data.

SampleLineOff

Disables the collection of .NET line-level profiling data.

VSPerfCLREnv Options for Global Profiling

To profile a managed service such as and ASP.NET web application that is started by the operating system instead of being started by the user, use options for global profiling of the VSPerfCLREnv options. The following table describes the global versions of VSPerfCLREnv options. These options set the appropriate environment variables in the registry.

Option

Description

GlobalTraceOn

Enables global profiling using the instrumentation method. Does not collect memory allocation events or object lifetime data.

GlobalTraceGC

Enables global memory allocation profiling using the instrumentation method. Does not enable collecting object lifetime data.

GlobalTraceGCLife

Enables global memory allocation profiling using the instrumentation method. Also enables the collection of object lifetime data.

GlobalSampleOn

Enables global profiling using the sampling method. Does not enable collecting memory allocation events or object lifetime data.

GlobalSampleGC

Enables global memory allocation profiling using the sampling method. Does not enable collecting object lifetime data.

GlobalSampleGCLife

Enables global memory allocation profiling using the sampling method. Also enables collecting object lifetime data.

VSPerfCLREnv Options to Delete Environment Settings

When you are finished profiling the managed application, use one of the following options to delete the environment variables that were added by VSPerfCLREnv. The following table describes how to delete both standard and global environment variables:

Option

Description

Off

Deletes environment variables for standard .NET profiling. Use this option when the the non-global VSPerfClrEnv options were used to set the profiler environment variables.

GlobalOff

Deletes environment variables for global .NET profiling. Use this option when the application was started by the operating system and not the profiler.

Remarks

These options are not required for profiling a managed application if the application is started by using the Performance Explorer in the IDE. The Performance Explorer sets all the required environment settings for you.

If the correct environment was not set during profiling, a warning is reported during analysis and the managed function names will not be properly resolved.

See Also

Other Resources

Using the Profiling Tools From the Command-Line