如何在单元测试仪器性能会话中分析依赖程序集中的方法?

时间:2022-01-22 19:51:09

I have a Visual Studio 2008 unit test project that depends on a dll project in the same solution. With this setup, I want to profile a single unit test with a Visual Studio performance session. Said test calls into methods located in the dll project and I want to see where the perf bottleneck is in that dll.

我有一个Visual Studio 2008单元测试项目,它依赖于同一解决方案中的dll项目。通过此设置,我想使用Visual Studio性能会话分析单个单元测试。所述测试调用位于dll项目中的方法,我想看看该dll中的perf瓶颈在哪里。

So far so good. At first it seemed simple: In Visual Studio Test View, I right-clicked on the relevant test and chose "Create Performance Session...". In the wizard that follows, I chose instrumentation. However, after running the resulting performance session, only data for methods located in the unit test dll were shown. I then right-clicked on the "Targets" folder in the perf session and chose "Add Target Binary..." to add the dll (I chose the dll under bin/release in the dll project folder). This works inasmuch as that the dll is now instrumented too, but I keep missing the perf data for the methods in that dll. I tried to add the dll from different locations ...

到现在为止还挺好。起初看起来很简单:在Visual Studio Test View中,我右键单击相关测试并选择“Create Performance Session ...”。在随后的向导中,我选择了仪器。但是,在运行生成的性能会话后,仅显示位于单元测试dll中的方法的数据。然后我右键单击perf会话中的“Targets”文件夹并选择“Add Target Binary ...”来添加dll(我选择了dll项目文件夹中bin / release下的dll)。这工作原因是dll现在也被检测,但是我一直缺少该dll中方法的perf数据。我试图从不同的位置添加dll ...

  • bin/release under the dll project folder
  • 在dll项目文件夹下的bin / release

  • obj/release under the dll project folder
  • 在dll项目文件夹下的obj / release

  • bin/release under the unit test dll project folder
  • bin / release下单元测试dll项目文件夹

... none of which worked.

......没有一个奏效。

I'd appreciate feedback on how to gather perf data of the dependent dll.

我很感激如何收集依赖dll的perf数据的反馈。

1 个解决方案

#1


I had exactly the same problem as you, but I could solve it adding the Targets the same as you did, but with one minor difference, however: I selected "Add target project" instead of "Add target binary". Then it worked correctly.

我和你有完全相同的问题,但我可以解决它添加目标与你做的相同,但有一个小的区别,但是:我选择了“添加目标项目”而不是“添加目标二进制”。然后它正常工作。

Maybe it's a problem with the binaries you select, or maybe a bug in VS2008. I recommend you, if it's possible, to add the binaries you're trying to profile as a project in the solution.

也许这是你选择的二进制文件的问题,或者VS2008中的错误。如果可能,我建议您添加您尝试在解决方案中作为项目进行概要分析的二进制文件。

Hope this helps.

希望这可以帮助。

#1


I had exactly the same problem as you, but I could solve it adding the Targets the same as you did, but with one minor difference, however: I selected "Add target project" instead of "Add target binary". Then it worked correctly.

我和你有完全相同的问题,但我可以解决它添加目标与你做的相同,但有一个小的区别,但是:我选择了“添加目标项目”而不是“添加目标二进制”。然后它正常工作。

Maybe it's a problem with the binaries you select, or maybe a bug in VS2008. I recommend you, if it's possible, to add the binaries you're trying to profile as a project in the solution.

也许这是你选择的二进制文件的问题,或者VS2008中的错误。如果可能,我建议您添加您尝试在解决方案中作为项目进行概要分析的二进制文件。

Hope this helps.

希望这可以帮助。