【问题标题】:Problems measuring performance of C++ project in Visual Studio 2010在 Visual Studio 2010 中测量 C++ 项目性能的问题
【发布时间】:2011-09-13 02:50:55
【问题描述】:

我正在尝试测量 Visual Studio 2010 中控制台应用程序项目的某些功能和方法的性能。

我将分析方法配置为检测。问题是性能监视器不起作用。我得到的输出消息是:

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有关,但我不能确定。

【问题讨论】:

  • 呃,也许你的杀毒软件有干扰?
  • 嗯。它可能是。我必须检查...
  • 我在被忽略的文件上添加了防病毒位置。还是不行。
  • 您是从探查器运行可执行文件,还是从 IDE 运行它然后尝试使用探查器? ...在您启动分析器之前,其他东西启动了应用程序或正在使用它。
  • 实际上,我昨晚尝试直接检测可执行文件,而不是检测项目(来自向导)。有效。我怀疑 IDE 在监视时阻止了 exe 文件。在这两种情况下发生的情况是,在执行结束后,Visual Studio 的性能监视器会崩溃。

标签: c++ visual-studio-2010 profiling


【解决方案1】:

从性能向导中选择可执行文件作为目标并提供可执行文件的路径。这为我解决了问题。

【讨论】:

  • 这就是我最终所做的(查看我对我的问题的最后评论)。看起来,我不是唯一遇到这个问题的人:)
【解决方案2】:

使用process explorer 的查找句柄功能 (ctrl + F) 找出打开 ProfilingTest.exe 的进程。这将使您进入故障排除过程的下一步。

【讨论】:

  • 以前没有尝试过,但是 procmon(也来自 sysinternals)可能会实时为您提供相同的信息..
【解决方案3】:

我发现的另一个解决方法是执行以下操作:

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"

我想知道雷德蒙德的好人是否注意到了这一点..

问候。

【讨论】:

    猜你喜欢
    • 2012-06-01
    • 2011-08-09
    • 2011-02-13
    • 2011-05-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多