Share via


Visualizing Concurrency on Production Systems

As interesting as profiling applications on your development computer is, I’m sure you’ve wanted to see the behavior of applications when running in production systems. The ability to view remote traces with the Concurrency Visualizer first requires installing the Visual Studio 2010 profiler on the production system. The installation executable can be found on the Visual Studio installation disk under the Standalone Profiler directory. More details can be found at How to: Install the Stand-Alone Profiler.

Once the profiler is installed on the remote computer run:

vsperfcmd /start:CONCURRENCY,ThreadOnly /Output:<OutputFile>.vsp /Launch:MyApplication.exe

(Note: If the application being profiled is a 64-bit application run the 64-bit version of vsperfcmd)

Next, hit Enter and when the application has finished executing run the command:

vsperfcmd /shutdown

Notice that there was a <OutputFile>.app.ctl and a <OutputFile>.krn.ctl file created in addition to the vsp file. All three are important. The next step is to make the trace files portable. Check that the _NT_SYMBOL_PATH environment variable is set or run the vsperfreport command with the symbolpath parameter. To make the trace files portable run:

VSPerfReport /PackSymbols <OutputFile>.vsp

(Note: There isn’t a 64-bit version of VSPerfReport)

At this point you should be able to copy the traces files from the remote computer to a computer that has Visual Studio 2010 installed on it, and use Visual Studio to open the vsp file.

But what if you want to profile a running service? To do so change the start command to:

vsperfcmd /start:CONCURRENCY,ThreadOnly /Output:<OutputFile>.vsp /Attach:<PID>

And then before running the shutdown step run:

vsperfcmd /detach

More details can be found at Collecting Concurrency Data for a Service by Using the Profiler Command Line.

Comments