prosseek
prosseek

Reputation: 190979

Code coverage and Profiling command line tool in VS2010 Ultimate

I can run those commands to generate the .coverage file to get the code coverage result.

vsinstr -coverage helloclass.exe /exclude:std::*
vsperfcmd /start:coverage /output:run.coverage
helloclass
vsperfcmd /shutdown

Can I use the same tool for getting profiling report?

Upvotes: 4

Views: 3121

Answers (1)

Chris Schmich
Chris Schmich

Reputation: 29494

Profiling uses the same toolset as code coverage, but the commands are slightly different. With profiling, you can do both instrumentation and sample profiling.

For instrumentation profiling (the most similar to code coverage):

vsinstr myapp.exe
vsperfcmd /start:trace /output:trace.vsp
myapp
vsperfcmd /shutdown

For sample profiling (sampling):

vsperfcmd /start:sample /output:sample.vsp /launch:myapp.exe
vsperfcmd /shutdown

These steps change slightly if you're profiling managed code (you would also need to use vsperfclrenv). MSDN has good documentation and examples on using the profiling command-line tools.

Upvotes: 2

Related Questions