I'm faced with a big old stack of method calls in some legacy code, one or some of which is creating a bottleneck and really slowing things down. Is there any quick way I can ge开发者_StackOverflow中文版t a report on which method calls are taking the time, short of running in debug, stepping through and seeing where the cursor pauses?
Use a profiler. I personally use JetBrains dotTrace but that's mainly because I was given a free licence as an MVP. There are other tools available too, such as RedGate's ANTS. I haven't used the ANTS one myself.
There's a free profiler from Microsoft which targets .NET 2.0; I expect it would work with .NET 3.0 and 3.5 as well, but quite possibly not .NET 4 as that has a new CLR. My own experience with this is that it's somewhat limited, but can still be useful.
Try Eqatec
SlimTune is another free and open source profiler.
精彩评论