mardi 31 juillet 2007

gcc -a

in man pages of gcc 3

       -a  Generate extra code to write profile information for
basic blocks, which will record the number of times
each basic block is executed, the basic block start
address, and the function name containing the basic
block. If -g is used, the line number and filename of
the start of the basic block will also be recorded.
If not overridden by the machine description, the
default action is to append to the text file bb.out.

This data could be analyzed by a program like "tcov".
Note, however, that the format of the data is not what
"tcov" expects. Eventually GNU "gprof" should be
extended to process this data.

This option was remove from gcc4 !
In http://gcc.gnu.org/gcc-4.1/changes.html

Transition of basic block profiling to tree level implementation has been completed. The new implementation should be considerably more reliable (hopefully avoiding profile mismatch errors when using -fprofile-use or -fbranch-probabilities) and can be used to drive higher level optimizations, such as inlining.

The -ftree-based-profiling command line option was removed and -fprofile-use now implies disabling old RTL level loop optimizer (-fno-loop-optimize). Speculative prefetching optimization (originally enabled by -fspeculative-prefetching) was removed.

What is tree level implementation ?
mmmh I'm thinking about installing gcc-3.4
... done
Warg it's the same.

There is also the thread:
http://www.cygwin.com/ml/binutils/2007-05/msg00345.html
and
http://gcc.gnu.org/ml/gcc/2001-08/msg01385.html

So I have to use gcov !

Aucun commentaire: