I’ve used 2 profiling tools before – RedGate’s ANTS profiler, and the built in profiler found in Visual Studio Team System.
It’s been some time since I used RedGate’s (http://www.red-gate.com/products/ants_profiler/index.htm) profiler, though I used the built in in Visual Studio 2008 fairly recently.
That being said, I felt that the RedGate product felt more intuitive to use. One thing that frustrated me back when I used the RedGate product was that I couldn’t instruct the profiler to only profile my code starting at a certain point – I had a performance hit that couldn’t be reached until a fair amount of code had already executed and therefore polluted my results. They may have added that feature since then.
The built in version for Visual Studio is only available in their very-high end versions of the product. Someone correct me if I am wrong, but I don’t think even the “Professional” version has the profiler. I am currently using Team System Developer Edition, which does have the code analysis tools.
One thing the VS version does do though, is enable you to pause the profiling, and even start your app with profiling paused, so you can really focus on the performance of something very specific. This can be exceedingly helpful when you are trying to understand the analysis results.
EDIT: Both tools will show you memory usage, and the number of times a specific method was called, and how much time was spent in each method. What they do not do, to the best of my knowledge, is show you CPU usage at any given point in time. However, there are likely strong correlations between CPU usage and the amount of time spent in a given block of code.
If you can duplicate the CPU spikes consistently by invoking certain actions in the APP, then what I would do is try and get my hands on the VS profiler, start the app with profiling pause, enable profiling right before you do whatever typically results in the spike, and examine those results.
This assumes of course that you have some sort of deterministic behavior to recreate the spikes. If not … you might considering threaded processes or garbage collection a candidate for your performance hit.
I’ve found DevPartner from Compuware http://www.compuware.com/ to be an excellent profiling tool. Unfortunately it looks like at the present time they don’t support VS 2008.
Also, is this spike actually worrisome? And on what kind of hardware are you seeing this? A spike to 27% on a quad-core CPU might be cause for worry, but not on an 800Mhz P3.
How long does it stay spiked? @Matt has a great point that garbage collection could be at fault. Or potentially swapping to disk.
Is it affecting overall system performance for a long time, or just a couple seconds now and then?
Not that finding a solution to this shouldn’t be of concern, but how important is it?