Hi everyone
I'm using the Intel Fortran Compiler (v. 12.0.3) on Linux. I'd like to perform profiling with gprof and get a basic block count, but all I have managed to obtain is a count on the program/subroutine/function level. My conclusion is that I've got the compiler flags wrong, but despite looking on the web and reading the ifort man page I can't figure out what I should be doing instead of what I am doing...
There are the flags I use when compiling:
-w -O0 -g -pg -prof-gen
I also tried leaving out -pg (an instruction I had read somewhere), but then I got no output at all.
I know this is no gprof-forum, but anyway, here's how I invoke this tool:
gprof -l -A -x path/to/exe gmon.out > OUT
At first it looks as if all lines were labelled with how often they were ran, but it turns out that each block/line simply obtains the procedure count (in the following short example the function was called 43679 times, and both 'if' and 'else', for example, got labelled with 43679, which makes no sense):
43679 -> function variance_from_index (indices,array)
! declarations
43679 -> if (ubound(indices,1).eq.2) then
43679 -> variance_from_index = array(indices(1),indices(2))
else
43679 -> do i=1,ubound(indices,1)-1
43679 -> do j=i+1,ubound(indices,1)
43679 -> items(1:2) = (/indices(i),indices(j)/)
If someone on here could help me get the correct counts, I'd be very grateful indeed.


