This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Thread-safety of a profiled binary (and GCOV runtime library)


On 07/25/16 08:14, Richard Biener wrote:

There's pthread_detach () - do we wrap that appropriately?  That said, another
way to make counters thread-safe is to allocate per-thread counters and update
those (for example by making the counters __TLS).  The interesting part is then
to merge them with the main set of counters during thread exit (properly locked
or atomically of course).  This would also solve the above mentioned issue but
have quite a cost on the memory side.

I'm not aware of any of the pthread fns being wrapped. (IIRC it's fork, execFOO and exit).

As you say, having TLS counters would increase memory, but I have no feel for the relative increase it might be in codebases it'd affect. Compute-wise it's probably no more expensive than using atomic adds, probably cheaper, if the atomic ops are fn calls.

nathan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]