| 1 | # make a temporary environment for profiling only the extension module |
| 2 | |
| 3 | cp ../skfmm/base_marcher.cpp . |
| 4 | cp ../skfmm/base_marcher.h . |
| 5 | cp ../skfmm/distance_marcher.cpp . |
| 6 | cp ../skfmm/distance_marcher.h . |
| 7 | cp ../skfmm/heap.cpp . |
| 8 | cp ../skfmm/heap.h . |
| 9 | |
| 10 | g++ -O2 base_marcher.cpp distance_marcher.cpp heap.cpp prof.cpp -g -pg -o a.out |
| 11 | g++ -O2 base_marcher.cpp distance_marcher.cpp heap.cpp prof.cpp -o clean.out |
| 12 | |
| 13 | time ./clean.out |
| 14 | time ./a.out |
| 15 | gprof ./a.out > output.txt |
| 16 | shark -i -1 -G ./clean.out |
| 17 | |
| 18 | ######################################################################### |
| 19 | # notes on profiling: # |
| 20 | # profile.py corresponds to the case in prof.cpp # |
| 21 | # the python version and the c version are more or less the same speed # |
| 22 | # (when compiled with the same level of optimization!) # |
| 23 | # the call to gprof here lets us to profile the c++ code # |
| 24 | # the python version only sees the cfmm module as a black box. # |
| 25 | # beware that compiling c code with the profiler flags makes it slower # |
| 26 | ######################################################################### |
| 27 | |
| 28 | # on os x: shark -i -1 -G my_program <my_program options> |
| 29 | |
| 30 | # to check for memory leaks |
| 31 | #g++ -O1 prof.cpp fast_marching.cpp heap.cpp -g -o a2.out |
| 32 | #valgrind --leak-check=yes ./a2.out |
| 33 |