gnu.gcc.help
[Top] [All Lists]

profiling : inconsistencies with gprof

Subject: profiling : inconsistencies with gprof
From: "bencteux"
Date: 15 Jun 2006 08:42:18 -0700
Newsgroups: gnu.gcc.help
Hello,
I am implementing an algorithm within fortran and g77/gcc (3.3.5), on
debian sarge.

I have tried two possibilities to perform profiling :
1) using the  function second(), to have the CPU spent between two
instructions
2) using gprof : all source files have been compiled with -pg option

gprof gives some strange results. The algorithm consists in two main
steps, say step A and step B.
The usual way is to have alternatively one step A, then one step B. But
if I have 2 steps A for 1 step B, gprof do not show that double  time
is spent in step A, whereas the figures based on the functions "second"
do.

More puzzling : in a run,  gprof reports that step A and step B consume
almost the same time, whereas the figures got with "second" shows that
step B is taking 90% ot the total time. These deviations are very
disturbing in the view of profiling my code !!!

Did I make something wrong using gprof ?

Thank you for your help
Guy Bencteux


<Prev in Thread] Current Thread [Next in Thread>