Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Command-line Tools
 Walkthrough: Command-Line Profiling...
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Walkthrough: Command-Line Profiling Using Instrumentation

This walkthrough demonstrates how to profile an application by using command-line tools and instrumentation to identify performance problems.

In this walkthrough, you will step through profiling a managed application, and use instrumentation to isolate and identify performance problems in the application. You will follow these steps:

  1. Profile an application by using the instrumentation method.

  2. Analyze instrumented profiling results to locate and fix a performance issue.

  • Microsoft Visual Studio 2005 Team System

  • Intermediate understanding of C#

  • Intermediate understanding of working with command-line tools

  • A copy of the PeopleTrax Sample

  • To work with the information provided by profiling, it is best to have debugging symbol information available.

Instrumentation is a profiling method by which specially built versions of the profiled binaries contain probe functions that collect timing information at the entry and exit to functions in an instrumented module. Because this method of profiling is more invasive than sampling, it incurs a greater amount of overhead. Instrumented binaries are also larger than debug or release binaries and are not intended for deployment.

NoteNote

Do not send instrumented binaries to your customers. Instrumented binaries can contain several risks. The binaries include information that makes your application easier to reverse engineer, as well as security risks.

To profile an application by using the instrumentation method

  1. Open a command window and locate the directory that contains the sampling command-line tools. By default, this directory is <drive>\Program Files\Microsoft Visual Studio 8\Team Tools\Performance Tools\.

  2. To profile a managed application, type the following command to set the appropriate environment variables:VsPefCLREnv /trace

  3. To instrument the application that you want to profile, type the following command:

    VSInstr PeopleTrax.exe

    Note   By default, VSInstr saves a non-instrumented backup of the original file. The backup file name has the extension .orig. For example, the original version of “MyApp.exe” would be saved as “MyApp.exe.orig.”

  4. To start the profiler, type the following command: VsPerfCmd /start trace /output Report.vsp

  5. After you start the monitor process in trace mode, run the instrumented version of the PeopleTrax.exe process to collect data.

    The PeopleTrax application window appears.

  6. Click Get People.

    The PeopleTrax data grid populates with data.

  7. Click Export Data.

    Notepad starts and displays a new file that contains a list of people from the PeopleTrax application.

  8. Close Notepad, and then close the PeopleTrax application.

  9. When profiling managed applications, use the following command to reset the environmental variables:VSPerfCLREnv /off

  10. Analyze the results by using one of the following methods:

    • Examine the raw .vsp file the Visual Studio IDE.

      — or —

    • Generate a more detailed report by using the command-line tool VSPerfReport.exe. To generate reports for use outside the Visual Studio IDE use the following command:VSPerfReport <dir>PeopleTraxReport.vsp /output <dir> /summary all

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
sample command lines are incorrect      bartduncan   |   Edit   |   Show History

The sample command lines in this topic seem to be more incorrect than correct. This is what worked for me:

VsPerfCLREnv /traceon
VSInstr <your_exe_or_dll>
VsPerfCmd /start:trace /output:Report.vsp

<run your app>

VSPerfCLREnv /off
VSPerfCmd /shutdown
VSPerfReport Report.vsp /output:<dir> /summary:all

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker