serviscope_minor writes: It should be well known to any developer that you should only optimize parts of a program which need optimizing. And the way to find those parts is through profiling. This simplifies one point: profiling is difficult. The obvious way is to enable profiling in the compiler and use gprof, but this has problems. Firstly there is no point in profiling a program without turning on -O3 (or which ever), since this can change the results dramatically. Secondly, -O3 will inline functions which can ruin profiling results by making them far too coarse. Even if it doesn't do this, there is no way of determining which part of a function is taking up all the time. So that brings me to my question: does anyone know of profiling tools which do not suffer from these problems? My platform is C++ (using g++) on Linux.