summaryrefslogtreecommitdiff
path: root/src/mongo/db/server_transactions_metrics.cpp
diff options
context:
space:
mode:
authorNathan Louie <nathan.louie@10gen.com>2018-06-11 15:25:05 -0400
committerNathan Louie <nathan.louie@10gen.com>2018-06-18 17:17:35 -0400
commit2a81c6190985975913fe75dace4fd157b8e82590 (patch)
tree14cc55da81e9ab4360c8e9b6405ceae6ee62b06d /src/mongo/db/server_transactions_metrics.cpp
parent013b82bf5f58bd7de8ae2f4d28d24f82afa22e64 (diff)
downloadmongo-2a81c6190985975913fe75dace4fd157b8e82590.tar.gz
SERVER-35149 Track total number of open transactions in ServerTransactionsMetrics
Diffstat (limited to 'src/mongo/db/server_transactions_metrics.cpp')
-rw-r--r--src/mongo/db/server_transactions_metrics.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/server_transactions_metrics.cpp b/src/mongo/db/server_transactions_metrics.cpp
index fe31687f288..07319300f74 100644
--- a/src/mongo/db/server_transactions_metrics.cpp
+++ b/src/mongo/db/server_transactions_metrics.cpp
@@ -51,6 +51,18 @@ ServerTransactionsMetrics* ServerTransactionsMetrics::get(OperationContext* opCt
return get(opCtx->getServiceContext());
}
+unsigned long long ServerTransactionsMetrics::getCurrentOpen() const {
+ return _currentOpen.load();
+}
+
+void ServerTransactionsMetrics::decrementCurrentOpen() {
+ _currentOpen.fetchAndSubtract(1);
+}
+
+void ServerTransactionsMetrics::incrementCurrentOpen() {
+ _currentOpen.fetchAndAdd(1);
+}
+
unsigned long long ServerTransactionsMetrics::getTotalStarted() const {
return _totalStarted.load();
}