Re: Help on Gcov

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, all

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?
-  "branch probabilities" is calculated by the compiler even when the
parameters  profile-arcs and ftest-coverage were not used?

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?

Thanks,
Harry

2011/4/6 Ian Lance Taylor <iant@xxxxxxxxxx>
>
> Harry Trinta <harrytpc@xxxxxxxxx> writes:
>
> > - The instrumentator uses any technique to reduce the amount of
> > instrumentation points, for example, dominance?
>
> Yes.
>
> > - I know that the instrumentation is done at compile time. However, it
> > is done in C code or in compiled code ?
>
> I'm not sure I understand this question.  The compiler generates the
> instrumentation code.  It doesn't generate C code.  It just adds
> additional function calls as it compiles.  So perhaps the answer is that
> the instrumentation is done in compiled code.
>
> > - What commands runs when the probes are executed? The probes calls
> > some function in lib? What?
>
> There are several different functions.  They all have names start with
> "__gcov_".
>
> > Now I'd  want to know more about the sources that I have identified as
> > part of gcov:
> >
> > - coverage.c: I do not know.
>
> Generates the .gcno file.  If you don't know what that means, see
> http://gcc.gnu.org/onlinedocs/gcc/Gcov-Data-Files.html .
>
> > - gcov: It is responsible for generating the file. gcov?
>
> Part of the gcov program which turns the .gcda files into a readable
> form.
>
> > - profile:
>
> Branch probability coverage support.
>
> > - gcov-io: Responsible for reading and writing files. gcda and. gcno?
>
> Yes.  Used by both gcov and the runtime library.
>
> > - libgcov: library that supports the execution of the instrumented program?
>
> Yes.
>
> > - tree-profile.c: insert the probes in code?
>
> Yes.
>
> > Which of these files are used during compile? And which of these files
> > are used during program execution?
>
> All of the above are used at compile time except libgcov.  gcov-io is
> used at both compile time and runtime.
>
> Ian



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux