prosseek
prosseek

Reputation: 191109

Profiling a method in C# to know how long does it take to run

I need to get a timing report to know how long does it take to run a C# method in a class. I think about using profiler to do that.

The input is the name of a method in a class, the output is

  1. What method/class calls this method.
  2. The amount of time to run the method.

What tools/commercial products are available for that for Visual Studio 2010 and Mono?

Upvotes: 1

Views: 5686

Answers (3)

Phill
Phill

Reputation: 18804

To add to Michaels answer, there's also:

DotTrace ($400)

I personally perfer it over the Red Gate profiler.

Upvotes: 1

Shaun Wilde
Shaun Wilde

Reputation: 8378

Another opensource profiler is slimtune http://code.google.com/p/slimtune/

Alternatively you can create your own profiler using COM and the ICorProfilerCallback interfaces, but I would do this if you wanted a very customized profiler gathering.

Upvotes: 2

Michael Petito
Michael Petito

Reputation: 13161

You could use:

Both will provide you with call graphs and method timings. The Red Gate tool is nice and has a 14 day trial. It also provides line level timings, which I'm not sure if the free CLR Profiler tool will do for you.

Upvotes: 4

Related Questions