我想测试一些控制台应用程序项目中的函数和方法的性能,使用的是Visual Studio 2010。
我将性能分析方法配置为instrumentation。问题在于性能监视器不起作用。输出信息如下:
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.
我认为"万恶之源"是: 由于另一个进程正在使用文件,因此该进程无法访问文件“...”。
有人尝试在Visual Studio 2010中开发本地应用程序时遇到类似的问题并解决了吗?
后来添加: 如果我选择直接构建的可执行文件进行分析,而不是选择要分析的项目,则可以成功进行分析,而且没有收到进程阻塞的消息,甚至还收到了文件分析报告。但是,在分析结束时监视应用程序会崩溃。我怀疑这与IDE有关,但我不能确定。