Others mentioned OProfile ; for full-blown statistical profiling on modern Linux installations, it really does swing.
A more venerable tool (which does not require kernel support and therefore will work on older versions of Linux or even non-Linux operating systems) GNU gprof is included in binutils (and therefore, of course, is already installed in your development environment).
gprof
, -pg
gcc
; gmon.out
, gprof
.