Export (0) Print
Expand All

Walkthrough: Command-Line Profiling Using Sampling

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

In this walkthrough, you will step through the process of profiling a managed application by using command-line tools, and use sampling to isolate and identify performance problems in the application.

In this walkthrough, you will follow these steps:

  • Profile an application by using command line tools and sampling.

  • Analyze sampled profiling results to locate and fix performance issues.

  • 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.

Sampling is a profiling method by which a specific process is periodically polled to determine the active function. The resulting data provides a count of how frequently the function was on top of the call stack when the process was sampled.

To profile an existing application by using the sampling method

  1. Open a command window and locate the directory that contains the sampling command-line tools.

  2. For profiling a managed application, type the following command to set the appropriate environment variables:VsPefCLREnv /sampleon

  3. Start profiling by running VSPerfCmd.exe, which is the command-line tool that controls the profiler. The following command starts the profiling session in the sampling mode:VsPerfCmd /start sample /output \\<dir>\PeopleTraxReport.vsp /launch \\<dir>\PeopleTrax.exe

    The profiler process starts and attaches to the PeopleTrax.exe process. The profiler process starts to write the collected profiling data to the report file.

  4. Click Get People.

  5. Click Export Data.

    Notepad opens and displays a new file that contains the exported data from PeopleTrax.

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

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

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

    • Examine the raw .vsp file in 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

For additional walkthroughs related to reporting profiling data from the command line, see:

How to: Gather Sampling Data using Command-line Tools 

http://go.microsoft.com/fwlink/?linkid=73531

How to: Gather Instrumentation Data using Command-line Tools

http://go.microsoft.com/fwlink/?linkid=73611

How to: View ETW Data

http://go.microsoft.com/fwlink/?linkid=73617

Performance Report Column Definition

http://go.microsoft.com/fwlink/?linkid=73618

Community Additions

ADD
Show:
© 2014 Microsoft