Gprof: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 1: Line 1:
{{Draft}}
 
=GNU Profiler (gprof) =
=GNU Profiler (gprof) =
== What is Gprof ? ==
== What is Gprof ? ==
Line 9: Line 9:
=== Switch to GNU compiler ===
=== Switch to GNU compiler ===
Load the appropriate GNU compiler. For example, for GCC:
Load the appropriate GNU compiler. For example, for GCC:
{{Command|module load gcc/5.4.0}}
{{Command|module load gcc/7.3.0}}


=== Compile your code ===
=== Compile your code ===
Line 25: Line 25:
In this step the Gprof tool is executed again with the binary name and the above mentioned <tt>gmon.out</tt> as argument. This should create an analysis file with all the desired profiling information.
In this step the Gprof tool is executed again with the binary name and the above mentioned <tt>gmon.out</tt> as argument. This should create an analysis file with all the desired profiling information.
{{Command|gprof /path/to/your/executable gmon.out > analysis.txt}}
{{Command|gprof /path/to/your/executable gmon.out > analysis.txt}}
We can notice that the new file analysis.txt was generated.
We can see that the new file <tt>analysis.txt</tt> has been created in the current working directory.
Bureaucrats, cc_docs_admin, cc_staff
2,314

edits

Navigation menu