Profiling with '-a' [was Re: Libgcc symbols]

Nix nix@esperi.demon.co.uk
Mon Apr 16 15:01:00 GMT 2001


On 16 Apr 2001, Scott A. Crosby said:
> I've used basic block profiling once or twice... It can come in handy for,
> for example, figuring out which way a branch tends to go in practice.
> 
> GPROF knows how to use this data (from the texinfo):

Great! Definitely don't junk it then.

I wonder whether all the extra stuff generated by -ax gets used by
anything? (I really should look rather than just asking.)

> I tested this out a year or two ago; it did work for x86. I say to not
> junk it. It works, it is useful, and could be made much more useful in
> terms of profile-based optimization.

... only -fprofile-arcs and -fbranch-probabilities already do that, more
efficiently, as it gets away without instrumenting every bb. It isn't
heavily used that I can tell; I have seen it cause ICEs here and
there. Maybe I should start doing double-bootstraps with arc data...

>                                                   Although currently
> unimplemented, eventualy GCC could be made to use this information for
> profile-based optimization.

That would be inefficient :) -fprofile-arcs already does it better, one
hopes.

> Whats -fbranch-probabilities? Unless it does the same as '-a', don't junk
> '-a'

It doesn't quite do the same. It instruments the minimum possible number
of arcs for branch probability estimation. (It's also used by test
coverage analysis.)

-fprofile-arcs and -ftest-coverage are documented in the GCC manual just
below `-ax', and -fbranch-probabilities is referenced from there.

-- 
`... and it's not true that I'm closely related to the three-toed
 sloth.' --- Kieran



More information about the Gcc mailing list