summaryrefslogtreecommitdiff
path: root/src/mongo/util/timer.h
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2016-05-02 10:55:01 -0400
committerAndy Schwerin <schwerin@mongodb.com>2016-05-23 10:28:31 -0400
commit2e627487ef0475c46143b5f57d3e7c3d3027d5dc (patch)
tree7ad552be9a3cae113bc3cfd9df0faea78aa50e24 /src/mongo/util/timer.h
parentc9aac9d6eaba6ef2eb8903f07e997b594e88addc (diff)
downloadmongo-2e627487ef0475c46143b5f57d3e7c3d3027d5dc.tar.gz
SERVER-18277 Track elapsed time on cursors using microsecond resolution on OperationContext.
This completes the mechanics of moving max-time tracking to OperationContext and switching the checkForInterrupt checks to use the service context's fast clock source, while tracking the amount of execution time remaining on a cursor with microsecond granularity to ensure that remaining execution time always declines, even for very brief operations on cursors. This patch does not complete the transition from wait_for waiting to wait_until waiting in all places that do waiting based on operation deadlines.
Diffstat (limited to 'src/mongo/util/timer.h')
-rw-r--r--src/mongo/util/timer.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/util/timer.h b/src/mongo/util/timer.h
index c16ac255206..05a5936c69e 100644
--- a/src/mongo/util/timer.h
+++ b/src/mongo/util/timer.h
@@ -29,6 +29,8 @@
#pragma once
+#include "mongo/util/time_support.h"
+
namespace mongo {
@@ -76,6 +78,10 @@ public:
return static_cast<long long>((now() - _old) * _microsPerCount);
}
+ Microseconds elapsed() const {
+ return Microseconds{micros()};
+ }
+
inline void reset() {
_old = now();
}