diff options
author | Mihai Andrei <mihai.andrei@10gen.com> | 2022-01-31 18:06:17 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-01-31 18:37:17 +0000 |
commit | f5dbab9f268eae5471fdbf2c2660fdec240f80ec (patch) | |
tree | 9fb21ca8936008f7b16f9d667d396f46480e6270 /src/mongo/db/stats | |
parent | 539ce23761785a90ac28da2ab40203ea0fdf59b1 (diff) | |
download | mongo-f5dbab9f268eae5471fdbf2c2660fdec240f80ec.tar.gz |
SERVER-62674 Add stats tracking for multiple collections
Diffstat (limited to 'src/mongo/db/stats')
-rw-r--r-- | src/mongo/db/stats/top.cpp | 12 | ||||
-rw-r--r-- | src/mongo/db/stats/top.h | 11 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/mongo/db/stats/top.cpp b/src/mongo/db/stats/top.cpp index 1674fe394d6..513b7fae754 100644 --- a/src/mongo/db/stats/top.cpp +++ b/src/mongo/db/stats/top.cpp @@ -88,6 +88,18 @@ void Top::record(OperationContext* opCtx, _record(opCtx, coll, logicalOp, lockType, micros, readWriteType); } +void Top::record(OperationContext* opCtx, + const std::set<NamespaceString>& nssSet, + LogicalOp logicalOp, + LockType lockType, + long long micros, + bool command, + Command::ReadWriteType readWriteType) { + for (const auto& nss : nssSet) { + record(opCtx, nss.ns(), logicalOp, lockType, micros, command, readWriteType); + } +} + void Top::_record(OperationContext* opCtx, CollectionData& c, LogicalOp logicalOp, diff --git a/src/mongo/db/stats/top.h b/src/mongo/db/stats/top.h index 5aa3034688b..358dc5d7164 100644 --- a/src/mongo/db/stats/top.h +++ b/src/mongo/db/stats/top.h @@ -104,6 +104,17 @@ public: bool command, Command::ReadWriteType readWriteType); + /** + * Same as the above, but for multiple namespaces. + */ + void record(OperationContext* opCtx, + const std::set<NamespaceString>& nssSet, + LogicalOp logicalOp, + LockType lockType, + long long micros, + bool command, + Command::ReadWriteType readWriteType); + void append(BSONObjBuilder& b); void cloneMap(UsageMap& out) const; |