Profiling C and Fortran Code with gprof ======================================= Author: Momchil Ivanov Date : 2014.10.02 Introduction ------------ This article contains notes on how to profile C and Fortran code with gprof. Requirements ------------ - gprof2dot.py from [1] - python - graphviz Howto ----- 1. Compile program with profiling. 2. Run program, the profiler generates a file gmon.out. 3. To generate a call tree from the profiling statistic use: $ gprof a.out | gprof2dot.py | dot -Tpng -oa.png where a.out is the program, a.png is the output graphic representation of the call tree containing the relevant statistic information as numbers and color code: red means more time, blue means less. Compiling with gcc ------------------ Compile your program with "-pg". Compiling with ifort -------------------- Compile your program with "-pg". References ---------- 1: https://code.google.com/p/jrfonseca/wiki/Gprof2Dot