优化:用于 Visual Studio 的 gprof 等工具

发布于 2024-08-22 18:50:31 字数 248 浏览 6 评论 0原文

作为一名 C# 程序员,我正处于从小项目到中型项目的过渡中。我以前的小项目不需要分析器。但现在我需要一个工具来帮助我提高代码的性能。我很多年前在 C 语言中使用过 gprof。

有人可以给我一个起点,或者推荐我一个像 VS2008 的 gprof 这样的工具吗?那就是:一个统计每个函数被调用了多少次,以及每个函数花费了多少时间的工具。无论是否必须付费(在某些限制下)。

关于如何找到应该优化的代码部分的任何其他建议都会很棒。

谢谢。

As a C# programmer, i'm in a transition from small projects to medium projects. I didn't need a profiler for my little projects before. But now I need a tool that help me improving the performance of my code. I used gprof many years ago, in C.

Can someone give me a starting point, or recommend me a tool like gprof for VS2008? That is: A tool that counts how many times every function has been called, and how many time It's spended in every function. No matter if a had to pay for it (under certains limits).

Any other advice about how to locate portions of code that should be optimized will be great.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

唐婉 2024-08-29 18:50:31

Visual Studio 内置了此功能,具体取决于您使用的版本。在专业版(我相信)中,您有“分析”部分,它可以为您提供函数内的计时,包括和不包括进一步的调用、调用次数等...

它通常位于“分析”菜单选项(如果有)下。

EDIT

VS2010 对此也有了很大的改进。具有一些非常酷的多线程性能分析,向您展示线程花费时间执行/阻塞的操作类型。它还显示了我相信在您的代码中的逐行计时(当然我看到的最后一个屏幕截图也是如此)。

Visual Studio has this functionality built in depending on the version you are using. Within Professional (I believe), you have the Profiling section which gives you timing within functions inclusive and exclusive of further calls, # of calls etc...

It is normally located under the 'Analyze' menu option if it's there.

EDIT

Come VS2010 this has also been greatly improved. Featuring some very cool looking multi-threaded performance analysis, showing you what sort of operations the thread spends its time doing/blocking on. It also displays line by line timings I believe within your code (certainly the last screenshot I saw did).

橘亓 2024-08-29 18:50:31

我使用过 DotTraceAQTime 两者都易于使用和理解。

I've used DotTrace and AQTime both are easy to use and understand.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文