summaryrefslogtreecommitdiff
path: root/src/mongo/util/elapsed_tracker.cpp
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-20 00:22:50 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-20 10:56:02 -0400
commit9c2ed42daa8fbbef4a919c21ec564e2db55e8d60 (patch)
tree3814f79c10d7b490948d8cb7b112ac1dd41ceff1 /src/mongo/util/elapsed_tracker.cpp
parent01965cf52bce6976637ecb8f4a622aeb05ab256a (diff)
downloadmongo-9c2ed42daa8fbbef4a919c21ec564e2db55e8d60.tar.gz
SERVER-18579: Clang-Format - reformat code, no comment reflow
Diffstat (limited to 'src/mongo/util/elapsed_tracker.cpp')
-rw-r--r--src/mongo/util/elapsed_tracker.cpp47
1 files changed, 23 insertions, 24 deletions
diff --git a/src/mongo/util/elapsed_tracker.cpp b/src/mongo/util/elapsed_tracker.cpp
index becbdda1cae..0d0b2026fb7 100644
--- a/src/mongo/util/elapsed_tracker.cpp
+++ b/src/mongo/util/elapsed_tracker.cpp
@@ -36,33 +36,32 @@
namespace mongo {
- ElapsedTracker::ElapsedTracker( int32_t hitsBetweenMarks, int32_t msBetweenMarks ) :
- _hitsBetweenMarks( hitsBetweenMarks ),
- _msBetweenMarks( msBetweenMarks ),
- _pings( 0 ),
- _last( Listener::getElapsedTimeMillis() ) {
- }
-
- bool ElapsedTracker::intervalHasElapsed() {
- if ( ++_pings >= _hitsBetweenMarks ) {
- _pings = 0;
- _last = Listener::getElapsedTimeMillis();
- return true;
- }
+ElapsedTracker::ElapsedTracker(int32_t hitsBetweenMarks, int32_t msBetweenMarks)
+ : _hitsBetweenMarks(hitsBetweenMarks),
+ _msBetweenMarks(msBetweenMarks),
+ _pings(0),
+ _last(Listener::getElapsedTimeMillis()) {}
- long long now = Listener::getElapsedTimeMillis();
- if ( now - _last > _msBetweenMarks ) {
- _pings = 0;
- _last = now;
- return true;
- }
-
- return false;
+bool ElapsedTracker::intervalHasElapsed() {
+ if (++_pings >= _hitsBetweenMarks) {
+ _pings = 0;
+ _last = Listener::getElapsedTimeMillis();
+ return true;
}
- void ElapsedTracker::resetLastTime() {
+ long long now = Listener::getElapsedTimeMillis();
+ if (now - _last > _msBetweenMarks) {
_pings = 0;
- _last = Listener::getElapsedTimeMillis();
+ _last = now;
+ return true;
}
-} // namespace mongo
+ return false;
+}
+
+void ElapsedTracker::resetLastTime() {
+ _pings = 0;
+ _last = Listener::getElapsedTimeMillis();
+}
+
+} // namespace mongo