Debugging and profiling: Difference between revisions

Jump to navigation Jump to search
Line 21: Line 21:
=== Preparing your application ===
=== Preparing your application ===
==== Switch to GNU compiler ====
==== Switch to GNU compiler ====
Run the following command to check whether a GNU compiler is already loaded into the environment:
Load the appropriate GNU compiler. For example, for GCC:
{{Command|module load gcc/5.4.0}}
 
==== Compile your code ====
To get useful information from [https://sourceware.org/binutils/docs/gprof/ Gprof] , you first need to compile your code with debugging information enabled. With the GNU compilers, you do so by adding a "-pg" option on compilation. This option tells the compiler to generate extra code to write profile information suitable for the analysis. If it is not in your compiler options no call-graph data will be gathered and if you run gprof hopping to get the profiling you may get the following error:
{{Command|gprof: gmon.out file is missing call-graph data}}
 
==== Execute your code ====


==Valgrind==
==Valgrind==
Bureaucrats, cc_docs_admin, cc_staff
337

edits

Navigation menu