Debugging and profiling: Difference between revisions

Line 26: Line 26:
==== Compile your code ====
==== 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:
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}}
<pre>
 
gprof: gmon.out file is missing call-graph data
</pre>
==== Execute your code ====
==== Execute your code ====


Bureaucrats, cc_docs_admin, cc_staff
337

edits