I need to profile some code running C++ on Linux. Can you guys recommend some profilers?
I'm a fan of Oprofile. It involves installing a kernel module and has a bit of a learning curve to it, but it's fairly powerful and works very well for optimized programs/programs without debugging symbols.
Vtune is another very powerful profiler made by Intel. I believe the Linux version is free for Non-commercial software.
There is also the Valgrind suite of tools proposed by dfa. Callgrind would probably be what you're most interested in. Cachegrind(whose featureset is a subset of Callgrind's) and Massif are interesting as well, but I have no experience with the latter.
Google also has a nice profiler as part of the google-perftools -- which are included in Debian / Ubuntu and possibly other distros.
Take a look at KCacheGrind which is a graphical frontend to valgrind and makes it really easy to use it.
Use gprof.
Just compile with -pg flag (I think (but am not sure) you have to turn of optimizations though.) and use gprof to analyze the gmon.out file that your executable will then produce.
eg:
gcc -pg -o whatever whatever.c
./whatever
gprof whatever gmon.out
Same thing with g++ and cpp.
Zoom from RotateRight ( http://www.rotateright.com ) is what I've been using. It has a butterfly view of functions and you can double-click any function to dive into source or asm code. Build with debugging information (-g) to see your source, but you should still build and profile optimized code.