Use F14FastMap with SharedMutex for profiles
commitfd595c71966566259a830af63f32a124aea87018
authorMichael Colavita <mcolavita@fb.com>
Tue, 1 Dec 2020 04:19:01 +0000 (30 20:19 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 1 Dec 2020 04:21:40 +0000 (30 20:21 -0800)
tree75d90b227fc8e6e873b451d02e6d78cd6962f9e2
parent9b9e0aeeb6f71cc83d43c1d10d7b3ad36d0cbc77
Use F14FastMap with SharedMutex for profiles

Summary:
Maps contained within the LoggingProfiles and SinkProfiles are converted to F14FastMaps with a mutex for synchronization. Because iterators are only invalidated upon insertion/deletion, we hold a reader lock when modifying values and a writer lock when inserting values.

We also introduce a wrapper around std::atomic called CopyAtomic. Containers without node indirection require their value types to be either move or copy constructible in order to support resizing operations. std::atomic does not offer these constructors due to atomicity concerns. As we guarantee that resizing operations are synchronized wrt holding the write mutex, we provide such copy constructors for the atomic value.

Differential Revision: D25223031

fbshipit-source-id: 8eddb31468d55999915c30fba921a9909006432c
hphp/runtime/base/bespoke/logging-profile.cpp
hphp/runtime/base/bespoke/logging-profile.h
hphp/util/functional.h