Cătălin Pitiș
Cătălin Pitiș

Reputation: 14341

Problems measuring performance of C++ project in Visual Studio 2010

I am trying to measure the performance of some functions and methods of a console application project in Visual Studio 2010.

I configured the profiling method to instrumentation. The problem is that the performance monitor doesn't work. The message that I get to the output is:

Profiling started.
Instrumenting w:\MyProject\ProfilingTest\Build\Debug\ProfilingTest.exe in place
Info VSP3049: Small functions will be excluded from instrumentation.
Microsoft (R) VSInstr Post-Link Instrumentation 10.0.40219 x64
Copyright (C) Microsoft Corp. All rights reserved.
File to Process:
   w:\MyProject\ProfilingTest\Build\Debug\ProfilingTest.exe --> w:\MyProject\ProfilingTest\Build\Debug\ProfilingTest.exe
Original file backed up to w:\MyProject\ProfilingTest\Build\Debug\ProfilingTest.exe.orig
Successfully instrumented file w:\MyProject\ProfilingTest\Build\Debug\ProfilingTest.exe.
The process cannot access the file 'w:\MyProject\ProfilingTest\Build\Debug\ProfilingTest.exe' because it is being used by another process.
Data written to w:\MyProject\ProfilingTest\ProfilingTest110611(17).vsp.
Profiling finished.
File contains no data buffers
File contains no data buffers
Analysis failed
The process cannot access the file 'w:\MyProject\ProfilingTest\Build\Debug\ProfilingTest.exe' because it is being used by another process.
Profiling complete.

I presume that the "root of all evil" is: The process cannot access the file '...' because it is being used by another process.

Did anybody faced such problems trying to profile native applications developed in Visual Studio 2010 and solve them?

Later add: If, instead of choosing a project to profile, I am choosing directly the built executable, I succeed to profile, without receiving process blocking, I even received the file analysis. However, the monitoring application is crashing at the end of the profiling. I suspect is related to IDE, but I can't tell for sure.

Upvotes: 13

Views: 5077

Answers (3)

roboto1986
roboto1986

Reputation: 625

Another work-around that I found was to do the following:

1) Launch performance wizard
2) choose your project
3) un-check the box to automatically start your profiling 
4) Choose "New Performance Session" and choose your project again (top button on Performance explorer window)
5) Select your performance session from "Targets" and choose "Start Profiling"

I wonder if the nice folks at Redmond have taken notice of this..

Regards.

Upvotes: 0

tombstone
tombstone

Reputation: 156

from the performance wizard choose executable as your target and give the path to the executable. This solved problem for me.

Upvotes: 10

pepsi
pepsi

Reputation: 6875

Use process explorer's find handle feature (ctrl + F) to figure out which process has ProfilingTest.exe open. That'll get you to the next step of the troubleshooting process.

Upvotes: 0

Related Questions