summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Noma <gregory.noma@gmail.com>2023-05-17 15:20:17 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-17 16:26:57 +0000
commitb46ba042fdce866cb42bca247febecde398fd1c4 (patch)
tree946a1ba76625ab96df7c0260df11e90c3325b76c
parent4f358bd58f40f37d2bcdc7d941890489ed5aa7a1 (diff)
downloadmongo-b46ba042fdce866cb42bca247febecde398fd1c4.tar.gz
SERVER-77153 Protect against zero elapsed time in throughput probing
-rw-r--r--src/mongo/db/storage/execution_control/throughput_probing.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/db/storage/execution_control/throughput_probing.cpp b/src/mongo/db/storage/execution_control/throughput_probing.cpp
index 67201bd9032..d18ed17dd73 100644
--- a/src/mongo/db/storage/execution_control/throughput_probing.cpp
+++ b/src/mongo/db/storage/execution_control/throughput_probing.cpp
@@ -111,6 +111,12 @@ void ThroughputProbing::_run(Client* client) {
}
double elapsed = _timer.micros();
+ if (elapsed == 0) {
+ // The clock used to sleep between iterations may not be reliable, and thus the timer may
+ // report that no time has elapsed. If this occurs, just wait for the next iteration.
+ return;
+ }
+
auto throughput = (numFinishedProcessing - _prevNumFinishedProcessing) / elapsed;
_stats.opsPerSec.store(throughput * 1'000'000);