[英]Are there any third-party profiling tools for C# in Visual Studio?
I'm looking for a tool to tell me how long my code takes to run.我正在寻找一种工具来告诉我我的代码需要多长时间才能运行。 Something that would be the equivalent of recording the DateTime.Now
before and after each line of code in my program, then displaying the difference between the two times for each line (after my program finishes running).这相当于在我的程序中每行代码之前和之后记录DateTime.Now
,然后显示每行两次之间的差异(在我的程序完成运行之后)。
For instance, if I have a program that calls four methods in its main, I want to know (after running this tool) how long each of those methods takes to run, and then if I stepped into each method, I'd want to know how long each line in there takes to run, and so on.例如,如果我有一个程序在其主程序中调用四个方法,我想知道(在运行这个工具之后)每个方法需要多长时间运行,然后如果我进入每个方法,我想知道那里的每条线需要运行多长时间,等等。
Do these tools exists?这些工具存在吗? Of course I'd prefer a free one, but if all that exist are professional tools then please mention those as well.当然,我更喜欢免费的,但如果所有存在的都是专业工具,那么也请提及这些。
edit: it appears these tools are called Profiling tools.编辑:这些工具似乎被称为分析工具。 Thanks, this will definitely help me in my search.谢谢,这肯定会对我的搜索有所帮助。 Unfortunately, I'm using Visual Studio 2010 Professional, so I believe the Microsoft profiling tool is out of my grasp.不幸的是,我使用的是 Visual Studio 2010 Professional,所以我相信 Microsoft 分析工具超出了我的掌握。 Any good third-party profiling tools?有什么好的第三方分析工具吗?
You can use the CLR Profiler for .NET Framework 4您可以将CLR Profiler 用于 .NET 框架 4
The CLR Profiler includes a number of very useful views of the allocation profile, including a histogram of allocated types, allocation and call graphs, a time line showing GCs of various generations and the resulting state of the managed heap after those collections, and a call tree showing per-method allocations and assembly loads. CLR Profiler包括许多非常有用的分配配置文件视图,包括分配类型的直方图、分配和调用图、显示各代 GC 的时间线以及在这些 collections 之后托管堆的结果 state 和调用显示每个方法分配和程序集负载的树。
And even more profilers and tools can be found here ...甚至更多的分析器和工具可以在这里找到......
More about profiling on the wikipedia更多关于wikipedia 上的分析
If you use the Profiler tool that come with VS it shows this to you very well.如果您使用 VS 附带的 Profiler 工具,它会很好地向您展示这一点。 Only one down side is that I think it only comes with Ultimate.唯一的缺点是我认为它只与 Ultimate 一起提供。 :( :(
Are you looking for the performance profiler ?您在寻找性能分析器吗? It tells you how long each function takes.它告诉您每个 function 需要多长时间。
Give a try to Red Gate ANTS Performance Profiler .试试Red Gate ANTS Performance Profiler 。 There's a free trial, and if you don't have access to the built-in VS2010 profiler, it does a good job.有一个免费试用版,如果您无法访问内置的 VS2010 分析器,它会做得很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.