AQTime can definitely do this. You can select whatever modules you want to include. But if you're going to Delphi 2010, they don't have it integrated into the IDE yet. In fact just a few weeks ago they finally got their Delphi 2009 integration working - a year after D2009's release, and from my initial look at it, it appears to be buggy.
AQTime is also VERY expensive at $600. If you do go for it, buy if from one of their partners where you can save some money (e.g. Falafel offers it for $500 instead of $600). {Here's my personal rant: That is a terrible policy that turns me off. You should not pay more when you buy direct from the vendor. They should either get their partners to sell at the same price and give them a %, or they should not offer it at their own site at all and just list the partners from who you can buy it.}
But even given those problems, AQTime is the only tool I've found that works admirably well at giving you line by line execution counts and timings. It's the final result it gives that makes it worthwhile, and after many questions and answers re profiling that I've given at StackOverflow over the past year, I may just end up with them (I am into my 3rd trial now that they've added the D2009 integration).
My main Questions are at:
And I've attempted an answer at:
Despite Mason's comment, I do not find that AQTime is too slow for profiling, as long as you only profile the routines that you are currently working on optimizing. Just don't always turn it on for everything.
I had also tried Sampling Profiler. It just didn't work for me. It seemed that 90% of the results it came up with were in System routines, with string copies and moves taking up the majority. That didn't help me. I needed to know which lines in MY routines were calling those moves and copies.
If you want a good free one, I would highly recommend asmprofiler. It is actually an amazingly good profiler, similar to AQTime, with wonderfully great profile results. Its only downfall is that it only analyzes down to the procedure level and not to the line level, and that's the only reason I favor AQTime.
p.s. For Micro Optimization, they say not to rely on AQTime. I've done a good amount of testing now, and I'm getting more and more impressed by the assistance AQTime and it's line-level info gives to help you find those places to micro optimize. That in itself makes the product worth its while.
If line-level information gets added into asmprofiler, then that one will be the no-brainer.
But wouldn't it be nice if Embarcadero finally decided to add a built-in profiler right into Delphi? As I write this, it is in 10th place at Delphi UserVoice. Vote Here to move it up!