AutoStatsTracker::~AutoStatsTracker() { auto curOp = CurOp::get(_opCtx); Top::get(_opCtx->getServiceContext()) .record(_opCtx, curOp->getNS(), curOp->getLogicalOp(), _lockType, durationCount<Microseconds>(curOp->elapsedTimeExcludingPauses()), curOp->isCommand(), curOp->getReadWriteType()); }
AutoGetCollectionForRead::~AutoGetCollectionForRead() { // Report time spent in read lock auto currentOp = CurOp::get(_txn); Top::get(_txn->getClient()->getServiceContext()) .record(_txn, currentOp->getNS(), currentOp->getLogicalOp(), -1, // "read locked" _timer.micros(), currentOp->isCommand(), currentOp->getReadWriteType()); }
void recordStatsForTopCommand(OperationContext* txn) { auto curOp = CurOp::get(txn); const int writeLocked = 1; Top::get(txn->getClient()->getServiceContext()) .record(txn, curOp->getNS(), curOp->getLogicalOp(), writeLocked, curOp->elapsedMicros(), curOp->isCommand(), curOp->getReadWriteType()); }
OldClientContext::~OldClientContext() { // Lock must still be held invariant(_txn->lockState()->isLocked()); auto currentOp = CurOp::get(_txn); Top::get(_txn->getClient()->getServiceContext()) .record(_txn, currentOp->getNS(), currentOp->getLogicalOp(), _txn->lockState()->isWriteLocked() ? 1 : -1, _timer.micros(), currentOp->isCommand(), currentOp->getReadWriteType()); }