Linux Eclipse CDT profiler

前端 未结 2 2022
猫巷女王i
猫巷女王i 2021-02-07 11:36

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 als

2条回答
  •  后悔当初
    2021-02-07 11:48

    As mentioned by dbrank0 you need to set the compilation option (-pg) for that project. Go to project properties -> c/c++ build -> Settings -> C++ compiler -> Debugging and check generate gpof information. When you compile the program(test_prof.c) you will get an exe file(in our case test_prof).

    $ ls
    test_gprof  test_gprof.c
    

    and when you run it there will be a gmon.out file generated in the same directory.

    $ ls
    gmon.out  test_gprof  test_gprof.c
    

    The gprof tool is run with the executable name and the above generated ‘gmon.out’ as argument. This produces an analysis file which contains all the desired profiling information.

    $  gprof test_gprof gmon.out > analysis.txt
    

    A file named ‘analysis.txt’ will be generated which contains all the profilig information and can be easily read out. For further details look at http://www.thegeekstuff.com/2012/08/gprof-tutorial/

提交回复
热议问题