如何只配置一个类库? [英] How to profile only a class library?

查看:81
本文介绍了如何只配置一个类库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当我进入Analyze - >启动性能向导时,我想要配置一个类库项目的CPU使用情况,我可以选择哪个项目进行配置,但只允许我配置可执行文件,所以我无法创建我的图书馆。



如果我对两个项目进行配置(一个是非常简单的表单,从我的库运行函数并显示一些输出)然后 System.Windows.Forms.Application.Run 占用我的样本的97% - 我不是真的关心表单的性能成本,并且压倒一切。



如何查看我的dll的性能数据?

解决方案

您需要创建一个单元测试,该练习练习您感兴趣的各种图书馆功能。



然后,您可以在测试资源管理器中右键单击测试,然后选择配置文件测试。





这应该启动所选测试的性能分析会话。我不知道为什么他们隐藏这个非常有用的功能!



在VS2012中,此选项可能会变灰。在这种情况下,您可以通过删除%localappdata%\Microsoft\VisualStudio\11.0\ComponentModelCache 文件夹并重新启动Visual Studio来启用它。 (来源


I want to profile the CPU usage of a class library project which is compiled into a dll with VS2012.

When I go into Analyze -> Launch Performance Wizard, I can choose which project to profile but it only lets me profile executables, so I can't profile my library.

If I profile both of my projects (one is a very simple Form which runs functions from my library and shows some output) then System.Windows.Forms.Application.Run takes up 97% of my samples - I don't really care about the performance cost of the form, and it overwhelms everything else.

How can I see the performance data for just my dll?

解决方案

You need to create a unit test which exercises the various library functions you are interested in profiling.

You can then right click on the test in the "Test Explorer" and then select "Profile Test".

This should kick off a performance analysis session for the selected test. I not sure why they hid this very useful feature so well!

In VS2012, this option may be grayed out. In this case you can enable it by deleting your %localappdata%\Microsoft\VisualStudio\11.0\ComponentModelCache folder and restarting Visual Studio. (source)

这篇关于如何只配置一个类库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆