[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

Alexandre Ganea via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 13 10:36:48 PDT 2024


aganea wrote:

I think in the short term @jansvoboda11's suggestion should be good enough.

Bit if we want `Statistics` to be always cheap, we should make them `thread_local` instead, not atomic. `getValue()` could do the "collection" of data over all active, or past threads.  It would also need a mechanism for collecting data when a thread ends through `pthread_key_create/FlsCallback`s.  It would be a bit more involved than what's there currently, but that should fix the issue I'm seeing (and maybe others).

https://github.com/llvm/llvm-project/pull/88427


More information about the cfe-commits mailing list