Given how easy it is to profile programs written in C and Fortran, I wonder why many people don't do it. Profiling lets you monitor the performance of your code.
One way to do it is to use GPROF.
Here is how you use it.
1. Compile your code (test.f90) with the -pg flag
gfortran -pg test.f90 (or gcc -pg test.c)
2. Run the program
This creates a report gmon.out, which is unfortunately not in readable format.
3. To read it, say
gprof a.out
You will see a reasonably detailed report on number of function calls and time spent in different parts of the program.
One way to do it is to use GPROF.
Here is how you use it.
1. Compile your code (test.f90) with the -pg flag
gfortran -pg test.f90 (or gcc -pg test.c)
2. Run the program
a.out
This creates a report gmon.out, which is unfortunately not in readable format.
3. To read it, say
gprof a.out
You will see a reasonably detailed report on number of function calls and time spent in different parts of the program.
No comments:
Post a Comment