diff options
Diffstat (limited to 'src/mongo/db/stats')
-rw-r--r-- | src/mongo/db/stats/latency_server_status_section.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/stats/lock_server_status_section.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/stats/range_deleter_server_status.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/stats/snapshots_webplugins.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/stats/storage_stats.cpp | 22 | ||||
-rw-r--r-- | src/mongo/db/stats/storage_stats.h | 2 | ||||
-rw-r--r-- | src/mongo/db/stats/top.cpp | 16 | ||||
-rw-r--r-- | src/mongo/db/stats/top.h | 8 |
8 files changed, 33 insertions, 31 deletions
diff --git a/src/mongo/db/stats/latency_server_status_section.cpp b/src/mongo/db/stats/latency_server_status_section.cpp index 41bccf2071f..a7087586561 100644 --- a/src/mongo/db/stats/latency_server_status_section.cpp +++ b/src/mongo/db/stats/latency_server_status_section.cpp @@ -46,13 +46,13 @@ public: return true; } - BSONObj generateSection(OperationContext* txn, const BSONElement& configElem) const { + BSONObj generateSection(OperationContext* opCtx, const BSONElement& configElem) const { BSONObjBuilder latencyBuilder; bool includeHistograms = false; if (configElem.type() == BSONType::Object) { includeHistograms = configElem.Obj()["histograms"].trueValue(); } - Top::get(txn->getServiceContext()) + Top::get(opCtx->getServiceContext()) .appendGlobalLatencyStats(includeHistograms, &latencyBuilder); return latencyBuilder.obj(); } diff --git a/src/mongo/db/stats/lock_server_status_section.cpp b/src/mongo/db/stats/lock_server_status_section.cpp index c6cde40d0ad..7884259ac4f 100644 --- a/src/mongo/db/stats/lock_server_status_section.cpp +++ b/src/mongo/db/stats/lock_server_status_section.cpp @@ -49,11 +49,12 @@ public: return true; } - virtual BSONObj generateSection(OperationContext* txn, const BSONElement& configElement) const { + virtual BSONObj generateSection(OperationContext* opCtx, + const BSONElement& configElement) const { std::valarray<int> clientStatusCounts(5); // This returns the blocked lock states - for (ServiceContext::LockedClientsCursor cursor(txn->getClient()->getServiceContext()); + for (ServiceContext::LockedClientsCursor cursor(opCtx->getClient()->getServiceContext()); Client* client = cursor.next();) { invariant(client); stdx::unique_lock<Client> uniqueLock(*client); @@ -108,7 +109,8 @@ public: return true; } - virtual BSONObj generateSection(OperationContext* txn, const BSONElement& configElement) const { + virtual BSONObj generateSection(OperationContext* opCtx, + const BSONElement& configElement) const { BSONObjBuilder ret; SingleThreadedLockStats stats; diff --git a/src/mongo/db/stats/range_deleter_server_status.cpp b/src/mongo/db/stats/range_deleter_server_status.cpp index 817ffa444e4..1c62a30fef5 100644 --- a/src/mongo/db/stats/range_deleter_server_status.cpp +++ b/src/mongo/db/stats/range_deleter_server_status.cpp @@ -58,7 +58,7 @@ public: return false; } - BSONObj generateSection(OperationContext* txn, const BSONElement& configElement) const { + BSONObj generateSection(OperationContext* opCtx, const BSONElement& configElement) const { RangeDeleter* deleter = getDeleter(); if (!deleter) { return BSONObj(); diff --git a/src/mongo/db/stats/snapshots_webplugins.cpp b/src/mongo/db/stats/snapshots_webplugins.cpp index 5d14482e973..c45d827ebf3 100644 --- a/src/mongo/db/stats/snapshots_webplugins.cpp +++ b/src/mongo/db/stats/snapshots_webplugins.cpp @@ -87,7 +87,7 @@ public: ss << "</tr>\n"; } - void run(OperationContext* txn, stringstream& ss) { + void run(OperationContext* opCtx, stringstream& ss) { StatusWith<SnapshotDiff> diff = statsSnapshots.computeDelta(); if (!diff.isOK()) diff --git a/src/mongo/db/stats/storage_stats.cpp b/src/mongo/db/stats/storage_stats.cpp index f741f7fe482..8a9a343f31a 100644 --- a/src/mongo/db/stats/storage_stats.cpp +++ b/src/mongo/db/stats/storage_stats.cpp @@ -38,7 +38,7 @@ namespace mongo { -Status appendCollectionStorageStats(OperationContext* txn, +Status appendCollectionStorageStats(OperationContext* opCtx, const NamespaceString& nss, const BSONObj& param, BSONObjBuilder* result) { @@ -54,7 +54,7 @@ Status appendCollectionStorageStats(OperationContext* txn, bool verbose = param["verbose"].trueValue(); - AutoGetCollectionForRead ctx(txn, nss); + AutoGetCollectionForRead ctx(opCtx, nss); if (!ctx.getDb()) { return {ErrorCodes::BadValue, str::stream() << "Database [" << nss.db().toString() << "] not found."}; @@ -66,34 +66,34 @@ Status appendCollectionStorageStats(OperationContext* txn, str::stream() << "Collection [" << nss.toString() << "] not found."}; } - long long size = collection->dataSize(txn) / scale; + long long size = collection->dataSize(opCtx) / scale; result->appendNumber("size", size); - long long numRecords = collection->numRecords(txn); + long long numRecords = collection->numRecords(opCtx); result->appendNumber("count", numRecords); if (numRecords) - result->append("avgObjSize", collection->averageObjectSize(txn)); + result->append("avgObjSize", collection->averageObjectSize(opCtx)); RecordStore* recordStore = collection->getRecordStore(); result->appendNumber( "storageSize", - static_cast<long long>(recordStore->storageSize(txn, result, verbose ? 1 : 0)) / scale); + static_cast<long long>(recordStore->storageSize(opCtx, result, verbose ? 1 : 0)) / scale); - recordStore->appendCustomStats(txn, result, scale); + recordStore->appendCustomStats(opCtx, result, scale); IndexCatalog* indexCatalog = collection->getIndexCatalog(); - result->append("nindexes", indexCatalog->numIndexesReady(txn)); + result->append("nindexes", indexCatalog->numIndexesReady(opCtx)); BSONObjBuilder indexDetails; - IndexCatalog::IndexIterator i = indexCatalog->getIndexIterator(txn, false); + IndexCatalog::IndexIterator i = indexCatalog->getIndexIterator(opCtx, false); while (i.more()) { const IndexDescriptor* descriptor = i.next(); IndexAccessMethod* iam = indexCatalog->getIndex(descriptor); invariant(iam); BSONObjBuilder bob; - if (iam->appendCustomStats(txn, &bob, scale)) { + if (iam->appendCustomStats(opCtx, &bob, scale)) { indexDetails.append(descriptor->indexName(), bob.obj()); } } @@ -101,7 +101,7 @@ Status appendCollectionStorageStats(OperationContext* txn, result->append("indexDetails", indexDetails.obj()); BSONObjBuilder indexSizes; - long long indexSize = collection->getIndexSize(txn, &indexSizes, scale); + long long indexSize = collection->getIndexSize(opCtx, &indexSizes, scale); result->appendNumber("totalIndexSize", indexSize / scale); result->append("indexSizes", indexSizes.obj()); diff --git a/src/mongo/db/stats/storage_stats.h b/src/mongo/db/stats/storage_stats.h index 531fc3c4688..0f62229c80a 100644 --- a/src/mongo/db/stats/storage_stats.h +++ b/src/mongo/db/stats/storage_stats.h @@ -40,7 +40,7 @@ namespace mongo { * Appends to 'builder' storage related statistics for the collection represented by 'nss'. * Used by both the collStats command and the $collStats aggregation stage. */ -Status appendCollectionStorageStats(OperationContext* txn, +Status appendCollectionStorageStats(OperationContext* opCtx, const NamespaceString& nss, const BSONObj& param, BSONObjBuilder* builder); diff --git a/src/mongo/db/stats/top.cpp b/src/mongo/db/stats/top.cpp index 413c5f1c015..8a8358030b8 100644 --- a/src/mongo/db/stats/top.cpp +++ b/src/mongo/db/stats/top.cpp @@ -72,7 +72,7 @@ Top& Top::get(ServiceContext* service) { return getTop(service); } -void Top::record(OperationContext* txn, +void Top::record(OperationContext* opCtx, StringData ns, LogicalOp logicalOp, int lockType, @@ -91,17 +91,17 @@ void Top::record(OperationContext* txn, } CollectionData& coll = _usage[hashedNs]; - _record(txn, coll, logicalOp, lockType, micros, readWriteType); + _record(opCtx, coll, logicalOp, lockType, micros, readWriteType); } -void Top::_record(OperationContext* txn, +void Top::_record(OperationContext* opCtx, CollectionData& c, LogicalOp logicalOp, int lockType, long long micros, Command::ReadWriteType readWriteType) { - _incrementHistogram(txn, micros, &c.opLatencyHistogram, readWriteType); + _incrementHistogram(opCtx, micros, &c.opLatencyHistogram, readWriteType); c.total.inc(micros); @@ -206,11 +206,11 @@ void Top::appendLatencyStats(StringData ns, bool includeHistograms, BSONObjBuild builder->append("latencyStats", latencyStatsBuilder.obj()); } -void Top::incrementGlobalLatencyStats(OperationContext* txn, +void Top::incrementGlobalLatencyStats(OperationContext* opCtx, uint64_t latency, Command::ReadWriteType readWriteType) { stdx::lock_guard<SimpleMutex> guard(_lock); - _incrementHistogram(txn, latency, &_globalHistogramStats, readWriteType); + _incrementHistogram(opCtx, latency, &_globalHistogramStats, readWriteType); } void Top::appendGlobalLatencyStats(bool includeHistograms, BSONObjBuilder* builder) { @@ -218,12 +218,12 @@ void Top::appendGlobalLatencyStats(bool includeHistograms, BSONObjBuilder* build _globalHistogramStats.append(includeHistograms, builder); } -void Top::_incrementHistogram(OperationContext* txn, +void Top::_incrementHistogram(OperationContext* opCtx, long long latency, OperationLatencyHistogram* histogram, Command::ReadWriteType readWriteType) { // Only update histogram if operation came from a user. - Client* client = txn->getClient(); + Client* client = opCtx->getClient(); if (client->isFromUserConnection() && !client->isInDirectClient()) { histogram->increment(latency, readWriteType); } diff --git a/src/mongo/db/stats/top.h b/src/mongo/db/stats/top.h index 903b8e5c510..1f08e4784a5 100644 --- a/src/mongo/db/stats/top.h +++ b/src/mongo/db/stats/top.h @@ -87,7 +87,7 @@ public: typedef StringMap<CollectionData> UsageMap; public: - void record(OperationContext* txn, + void record(OperationContext* opCtx, StringData ns, LogicalOp logicalOp, int lockType, @@ -109,7 +109,7 @@ public: /** * Increments the global histogram. */ - void incrementGlobalLatencyStats(OperationContext* txn, + void incrementGlobalLatencyStats(OperationContext* opCtx, uint64_t latency, Command::ReadWriteType readWriteType); @@ -123,14 +123,14 @@ private: void _appendStatsEntry(BSONObjBuilder& b, const char* statsName, const UsageData& map) const; - void _record(OperationContext* txn, + void _record(OperationContext* opCtx, CollectionData& c, LogicalOp logicalOp, int lockType, long long micros, Command::ReadWriteType readWriteType); - void _incrementHistogram(OperationContext* txn, + void _incrementHistogram(OperationContext* opCtx, long long latency, OperationLatencyHistogram* histogram, Command::ReadWriteType readWriteType); |