[ccache] Support for -fprofile-generate, -fprofile-use, -fprofile-arcs
Justin Lebar
justin.lebar at gmail.com
Wed Aug 10 09:03:01 MDT 2011
gcda files are cumulative. Try
$ ./test; md5sum test.gcda; rm test.gcda
hello world
1c14199a60b2e5b9e6f1e96360adc40c test.gcda
$ ./test; md5sum test.gcda; rm test.gcda
hello world
1c14199a60b2e5b9e6f1e96360adc40c test.gcda
On Wed, Aug 10, 2011 at 10:51 AM, Chris AtLee <chris at atlee.ca> wrote:
> On Mon, Aug 8, 2011 at 4:24 PM, Justin Lebar <justin.lebar at gmail.com> wrote:
>>> The .gcda files themselves aren't cached, their contents are used to
>>> calculate the hash for a -fprofile-use run. So if the .o file doesn't
>>> exist, and you have the same .gcda file, you get a cache hit.
>>
>> Ah, I see. What if the .o file does exist? Why should that matter,
>> if gcc is going to overwrite it anyway?
>
> It doesn't really matter..my point was that hopefully your make
> dependencies are set up so you're not calling gcc if you don't need
> to.
>
>> You mentioned earlier that a simple program without branches or loops
>> didn't generate the same .gcda files when the program was run twice.
>> Would you mind including that code? I wrote a pretty simple testcase
>> and observed the opposite result. Maybe it's different in different
>> versions of gcc or something.
>
> I have a simple hello world program. Even if I comment out the printf
> I get different .gcda files after each run.
>
> #include <stdio.h>
>
> int main() {
> printf("hello world\n");
> return 0;
> }
>
> gcc -fprofile-generate -c -o test.o test.c
> gcc -fprofile-generate test.o -o test
> ./test; md5sum test.gcda
> 83fdede120951b154184271416082bdb test.gcda
> ./test; md5sum test.gcda
> 230d10c340e6ae068a7d65b4bc355472 test.gcda
>
More information about the ccache
mailing list