Thread-safe profiling

Tristan Gingold
Thu Mar 15 16:50:00 GMT 2007

On Mar 15, 2007, at 4:24 PM, Ian Lance Taylor wrote:

> Jan Hubicka <> writes:
>> Trying to imagine what random user would find more discourgrating  
>> - ie
>> longer train runs (still probably quite shorter than in ICC) or weird
>> looking mismatches and/or wrong resulting profile, I guess the  
>> former is
>> lesser evil and easier to analyze.
> It seems to me that the alternative to thread-safe profiling should
> just be that some nodes are undercounted, when two threads try to
> update the count simultaneously.  It shouldn't be wildly wrong, just
> slightly wrong.
The current code use 64 bits counters.  Non atomic increment on 32  
bits platform may produce weird result
(ie jumping from 0xfffffffe to 0).

Are 32 bits counters too short ?

Also, for coverage we are thinking about a 1 byte (atomic) flag.   
Setting it to 1 shouldn't be racy.


More information about the Gcc-patches mailing list