Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for a low impact c++ profiler

I am looking for a low impact, os-independent profiler for c++ code.

When I say low impact, I am referring to something less intrusive than valgrind. I plan to use it in a MIPS-based embeded environment (hence the os-independance) and tried a ported version of valgrind and it completely changed the performance characteristics (way too much Heisenberg principle at work) so I cant go that route. We know the memory bus speed is a bottleneck which most-likely explains why valgrind was so intrusive.

I have created a home grown type of profiler based on checkpoints that lets me measure certain parts of the code. Basically I have to modify the code (and recompile) to set checkpoints in strategic places in the code. Then, when executed, it stores the number of times each checkpoint is hit and the time since the last checkpoint was hit. Then, after running it, I can dump the checkpoints and for each it calculates: num-hits, max-time, min-time, avg-time, etc.

This profiler (I called it LowImpactProfiler) works ok, but I wonder if there is something better out there.

Ive considered oProfile, which is a sampling profiler, but since Im not running Linux, I think it will be really dificult to implement.

like image 474
Brady Avatar asked May 03 '12 14:05

Brady


2 Answers

I've used Shiny to profile on very limited embedded devices with great success. From your description, it takes a similar approach to your LowImpactProfiler.

like image 185
Miguel Avatar answered Nov 14 '22 11:11

Miguel


If you are using Windows, you can try my profiler, described here http://ravenspoint.wordpress.com/2010/06/16/timing/

It sounds like it might be easier to use than yours, but it is not OS independent. It uses calls to QueryPerformanceCounter() which is a windows API. It is open source, so it might be worthwhile to port it to your OS, using whatever high performance timer is available there.

like image 3
ravenspoint Avatar answered Nov 14 '22 12:11

ravenspoint