I need to debug the performance of a slow application that sometimes gets slow and sometimes works just fine.
It's really hard and I can't find what's the problem.
I thought about IL weaving and tools like PostSharp. But since I only want a very specific requirement, I thought maybe there are other ways/techniques that I'm not familiar with.
My need is to log the overall execution time of each and every method. How can I get that? Is IL weaving the only option?
You do that with a profiler, e.g. dotTrace for C#. If you have Resharper Ultimate, dotTrace is included.
.NET profilers do not only measure the time of all your methods, but also the time in .NET garbage collection.
There's also a profiler available in newer versions of Visual Studio.
Although it could be done with IL weaving as well, you would not compile an extra version just for this purpose. With a profiler, you can change the settings without recompiling your code every time.