MongoDB  2.7.0
elapsed_tracker.h
1 // @file elapsed_tracker.h
2 
31 #pragma once
32 
33 #include "mongo/platform/cstdint.h"
34 
35 namespace mongo {
36 
39  public:
40  ElapsedTracker( int32_t hitsBetweenMarks, int32_t msBetweenMarks );
41 
46  bool intervalHasElapsed();
47 
48  void resetLastTime();
49 
50  private:
51  const int32_t _hitsBetweenMarks;
52  const int32_t _msBetweenMarks;
53 
54  int32_t _pings;
55 
56  int64_t _last;
57  };
58 
59 } // namespace mongo
Keep track of elapsed time.
Definition: elapsed_tracker.h:38
bool intervalHasElapsed()
Call this for every iteration.
Definition: elapsed_tracker.cpp:46