Callgrind

Not many people who work in C and C++ seem to know this:

apt-get install kcachegrind valgrind
valgrind --tool=callgrind programname
kcachegrind callgrind.out.nnnnn

You can see in what functions the program spent its time, for every function in the program how much time it spent in every of the called functions and all other sort of cool analysis. And it's graphical, interactive, useful, cool.

It helps to compile without libtool (otherwise you're valgrinding a shellscript unless you do something like valgrind --tool=callgrind .libs/lt-programname.

It also helps to compile with debugging symbols.