diff options
author | Andy Schwerin <schwerin@mongodb.com> | 2015-05-29 13:50:42 -0400 |
---|---|---|
committer | Andy Schwerin <schwerin@mongodb.com> | 2015-06-05 14:21:56 -0400 |
commit | f4ca1b7eb3850719049d938b4b4562b6324ec284 (patch) | |
tree | ee6b74b1321a5f8ee622bad55e9d959442d9e6e5 /src/mongo/db/db_raii.cpp | |
parent | 51c2064d518140fbeae62f9d7ba29f1d69fb530f (diff) | |
download | mongo-f4ca1b7eb3850719049d938b4b4562b6324ec284.tar.gz |
SERVER-18277 Get references to the Top object out of CurOp.
Diffstat (limited to 'src/mongo/db/db_raii.cpp')
-rw-r--r-- | src/mongo/db/db_raii.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/mongo/db/db_raii.cpp b/src/mongo/db/db_raii.cpp index a4c52b97cc6..b1a6c0037b2 100644 --- a/src/mongo/db/db_raii.cpp +++ b/src/mongo/db/db_raii.cpp @@ -33,6 +33,7 @@ #include "mongo/db/catalog/database_holder.h" #include "mongo/db/client.h" #include "mongo/db/curop.h" +#include "mongo/db/stats/top.h" #include "mongo/s/d_state.h" namespace mongo { @@ -108,7 +109,13 @@ namespace mongo { AutoGetCollectionForRead::~AutoGetCollectionForRead() { // Report time spent in read lock - CurOp::get(_txn)->recordGlobalTime(false, _timer.micros()); + auto currentOp = CurOp::get(_txn); + Top::get(_txn->getClient()->getServiceContext()).record( + currentOp->getNS(), + currentOp->getOp(), + -1, // "read locked" + _timer.micros(), + currentOp->isCommand()); } @@ -178,7 +185,13 @@ namespace mongo { // Lock must still be held invariant(_txn->lockState()->isLocked()); - CurOp::get(_txn)->recordGlobalTime(_txn->lockState()->isWriteLocked(), _timer.micros()); + auto currentOp = CurOp::get(_txn); + Top::get(_txn->getClient()->getServiceContext()).record( + currentOp->getNS(), + currentOp->getOp(), + _txn->lockState()->isWriteLocked() ? 1 : -1, + _timer.micros(), + currentOp->isCommand()); } |