Using Unit Tests to drive the Profiler

I have several operations that take a long time, and I'm trying to determine what exactly the bottleneck is.

I have created tests using the testing infrastructure that allow me to run the same operation over and over, so I can see trends in how long the operation is taking.

What I really want to do is have the Profiler run while the Tests are running, so that I can figure out what portions of the code are taking a long time. So far, I can't figure out how to do this.

How can I maket his work?

--
Chris Mullins

[532 byte] By [ChrisMullins] at [2008-2-4]
# 1
Hey Chris,

Try checking out this blog entry that I wrote. Look about halfway down to see where you can open a performance session from a unit test.

https://blogs.msdn.com/ianhu/articles/368770.aspx

Ian [MSFT]

IanWho at 2007-9-8 > top of Msdn Tech,Visual Studio Team System,Visual Studio Performance Tools (Profiler)...
# 2
Hey Chris,

Once you have run your tests and see the results in the Test Results window, try right-clicking on a single test. You should see a create performance session option on the context menu. I think this is what you want.

If you want to profile more than one test at a time, you will need to create an ordered test to wrap the multiple tests. You should then be able to profile the ordered test. There is currently no method of adding multiple tests to the same performance session which is why creating the ordered test is necessary (although we are looking into this for the future).

I hope this helps. Let me know if you get this working.

Marc

MarcP at 2007-9-8 > top of Msdn Tech,Visual Studio Team System,Visual Studio Performance Tools (Profiler)...

Visual Studio Team System

Site Classified