Help on Gcov
Ian Lance Taylor
iant@google.com
Fri Apr 15 14:59:00 GMT 2011
Harry Trinta <harrytpc@gmail.com> writes:
> I have some question about "branch probabilities". I think I don't
> quite understand how this works.
> - What is the purpose of calculating the branch probabilities? The
> propose is to use information about past executions (gcda files) to
> optimize better the program that is compiling?
Yes.
> - "branch probabilities" is calculated by the compiler even when the
> parameters profile-arcs and ftest-coverage were not used?
Yes, but in the absence of profiling information they are just informed
guesses.
> The source coverage.c has a method coverage_init which is called by toplev.c.
> The coverage_init calls the read_counts_file (in coverage.c), wich try
> to open a file gcda. If this method find the file gcda, load the file
> content in a hash (counts_hash) in memory ... Is that right?
> If I'm right, what is the purpose of loading the information from a
> GCDA in memory at compile time? This information is used by the
> compiler only for branch probabilities?
I think also for value profiling. Although it's possible that that data
is stored somewhere else, I haven't looked.
Ian
More information about the Gcc-help
mailing list