Linux Eclipse CDT profiler

2607 picture 2607 · Apr 9, 2012 · Viewed 9k times · Source

I am using Eclipse CDT under Linux, can anyone recommend a good profiler under that environment please.

I am also new to C++ and multi-thread programming, can anyone also offer some advice on how to run profiling for multi-threaded application please, e.g., what to look for performance bottleneck, etc.

Thanks.

Answer

dbrank0 picture dbrank0 · Apr 9, 2012

I don't know if it's best choice, but it's definitely obvious one: gprof. You just need to set compilation switches right (enable gprof (-pg) for that project in project properties -> c/c++ build -> Settings -> Debugging). When you have compiled program with this options, you need to run it (until in normally exits). This generates profile file (gmon.out). There is additional plug-in you can install in eclipse, that visualizes the contents of gmon.out (go to Help -> Install -> Linux tools -> GProf integration). Just open generated gmon.out file as you would any other file, once you have that plugin installed.