C++ – a good easy to use profiler for C++ on Linux?


I need to profile some code running C++ on Linux. Can you guys recommend some profilers?

Best Answer

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.


gcc -pg -o whatever whatever.c


gprof whatever gmon.out

Same thing with g++ and cpp.