1

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?

prosseek
  • 182,215
  • 215
  • 566
  • 871
  • 1
    In the higher end versions of VS 2010 you have an integrated Profiler, no need for a commercial product besides that. – BrokenGlass Jun 05 '11 at 17:15
  • possible duplicate of [How do I improve performance of winforms application in Mono?](http://stackoverflow.com/questions/614478/how-do-i-improve-performance-of-winforms-application-in-mono) – Will A Jun 05 '11 at 17:17
  • Now a duplicate of the same question you've asked again. http://stackoverflow.com/questions/6244549/hooking-up-net-method-for-profiling-purposes – Will A Jun 05 '11 at 17:26
  • @Will A : I intentionally made two questions, the other question is about hooking method to profile something (you can see the comment 'or (not) running the profiler' to specify this, this question is about using profiler to do the same thing. – prosseek 5 secs ago edit – prosseek Jun 05 '11 at 18:07
  • 1
    *"The amount of time to run the method. "* - System.Diagnostics.Stopwatch. – Ed S. Jun 05 '11 at 18:14
  • Wall-clock or CPU time? Inclusive time or exclusive? Percent, or average & call count? – Mike Dunlavey Jun 06 '11 at 07:45

3 Answers3

4

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.

Michael Petito
  • 12,891
  • 4
  • 40
  • 54
2

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.

Shaun Wilde
  • 8,228
  • 4
  • 36
  • 56
1

To add to Michaels answer, there's also:

DotTrace ($400)

I personally perfer it over the Red Gate profiler.

Phill
  • 18,398
  • 7
  • 62
  • 102