Welcome to MSDN Blogs Sign in | Join | Help

Managing how you Profile .Net Code

There are three environment variables needed for a .Net application you wish to profile. The profiler team has provided VSPerfCLREnv.cmd to set these variables for you.  The switches for this helper file are: 

for trace (instrumentation) profiling:

  • /traceon for standard .Net profiling
  • /tracegc to get allocation events as well

for sampling:

  • /sampleon for attaching to a .Net application (this is not needed if the profiler is launching the application)
  • Note: there is no /samplegc. To enable collection of allocation events for sampling, simply add the -gc flag to the VSPerfCmd.exe command when launching or attaching to the application

There are global versions of each of the above switches to set the environment need for profiling a managed service that is launched by the OS on startup, not the user (and hence the environment has to be set in the registry).

  • /globaltraceon, /globaltracegc, and /globalsampleon

To delete these environment settings, simply use the /off or /globaloff switches.

Notes:

  • You do not need to do any of this if you are profiling an application by launching it with the Performance Explorer in the IDE. The Performance Explorer will set all of the needed environment settings for you.
  • If the correct environment was not set during profiling, you will see a warning at analysis time and all of the managed function names will be blank

I hope this helps anyone exploring the command line capabilities of profiling a .Net application with Visual Studio Team System.

[marcpop]

This posting is provided "AS IS" with no warranties, and confers no rights.

Published Tuesday, May 25, 2004 5:10 PM by profiler

Comments

# re: Managing how you Profile .Net Code

Just to add to this, if you are using the UI for your profiling runs, it will take care of setting the environment variables up for you. These steps are necessary if you are running our tools from the command line.
Tuesday, May 25, 2004 6:08 PM by Steve Carroll [MSFT]

# Another tip on profiling from the command line

Wednesday, May 26, 2004 2:50 AM by RobCaron's Blog

# Profiling From the Command Line

Thursday, July 29, 2004 7:56 PM by Enterprise Performance Tools Team

# re: Profiling From the Command Line

Friday, August 06, 2004 6:05 PM by Enterprise Performance Tools Team

# Software Information » Enterprise Performance Tools Team : Profiling From the Command Line

Anonymous comments are disabled
 
Page view tracker