55.5. Stand-Alone Profiler

This is a command-line tool useful when you need to profile an application without having to install Visual Studio on the machine — for example, in a production environment. To install this tool you need to execute vs_profiler.exe from the VSTS installation media located in the Standalone Profiler folder. It will install the tools in the directory %ProgramFiles%\Microsoft Visual Studio 9.0\Team Tools\Performance Tools. I suggest adding this path to the system path.

The following commands profile an application using sampling with the default settings. The first line enables the trace. Then you specify it to use sample and the output for the report. In this case the report will be saved in the ApplicationToProfile directory on a file named Report.vsp. Then you launch the application, interact with it as usual, and when you are done you finally shut down the Profiler. You can then open and inspect the generated report in Visual Studio.

C:\ApplicationToProfile>vsperfclrenv /traceon Enabling VSPerf Trace Profiling of managed applications (excluding allocation profiling). . . . C:\ApplicationToProfile>vsperfcmd -start:sample -output:Report Microsoft (R) VSPerf Command Version 9.0.21022 x86 . . . C:\ApplicationToProfile>vsperfcmd -launch:Application.exe Microsoft (R) VSPerf Command Version 9.0.21022 x86 . . . Successfully launched process ID:2896 Application.exe C:\ApplicationToProfile>vsperfcmd -shutdown Microsoft (R) VSPerf Command Version 9.0.21022 x86 ...

Get Professional Visual Studio® 2008 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.