This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Basic block profiling info for gprof
On 5/24/07, Nick Clifton <nickc@redhat.com> wrote:
Hi Mohamed,
>> What information does it produce ?
> For gprof -i
>
> File `gmon.out' (version 1) contains:
> 1 histogram record
> 1 call-graph record
> 0 basic-block count records
Hmm, yes it appears the glibc's profiling output no longer includes
basic-block counts.
But i can find code in glibc/gmon/gmon.c (write_bb_counts) to dump
basic block profiling information into gmon.out.
So can i assume that if the information from gmon.out is available to
gprof, it can actually dump this information but the native compiler
is not producing any information for basic block profiling in
gmon.out?
> 1 -> c = crc;
> 1 -> if (n) do {
> 1 -> c = 0xfff + n;
> 1 -> } while (--n);
Quick note - with optimization turned on this do-while loop will
disappear, since the computation of the value of "c" can be moved
outside of the loop.
I am not using any optimization for the above code.
It appears that if you want basic-block profiling you now have to use
the gcov tool, like this:
% gcc --coverage 1.c
% ./a.out
% gcov 1.c
File 'gprof.c'
Lines executed:93.33% of 15
gprof.c:creating 'gprof.c.gcov'
% cat 1.c.gcov
...
1: 12: c = crc;
1: 13: if (n) do {
4: 14: c = 0xfff + n;
4: 15: } while (--n);
...
The gprof manual should be updated to reflect this...
So i will have to infer that gcc is no longer producing any basic
block profiling information that can be used by gprof and basic block
profiling is now done using gcov for which gcc is producing the
required information. Is that right?
Thanks for your time.
Regards,
shafi