summaryrefslogtreecommitdiffstats
path: root/searchcore/src
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-11-29 14:26:03 +0100
committerHenning Baldersheim <balder@oath.com>2018-11-29 14:26:03 +0100
commit7bb9f2997f9f7e2bc88e075df93f13d5646cdaf7 (patch)
tree7abbc367334657679be47211d65586781304be5d /searchcore/src
parentc1fc295f963cf7e9a117dac9d0dabf7151ec0c1b (diff)
Use std::chrono::steady::clock
Diffstat (limited to 'searchcore/src')
-rw-r--r--searchcore/src/vespa/searchcore/fdispatch/common/appcontext.cpp21
-rw-r--r--searchcore/src/vespa/searchcore/fdispatch/common/appcontext.h9
2 files changed, 6 insertions, 24 deletions
diff --git a/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.cpp b/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.cpp
index 78efc1f7429..667220777eb 100644
--- a/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.cpp
+++ b/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.cpp
@@ -3,29 +3,18 @@
#include "appcontext.h"
#include <cassert>
-FastS_TimeKeeper::FastS_TimeKeeper()
- : _clock(0.010),
- _thread_pool(128 * 1024)
-{
- bool ok = _thread_pool.NewThread(&_clock);
- assert(ok);
- (void) ok;
-}
-
-
-FastS_TimeKeeper::~FastS_TimeKeeper()
-{
- _clock.stop();
- _thread_pool.Close();
+double FastS_TimeKeeper::GetTime() const {
+ using clock = std::chrono::steady_clock;
+ using seconds = std::chrono::duration<double, std::ratio<1,1>>;
+ return std::chrono::duration_cast<seconds>(clock::now().time_since_epoch()).count();
}
//---------------------------------------------------------------------
FastS_AppContext::FastS_AppContext()
: _timeKeeper(),
- _createTime()
+ _createTime(_timeKeeper.GetTime())
{
- _createTime = _timeKeeper.GetTime();
}
FastS_AppContext::~FastS_AppContext() = default;
diff --git a/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.h b/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.h
index fce468b4532..c018b3795b8 100644
--- a/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.h
+++ b/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.h
@@ -12,15 +12,8 @@ class FastS_DataSetCollection;
class FastS_TimeKeeper
{
-private:
- vespalib::Clock _clock;
- FastOS_ThreadPool _thread_pool;
-
public:
- FastS_TimeKeeper();
- ~FastS_TimeKeeper();
-
- double GetTime() const { return _clock.getTimeNSAssumeRunning().sec(); }
+ double GetTime() const;
};