CMakeLIsts.txt
file: set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")Note: If you are interested in timing code that is in libraries used by the program, local copies of the libraries of interest need to be created, the above lines put in their
set (FFLAGS "-pg") # For profiling
set (CFLAGS "-pg")
CMakeLists.txt
files, and the libraries recompiled.
gprof exe-file > gprof.infowhere exe-file is the name of the executable file. This will create a file gprof.info (but any name can be used here instead).