diff options
Diffstat (limited to 'src/mongo/db/concurrency/lock_stats.cpp')
-rw-r--r-- | src/mongo/db/concurrency/lock_stats.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/mongo/db/concurrency/lock_stats.cpp b/src/mongo/db/concurrency/lock_stats.cpp index f724c90a240..980b4fd0a5e 100644 --- a/src/mongo/db/concurrency/lock_stats.cpp +++ b/src/mongo/db/concurrency/lock_stats.cpp @@ -42,9 +42,15 @@ LockStats<CounterType>::LockStats() { template <typename CounterType> void LockStats<CounterType>::report(BSONObjBuilder* builder) const { - // All indexing below starts from offset 1, because we do not want to report/account - // position 0, which is a sentinel value for invalid resource/no lock. - for (int i = 1; i < ResourceTypesCount; i++) { + for (uint8_t i = 0; i < static_cast<uint8_t>(ResourceGlobalId::kNumIds); ++i) { + _report(builder, + resourceGlobalIdName(static_cast<ResourceGlobalId>(i)), + _resourceGlobalStats[i]); + } + + // Index starting from offset 2 because position 0 is a sentinel value for invalid resource/no + // lock, and position 1 is the global resource which was already reported above. + for (int i = 2; i < ResourceTypesCount; i++) { _report(builder, resourceTypeName(static_cast<ResourceType>(i)), _stats[i]); } @@ -119,6 +125,12 @@ void LockStats<CounterType>::_report(BSONObjBuilder* builder, template <typename CounterType> void LockStats<CounterType>::reset() { + for (uint8_t i = 0; i < static_cast<uint8_t>(ResourceGlobalId::kNumIds); ++i) { + for (uint8_t mode = 0; mode < LockModesCount; ++mode) { + _resourceGlobalStats[i].modeStats[mode].reset(); + } + } + for (int i = 0; i < ResourceTypesCount; i++) { for (int mode = 0; mode < LockModesCount; mode++) { _stats[i].modeStats[mode].reset(); |