Red Gate forums :: View topic - Profiling unit tests
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
ANTS Performance Profiler 7
ANTS Performance Profiler 7 forum

Profiling unit tests

Search in ANTS Performance Profiler 7 forum
Post new topic   Reply to topic
Jump to:  
Author Message
ShaneMRyan



Joined: 13 Dec 2012
Posts: 1

PostPosted: Thu Dec 13, 2012 11:38 am    Post subject: Profiling unit tests Reply with quote

We already have a license for ANTS and for our day-to-day profiling we’re pretty happy with it.

However what we are interested in is profiling of unit tests on an integration server. So for instance we use TeamCity/Nunit and we’d like to be able to run unit tests to highlight a block of code and have the unit test fail if the number of cpu cycles for the block of code increases by more than x percent.

So for example:

[Test]
Void PerformanceUnitTest1()
{
//setup code

SpeedTrace.startprofiling();

For(int i=0; I < 10000000; i++
{
Console.write(“hello world”);
}
SpeedTrace.stopprofiling();

long numberOfCPUCycles = SpeedTrace.GetCyles();

Assert.(500000*1.2 > numberOfCPUCycles); // took more than the 500,000 cpu cycles plus 20%
}

If we could do something like this to help automate our profiling it would be very useful to us.
Back to top
View user's profile Send private message
dene.boulton



Joined: 12 Oct 2011
Posts: 53
Location: Cambridge

PostPosted: Thu Dec 13, 2012 3:12 pm    Post subject: Reply with quote

Hello,

The way you would have to currently approach this would be to have a build step where you run a process for the command line profiler (available in APP Pro) that profiles the nunit command line runner and provide the arguments to the nunit runner for the assembly to process.
Provide the Profilers with command line arguments to profile child processes and output the results to an xml file.

Then assert on the content of the xml file for the particular methods running values.

Edit: also see this support item - http://www.red-gate.com/SupportCenter/content/knowledgebase/ANTS_Profiler/KB200708000125
_________________
Dene Boulton
Red Gate
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group