summaryrefslogtreecommitdiff
path: root/src/mongo/util/elapsed_tracker.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2013-11-22 16:47:11 -0500
committerMathias Stearn <mathias@10gen.com>2013-11-22 16:47:11 -0500
commitf267bf1ff81e02185ef2a316aefa31c6459234f9 (patch)
treece2325d4ac84d702a46964a12a41e3ffdaaa9656 /src/mongo/util/elapsed_tracker.cpp
parent0b4202bb531dbdccd87215396ccb3726f55c1421 (diff)
downloadmongo-f267bf1ff81e02185ef2a316aefa31c6459234f9.tar.gz
SERVER-10566 Don't use modulus in ElapsedTracker
Diffstat (limited to 'src/mongo/util/elapsed_tracker.cpp')
-rw-r--r--src/mongo/util/elapsed_tracker.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/util/elapsed_tracker.cpp b/src/mongo/util/elapsed_tracker.cpp
index 07f72598f02..becbdda1cae 100644
--- a/src/mongo/util/elapsed_tracker.cpp
+++ b/src/mongo/util/elapsed_tracker.cpp
@@ -44,13 +44,15 @@ namespace mongo {
}
bool ElapsedTracker::intervalHasElapsed() {
- if ( ( ++_pings % _hitsBetweenMarks ) == 0 ) {
+ if ( ++_pings >= _hitsBetweenMarks ) {
+ _pings = 0;
_last = Listener::getElapsedTimeMillis();
return true;
}
long long now = Listener::getElapsedTimeMillis();
if ( now - _last > _msBetweenMarks ) {
+ _pings = 0;
_last = now;
return true;
}
@@ -59,6 +61,7 @@ namespace mongo {
}
void ElapsedTracker::resetLastTime() {
+ _pings = 0;
_last = Listener::getElapsedTimeMillis();
}