An API would be REALLY useful/Can I profile parts of tests?

Code profiling for .NET Developers

An API would be REALLY useful/Can I profile parts of tests?

Postby HiPerFreak » Thu Jul 14, 2011 7:35 am

I have a unit tests which simulates a slow usage scenario and I want to profile a certain part of this unit test method with the ANTS Performance profile. How can I do this?

Something similar to the old profiler API (the RedGate.Profiler.Api.dll) would be very useful for this!

Does such an API exist or is it planned? Is there any alternative?

Thank you very much,
Posts: 1
Joined: Thu Jul 14, 2011 7:30 am

Postby AndrewH » Thu Jul 14, 2011 10:34 am

There is an API available for ANTS which can mark regions on the timeline: see 'adding custom event markers' here for details. Once the regions are marked, you can just select those relating to the tests you're interested in.

However, this is probably unncecessary for unit tests: as these are implemented as individual methods, you can just select the relevant method in the list. ANTS will draw a green bar on the timeline to show the times when the method was running, and you can click on this to inspect what was going on during that time. The call graph is also very useful for inspecting how an individual method is behaving.
Andrew Hunter
Software Developer
Red Gate Software Ltd.
Posts: 118
Joined: Thu Aug 17, 2006 3:44 pm

Postby Laura Morley » Thu Jul 14, 2011 10:42 am

If you're looking for pointers on how to set up profiling for your unit test, and it's in Nunit or MSTest, then you may find the following instructions useful:
* Profiling units tests using NUnit
* Profiling tests in MSTest
Essentially, both methods involve telling ANTS Performance Profiler to profile your test assembly. When it's profiling you can then, as Andrew suggests, use the call tree to select the method for the test in which you're interested.
Laura Morley
Posts: 24
Joined: Wed Jun 22, 2011 2:13 pm
Location: Red Gate Software

Return to ANTS Performance Profiler Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests