central controller metrics & request path updates (#2012)

* internal db metrics

* use shared mutexes for read/write locks

* remove this lock. only used for a metric

* more metrics

* remove exploratory metrics

place controller request benchmarks behind ifdef
This commit is contained in:
Grant Limberg 2023-05-23 12:11:26 -07:00 committed by GitHub
parent da71e2524c
commit 17f6b3a10b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 307 additions and 80 deletions

View file

@ -18,7 +18,7 @@
#include <vector>
#include <memory>
#include <mutex>
#include <shared_mutex>
#include <set>
#include <thread>
@ -56,7 +56,7 @@ public:
inline void addDB(const std::shared_ptr<DB> &db)
{
db->addListener(this);
std::lock_guard<std::mutex> l(_dbs_l);
std::unique_lock<std::shared_mutex> l(_dbs_l);
_dbs.push_back(db);
}
@ -65,7 +65,7 @@ private:
std::atomic_bool _running;
std::thread _syncCheckerThread;
std::vector< std::shared_ptr< DB > > _dbs;
mutable std::mutex _dbs_l;
mutable std::shared_mutex _dbs_l;
};
} // namespace ZeroTier