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).
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. Any good third-party p开发者_运维知识库rofiling tools?
You can use the CLR Profiler for .NET Framework 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.
And even more profilers and tools can be found here...
More about profiling on the wikipedia
If you use the Profiler tool that come with VS it shows this to you very well. Only one down side is that I think it only comes with Ultimate. :(
Are you looking for the performance profiler? It tells you how long each function takes.
I like dotTrace, it's by the same guys that make Resharper: dotTrace
Give a try to 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.
精彩评论