summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-12-16 21:34:54 -0600
committerGitHub <noreply@github.com>2019-12-16 21:34:54 -0600
commit8a02ad01e25ed2483bd0f1c8abdec8eabf44634a (patch)
tree253ee93b860f20a9c1deeb4cf0f6a31945bf6bf8
parent2f8e6f0cb74ef77a645e7543975aca736f7649a9 (diff)
Revert "Balder/remove steadytimestamp 2"
-rw-r--r--fastos/src/vespa/fastos/timestamp.cpp24
-rw-r--r--fastos/src/vespa/fastos/timestamp.h19
-rw-r--r--searchcore/src/tests/grouping/grouping.cpp19
-rw-r--r--searchcore/src/tests/proton/common/cachedselect_test.cpp6
-rw-r--r--searchcore/src/tests/proton/docsummary/docsummary.cpp2
-rw-r--r--searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp4
-rw-r--r--searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp2
-rw-r--r--searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp2
-rw-r--r--searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp34
-rw-r--r--searchcore/src/tests/proton/index/indexcollection_test.cpp4
-rw-r--r--searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp6
-rw-r--r--searchcore/src/tests/proton/matching/matching_stats_test.cpp42
-rw-r--r--searchcore/src/tests/proton/matching/matching_test.cpp5
-rw-r--r--searchcore/src/tests/proton/matching/request_context/request_context_test.cpp2
-rw-r--r--searchcore/src/tests/proton/matching/sessionmanager_test.cpp14
-rw-r--r--searchcore/src/tests/proton/server/memoryflush/memoryflush_test.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/grouping/groupingcontext.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/grouping/groupingcontext.h15
-rw-r--r--searchcore/src/vespa/searchcore/grouping/groupingsession.h6
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/commit_time_tracker.cpp14
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/commit_time_tracker.h14
-rw-r--r--searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/fakesearchcontext.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/isessioncachepruner.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_master.cpp16
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp14
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_thread.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matcher.cpp18
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matching_stats.cpp8
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matching_stats.h10
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/querylimiter.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/search_session.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/search_session.h16
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/session_manager_explorer.cpp5
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/sessionmanager.cpp12
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/sessionmanager.h12
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp10
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h12
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp4
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp4
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/warmupconfig.h12
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp17
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.h2
-rw-r--r--searchlib/src/apps/vespa-attribute-inspect/vespa-attribute-inspect.cpp12
-rw-r--r--searchlib/src/tests/aggregator/perdocexpr.cpp8
-rw-r--r--searchlib/src/tests/attribute/benchmark/attributesearcher.h26
-rw-r--r--searchlib/src/tests/attribute/benchmark/attributeupdater.h38
-rw-r--r--searchlib/src/tests/engine/proto_converter/proto_converter_test.cpp4
-rw-r--r--searchlib/src/tests/features/featurebenchmark.cpp10
-rw-r--r--searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp2
-rw-r--r--searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp6
-rw-r--r--searchlib/src/tests/queryeval/sparse_vector_benchmark/sparse_vector_benchmark_test.cpp22
-rw-r--r--searchlib/src/tests/queryeval/weak_and/wand_bench_setup.hpp13
-rw-r--r--searchlib/src/tests/sortspec/multilevelsort.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/aggregation/grouping.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/aggregation/grouping.h4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.h4
-rw-r--r--searchlib/src/vespa/searchlib/engine/proto_converter.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/engine/proto_rpc_adapter.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/engine/request.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/engine/request.h19
-rw-r--r--searchlib/src/vespa/searchlib/engine/trace.cpp16
-rw-r--r--searchlib/src/vespa/searchlib/engine/trace.h20
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h4
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.cpp14
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.h20
-rw-r--r--staging_vespalib/src/tests/array/allocinarray_benchmark.cpp2
-rw-r--r--staging_vespalib/src/tests/array/sort_benchmark.cpp2
-rw-r--r--staging_vespalib/src/tests/clock/clock_benchmark.cpp35
-rw-r--r--staging_vespalib/src/tests/clock/clock_test.cpp12
-rw-r--r--staging_vespalib/src/tests/rusage/rusage_test.cpp24
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/clock.cpp2
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/clock.h8
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/doom.cpp4
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/doom.h18
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/rusage.cpp18
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/rusage.h8
-rw-r--r--vespalib/src/tests/time/time_test.cpp10
-rw-r--r--vespalib/src/vespa/vespalib/testkit/test_comparators.cpp6
-rw-r--r--vespalib/src/vespa/vespalib/testkit/test_comparators.h2
-rw-r--r--vespalib/src/vespa/vespalib/util/time.cpp7
-rw-r--r--vespalib/src/vespa/vespalib/util/time.h6
88 files changed, 467 insertions, 420 deletions
diff --git a/fastos/src/vespa/fastos/timestamp.cpp b/fastos/src/vespa/fastos/timestamp.cpp
index ef206067900..14825d7d4f4 100644
--- a/fastos/src/vespa/fastos/timestamp.cpp
+++ b/fastos/src/vespa/fastos/timestamp.cpp
@@ -14,7 +14,10 @@ namespace fastos {
const TimeStamp::TimeT TimeStamp::MILLI;
const TimeStamp::TimeT TimeStamp::MICRO;
const TimeStamp::TimeT TimeStamp::NANO;
+const TimeStamp::TimeT TimeStamp::US;
+const TimeStamp::TimeT TimeStamp::MS;
const TimeStamp::TimeT TimeStamp::SEC;
+const TimeStamp::TimeT TimeStamp::MINUTE;
using seconds = std::chrono::duration<double>;
@@ -53,6 +56,27 @@ steady_now() {
}
+std::ostream &
+operator << (std::ostream & os, SteadyTimeStamp ts) {
+ return os << ts.toString();
+}
+
+SteadyTimeStamp
+ClockSteady::now()
+{
+ return steady_now();
+}
+
+const SteadyTimeStamp SteadyTimeStamp::ZERO;
+const SteadyTimeStamp SteadyTimeStamp::FUTURE(TimeStamp::FUTURE);
+
+system_clock::time_point
+SteadyTimeStamp::toUTC() const {
+ system_clock::time_point nowUtc = system_clock::now();
+ SteadyTimeStamp nowSteady = ClockSteady::now();
+ return system_clock::time_point (std::chrono::nanoseconds(nowUtc.time_since_epoch().count() - (nowSteady - *this).ns()));
+}
+
StopWatch::StopWatch()
: _startTime(steady_now())
{ }
diff --git a/fastos/src/vespa/fastos/timestamp.h b/fastos/src/vespa/fastos/timestamp.h
index 0d23cf7151f..5dd6c350602 100644
--- a/fastos/src/vespa/fastos/timestamp.h
+++ b/fastos/src/vespa/fastos/timestamp.h
@@ -15,7 +15,10 @@ public:
static const TimeT MILLI = 1000LL;
static const TimeT MICRO = 1000*MILLI;
static const TimeT NANO = 1000*MICRO;
+ static const TimeT US = MILLI;
+ static const TimeT MS = MICRO;
static const TimeT SEC = NANO;
+ static const TimeT MINUTE = 60*SEC;
class Seconds {
public:
explicit Seconds(double v) : _v(v * NANO) {}
@@ -23,8 +26,10 @@ public:
private:
TimeT _v;
};
+ enum Special { FUTURE };
TimeStamp() : _time(0) { }
TimeStamp(const timeval & tv) : _time(tv.tv_sec*SEC + tv.tv_usec*MILLI) { }
+ TimeStamp(Special s) : _time(std::numeric_limits<TimeT>::max()) { (void) s; }
TimeStamp(int v) : _time(v) { }
TimeStamp(unsigned int v) : _time(v) { }
TimeStamp(long v) : _time(v) { }
@@ -43,7 +48,8 @@ public:
double sec() const { return val()/1000000000.0; }
std::string toString() const { return asString(sec()); }
static std::string asString(double timeInSeconds);
- static std::string asString(std::chrono::system_clock::time_point time);
+ static std::string asString(std::chrono::system_clock::time_point duration);
+ static TimeStamp fromSec(double sec) { return Seconds(sec); }
private:
TimeT _time;
};
@@ -55,6 +61,8 @@ inline TimeStamp operator *(double a, TimeStamp b) { return TimeStamp(static_cas
class SteadyTimeStamp {
public:
+ static const SteadyTimeStamp ZERO;
+ static const SteadyTimeStamp FUTURE;
SteadyTimeStamp() : _timeStamp() { }
explicit SteadyTimeStamp(TimeStamp timeStamp) : _timeStamp(timeStamp) { }
@@ -79,11 +87,20 @@ public:
friend bool operator > (SteadyTimeStamp a, SteadyTimeStamp b) {
return a._timeStamp > b._timeStamp;
}
+ std::chrono::system_clock::time_point toUTC() const;
std::string toString() const { return _timeStamp.toString(); };
private:
TimeStamp _timeStamp;
};
+std::ostream & operator << (std::ostream & os, SteadyTimeStamp ts);
+
+class ClockSteady
+{
+public:
+ static SteadyTimeStamp now();
+};
+
class StopWatch
{
public:
diff --git a/searchcore/src/tests/grouping/grouping.cpp b/searchcore/src/tests/grouping/grouping.cpp
index e5ac6ed15b0..edaa8792d6c 100644
--- a/searchcore/src/tests/grouping/grouping.cpp
+++ b/searchcore/src/tests/grouping/grouping.cpp
@@ -22,8 +22,7 @@ using namespace search::grouping;
using namespace search;
using search::attribute::test::MockAttributeContext;
using proton::matching::SessionManager;
-using vespalib::steady_time;
-using vespalib::duration;
+using fastos::SteadyTimeStamp;
//-----------------------------------------------------------------------------
@@ -112,8 +111,8 @@ private:
struct DoomFixture {
vespalib::Clock clock;
- steady_time timeOfDoom;
- DoomFixture() : clock(), timeOfDoom(steady_time::max()) {}
+ fastos::SteadyTimeStamp timeOfDoom;
+ DoomFixture() : clock(), timeOfDoom(fastos::SteadyTimeStamp::FUTURE) {}
};
//-----------------------------------------------------------------------------
@@ -473,24 +472,24 @@ TEST_F("test session timeout", DoomFixture()) {
SessionId id1("foo");
SessionId id2("bar");
- GroupingContext initContext1(f1.clock, steady_time(duration(10)));
- GroupingContext initContext2(f1.clock, steady_time(duration(20)));
+ GroupingContext initContext1(f1.clock, SteadyTimeStamp(10));
+ GroupingContext initContext2(f1.clock, SteadyTimeStamp(20));
GroupingSession::UP s1(new GroupingSession(id1, initContext1, world.attributeContext));
GroupingSession::UP s2(new GroupingSession(id2, initContext2, world.attributeContext));
mgr.insert(std::move(s1));
mgr.insert(std::move(s2));
- mgr.pruneTimedOutSessions(steady_time(5ns));
+ mgr.pruneTimedOutSessions(SteadyTimeStamp(5));
SessionManager::Stats stats(mgr.getGroupingStats());
ASSERT_EQUAL(2u, stats.numCached);
- mgr.pruneTimedOutSessions(steady_time(10ns));
+ mgr.pruneTimedOutSessions(SteadyTimeStamp(10));
stats = mgr.getGroupingStats();
ASSERT_EQUAL(2u, stats.numCached);
- mgr.pruneTimedOutSessions(steady_time(11ns));
+ mgr.pruneTimedOutSessions(SteadyTimeStamp(11));
stats = mgr.getGroupingStats();
ASSERT_EQUAL(1u, stats.numCached);
- mgr.pruneTimedOutSessions(steady_time(21ns));
+ mgr.pruneTimedOutSessions(SteadyTimeStamp(21));
stats = mgr.getGroupingStats();
ASSERT_EQUAL(0u, stats.numCached);
}
diff --git a/searchcore/src/tests/proton/common/cachedselect_test.cpp b/searchcore/src/tests/proton/common/cachedselect_test.cpp
index 0fc290c9d2c..74d65a5bf7f 100644
--- a/searchcore/src/tests/proton/common/cachedselect_test.cpp
+++ b/searchcore/src/tests/proton/common/cachedselect_test.cpp
@@ -617,7 +617,7 @@ TEST_F("Test performance when using attributes", TestFixture)
uint32_t i;
const uint32_t loopcnt = 30000;
LOG(info, "Starting minibm loop, %u ierations of 4 docs each", loopcnt);
- vespalib::Timer sw;
+ fastos::StopWatch sw;
for (i = 0; i < loopcnt; ++i) {
ctx._docId = 1u;
if (sel->contains(ctx) != Result::False)
@@ -632,11 +632,11 @@ TEST_F("Test performance when using attributes", TestFixture)
if (sel->contains(ctx) != Result::Invalid)
break;
}
- vespalib::duration elapsed = sw.elapsed();
+ fastos::TimeStamp elapsed = sw.elapsed();
EXPECT_EQUAL(loopcnt, i);
LOG(info,
"Elapsed time for %u iterations of 4 docs each: %" PRId64 " ns, %8.4f ns/doc",
- i, vespalib::count_ns(elapsed), static_cast<double>(vespalib::count_ns(elapsed)) / ( 4 * i));
+ i, elapsed.ns(), static_cast<double>(elapsed.ns()) / ( 4 * i));
}
diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp
index 3e86e703e1e..637ce90c72e 100644
--- a/searchcore/src/tests/proton/docsummary/docsummary.cpp
+++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp
@@ -646,7 +646,7 @@ Test::requireThatSummariesTimeout()
1);
DocsumRequest req;
- req.setTimeout(vespalib::duration::zero());
+ req.setTimeout(0);
EXPECT_TRUE(req.expired());
req.resultClassName = "class2";
req.hits.push_back(DocsumRequest::Hit(gid1));
diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
index 1ad6b6cdc43..069541eea91 100644
--- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
@@ -127,7 +127,7 @@ ViewSet::ViewSet()
_dmsc(),
_gidToLidChangeHandler(),
_lidReuseDelayer(),
- _commitTimeTracker(vespalib::duration::zero()),
+ _commitTimeTracker(TimeStamp()),
searchView(),
feedView(),
_hwInfo()
@@ -256,7 +256,7 @@ struct MyFastAccessFeedView
_dmsc(),
_gidToLidChangeHandler(make_shared<DummyGidToLidChangeHandler>()),
_lidReuseDelayer(),
- _commitTimeTracker(vespalib::duration::zero()),
+ _commitTimeTracker(TimeStamp()),
_feedView()
{
init();
diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
index ca513cb1cfb..839228b79b8 100644
--- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
@@ -707,7 +707,7 @@ FixtureBase::FixtureBase(vespalib::duration visibilityDelay)
_writeServiceReal(_sharedExecutor),
_writeService(_writeServiceReal),
_lidReuseDelayer(_writeService, _dmsc->get()),
- _commitTimeTracker(visibilityDelay),
+ _commitTimeTracker(vespalib::count_ns(visibilityDelay)),
serial(0),
_gidToLidChangeHandler(std::make_shared<MyGidToLidChangeHandler>())
{
diff --git a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
index 0720f59471b..fdb7488bf65 100644
--- a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
@@ -197,7 +197,7 @@ struct MySessionCachePruner : public ISessionCachePruner
{
bool isInvoked;
MySessionCachePruner() : isInvoked(false) { }
- void pruneTimedOutSessions(vespalib::steady_time current) override {
+ void pruneTimedOutSessions(fastos::SteadyTimeStamp current) override {
(void) current;
isInvoked = true;
}
diff --git a/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp b/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp
index 7c9df8d3e47..2d5f86fbc58 100644
--- a/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp
@@ -94,7 +94,8 @@ struct MyMinimalFeedView : public MyMinimalFeedViewBase, public StoreOnlyFeedVie
MyMinimalFeedViewBase(),
StoreOnlyFeedView(StoreOnlyFeedView::Context(summaryAdapter,
search::index::Schema::SP(),
- std::make_shared<DocumentMetaStoreContext>(metaStore),
+ DocumentMetaStoreContext::SP(
+ new DocumentMetaStoreContext(metaStore)),
*gidToLidChangeHandler,
myGetDocumentTypeRepo(),
writeService,
@@ -108,19 +109,23 @@ struct MyMinimalFeedView : public MyMinimalFeedViewBase, public StoreOnlyFeedVie
outstandingMoveOps(outstandingMoveOps_)
{
}
- void removeAttributes(SerialNum s, const LidVector &l, bool immediateCommit, OnWriteDoneType onWriteDone) override {
+ virtual void removeAttributes(SerialNum s, const LidVector &l,
+ bool immediateCommit, OnWriteDoneType onWriteDone) override {
StoreOnlyFeedView::removeAttributes(s, l, immediateCommit, onWriteDone);
++removeMultiAttributesCount;
}
- void removeIndexedFields(SerialNum s, const LidVector &l, bool immediateCommit, OnWriteDoneType onWriteDone) override {
- StoreOnlyFeedView::removeIndexedFields(s, l, immediateCommit, onWriteDone);
+ virtual void removeIndexedFields(SerialNum s, const LidVector &l,
+ bool immediateCommit,
+ OnWriteDoneType onWriteDone) override {
+ StoreOnlyFeedView::removeIndexedFields(s, l,
+ immediateCommit, onWriteDone);
++removeMultiIndexFieldsCount;
}
- void heartBeatIndexedFields(SerialNum s) override {
+ virtual void heartBeatIndexedFields(SerialNum s) override {
StoreOnlyFeedView::heartBeatIndexedFields(s);
++heartBeatIndexedFieldsCount;
}
- void heartBeatAttributes(SerialNum s) override {
+ virtual void heartBeatAttributes(SerialNum s) override {
StoreOnlyFeedView::heartBeatAttributes(s);
++heartBeatAttributesCount;
}
@@ -149,23 +154,26 @@ struct MoveOperationFeedView : public MyMinimalFeedView {
removeIndexFieldsCount(0),
onWriteDoneContexts()
{}
- void putAttributes(SerialNum, search::DocumentIdT, const document::Document &, bool, OnPutDoneType onWriteDone) override {
+ virtual void putAttributes(SerialNum, search::DocumentIdT, const document::Document &,
+ bool, OnPutDoneType onWriteDone) override {
++putAttributesCount;
EXPECT_EQUAL(1, outstandingMoveOps);
onWriteDoneContexts.push_back(onWriteDone);
}
- void putIndexedFields(SerialNum, search::DocumentIdT, const document::Document::SP &,
- bool, OnOperationDoneType onWriteDone) override {
+ virtual void putIndexedFields(SerialNum, search::DocumentIdT, const document::Document::SP &,
+ bool, OnOperationDoneType onWriteDone) override {
++putIndexFieldsCount;
EXPECT_EQUAL(1, outstandingMoveOps);
onWriteDoneContexts.push_back(onWriteDone);
}
- void removeAttributes(SerialNum, search::DocumentIdT, bool, OnRemoveDoneType onWriteDone) override {
+ virtual void removeAttributes(SerialNum, search::DocumentIdT,
+ bool, OnRemoveDoneType onWriteDone) override {
++removeAttributesCount;
EXPECT_EQUAL(1, outstandingMoveOps);
onWriteDoneContexts.push_back(onWriteDone);
}
- void removeIndexedFields(SerialNum, search::DocumentIdT, bool, OnRemoveDoneType onWriteDone) override {
+ virtual void removeIndexedFields(SerialNum, search::DocumentIdT,
+ bool, OnRemoveDoneType onWriteDone) override {
++removeIndexFieldsCount;
EXPECT_EQUAL(1, outstandingMoveOps);
onWriteDoneContexts.push_back(onWriteDone);
@@ -178,7 +186,7 @@ struct MoveOperationCallback : public IDestructorCallback {
MoveOperationCallback(int &outstandingMoveOps_) : outstandingMoveOps(outstandingMoveOps_) {
++outstandingMoveOps;
}
- ~MoveOperationCallback() override {
+ virtual ~MoveOperationCallback() {
ASSERT_GREATER(outstandingMoveOps, 0);
--outstandingMoveOps;
}
@@ -212,7 +220,7 @@ struct FixtureBase {
sharedExecutor(1, 0x10000),
writeService(sharedExecutor),
lidReuseDelayer(writeService, *metaStore),
- commitTimeTracker(vespalib::duration::zero()),
+ commitTimeTracker(fastos::TimeStamp()),
feedview()
{
StoreOnlyFeedView::PersistentParams params(0, 0, DocTypeName("foo"), subdb_id, subDbType);
diff --git a/searchcore/src/tests/proton/index/indexcollection_test.cpp b/searchcore/src/tests/proton/index/indexcollection_test.cpp
index 113901e893f..7a42fe574c2 100644
--- a/searchcore/src/tests/proton/index/indexcollection_test.cpp
+++ b/searchcore/src/tests/proton/index/indexcollection_test.cpp
@@ -75,7 +75,7 @@ public:
}
IndexCollection::UP create_warmup(const IndexCollection::SP& prev, const IndexCollection::SP& next) {
- return std::make_unique<WarmupIndexCollection>(WarmupConfig(1s, false), prev, next, *_warmup, _executor, *this);
+ return std::make_unique<WarmupIndexCollection>(WarmupConfig(1.0, false), prev, next, *_warmup, _executor, *this);
}
virtual void warmupDone(ISearchableIndexCollection::SP current) override {
@@ -90,7 +90,7 @@ public:
_executor(1, 128*1024),
_warmup(new FakeIndexSearchable)
{}
- ~IndexCollectionTest() = default;
+ ~IndexCollectionTest() {}
};
diff --git a/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp b/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp
index 2d0482b0d92..478cf0b2f98 100644
--- a/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp
+++ b/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp
@@ -289,9 +289,9 @@ TEST("require that the match phase limiter is able to pre-limit the query") {
MaybeMatchPhaseLimiter &limiter = yes_limiter;
EXPECT_TRUE(limiter.is_enabled());
EXPECT_EQUAL(12u, limiter.sample_hits_per_thread(10));
- RelativeTime clock(std::make_unique<CountingClock>(vespalib::count_ns(10000000s), 1700000L));
+ RelativeTime clock(std::make_unique<CountingClock>(fastos::TimeStamp::fromSec(10000000), 1700000L));
Trace trace(clock, 7);
- trace.start(4, false);
+ trace.start(4);
SearchIterator::UP search = limiter.maybe_limit(prepare(new MockSearch("search")), 0.1, 100000, trace.maybeCreateCursor(7, "limit"));
limiter.updateDocIdSpaceEstimate(1000, 9000);
EXPECT_EQUAL(1680u, limiter.getDocIdSpaceEstimate());
@@ -315,7 +315,7 @@ TEST("require that the match phase limiter is able to pre-limit the query") {
trace.done();
verify(
"{"
- " start_time: '1970-04-26 17:46:40.000 UTC',"
+ " start_time_relative: '1970-04-26 17:46:40.000 UTC',"
" traces: ["
" {"
" timestamp_ms: 1.7,"
diff --git a/searchcore/src/tests/proton/matching/matching_stats_test.cpp b/searchcore/src/tests/proton/matching/matching_stats_test.cpp
index 0d7778274b8..9bf627a6289 100644
--- a/searchcore/src/tests/proton/matching/matching_stats_test.cpp
+++ b/searchcore/src/tests/proton/matching/matching_stats_test.cpp
@@ -150,7 +150,7 @@ TEST("requireThatPartitionsAreAddedCorrectly") {
EXPECT_EQUAL(0u, all1.docsMatched());
EXPECT_EQUAL(0u, all1.getNumPartitions());
EXPECT_EQUAL(0u, all1.softDoomed());
- EXPECT_EQUAL(vespalib::duration::zero(), all1.doomOvertime());
+ EXPECT_EQUAL(0u, all1.doomOvertime());
MatchingStats::Partition subPart;
subPart.docsCovered(7).docsMatched(3).docsRanked(2).docsReRanked(1)
@@ -158,8 +158,8 @@ TEST("requireThatPartitionsAreAddedCorrectly") {
EXPECT_EQUAL(0u, subPart.softDoomed());
EXPECT_EQUAL(0u, subPart.softDoomed(false).softDoomed());
EXPECT_EQUAL(1u, subPart.softDoomed(true).softDoomed());
- EXPECT_EQUAL(vespalib::duration::zero(), subPart.doomOvertime());
- EXPECT_EQUAL(1000ns, subPart.doomOvertime(1000ns).doomOvertime());
+ EXPECT_EQUAL(0l, subPart.doomOvertime());
+ EXPECT_EQUAL(1000, subPart.doomOvertime(1000).doomOvertime());
EXPECT_EQUAL(7u, subPart.docsCovered());
EXPECT_EQUAL(3u, subPart.docsMatched());
EXPECT_EQUAL(2u, subPart.docsRanked());
@@ -180,7 +180,7 @@ TEST("requireThatPartitionsAreAddedCorrectly") {
EXPECT_EQUAL(1u, all1.docsReRanked());
EXPECT_EQUAL(1u, all1.getNumPartitions());
EXPECT_EQUAL(1u, all1.softDoomed());
- EXPECT_EQUAL(1000ns, all1.doomOvertime());
+ EXPECT_EQUAL(1000, all1.doomOvertime());
EXPECT_EQUAL(7u, all1.getPartition(0).docsCovered());
EXPECT_EQUAL(3u, all1.getPartition(0).docsMatched());
EXPECT_EQUAL(2u, all1.getPartition(0).docsRanked());
@@ -194,14 +194,14 @@ TEST("requireThatPartitionsAreAddedCorrectly") {
EXPECT_EQUAL(1.0, all1.getPartition(0).active_time_max());
EXPECT_EQUAL(0.5, all1.getPartition(0).wait_time_max());
EXPECT_EQUAL(1u, all1.getPartition(0).softDoomed());
- EXPECT_EQUAL(1000ns, all1.getPartition(0).doomOvertime());
+ EXPECT_EQUAL(1000, all1.getPartition(0).doomOvertime());
MatchingStats::Partition otherSubPart;
otherSubPart.docsCovered(7).docsMatched(3).docsRanked(2).docsReRanked(1)
- .active_time(0.5).wait_time(1.0).softDoomed(true).doomOvertime(300ns);
+ .active_time(0.5).wait_time(1.0).softDoomed(true).doomOvertime(300);
all1.merge_partition(otherSubPart, 1);
EXPECT_EQUAL(1u, all1.softDoomed());
- EXPECT_EQUAL(1000ns, all1.doomOvertime());
+ EXPECT_EQUAL(1000, all1.doomOvertime());
EXPECT_EQUAL(14u, all1.docidSpaceCovered());
EXPECT_EQUAL(6u, all1.docsMatched());
EXPECT_EQUAL(4u, all1.docsRanked());
@@ -219,7 +219,7 @@ TEST("requireThatPartitionsAreAddedCorrectly") {
EXPECT_EQUAL(0.5, all1.getPartition(1).active_time_max());
EXPECT_EQUAL(1.0, all1.getPartition(1).wait_time_max());
EXPECT_EQUAL(1u, all1.getPartition(1).softDoomed());
- EXPECT_EQUAL(300ns, all1.getPartition(1).doomOvertime());
+ EXPECT_EQUAL(300, all1.getPartition(1).doomOvertime());
MatchingStats all2;
all2.merge_partition(otherSubPart, 0);
@@ -227,7 +227,7 @@ TEST("requireThatPartitionsAreAddedCorrectly") {
all1.add(all2);
EXPECT_EQUAL(2u, all1.softDoomed());
- EXPECT_EQUAL(1000ns, all1.doomOvertime());
+ EXPECT_EQUAL(1000, all1.doomOvertime());
EXPECT_EQUAL(28u, all1.docidSpaceCovered());
EXPECT_EQUAL(12u, all1.docsMatched());
EXPECT_EQUAL(8u, all1.docsRanked());
@@ -245,7 +245,7 @@ TEST("requireThatPartitionsAreAddedCorrectly") {
EXPECT_EQUAL(1.0, all1.getPartition(0).active_time_max());
EXPECT_EQUAL(1.0, all1.getPartition(0).wait_time_max());
EXPECT_EQUAL(2u, all1.getPartition(0).softDoomed());
- EXPECT_EQUAL(1000ns, all1.getPartition(0).doomOvertime());
+ EXPECT_EQUAL(1000, all1.getPartition(0).doomOvertime());
EXPECT_EQUAL(6u, all1.getPartition(1).docsMatched());
EXPECT_EQUAL(4u, all1.getPartition(1).docsRanked());
EXPECT_EQUAL(2u, all1.getPartition(1).docsReRanked());
@@ -258,7 +258,7 @@ TEST("requireThatPartitionsAreAddedCorrectly") {
EXPECT_EQUAL(1.0, all1.getPartition(1).active_time_max());
EXPECT_EQUAL(1.0, all1.getPartition(1).wait_time_max());
EXPECT_EQUAL(2u, all1.getPartition(1).softDoomed());
- EXPECT_EQUAL(1000ns, all1.getPartition(1).doomOvertime());
+ EXPECT_EQUAL(1000, all1.getPartition(1).doomOvertime());
}
TEST("requireThatSoftDoomIsSetAndAdded") {
@@ -280,19 +280,19 @@ TEST("requireThatSoftDoomFacorIsComputedCorrectlyForDownAdjustment") {
EXPECT_EQUAL(0ul, stats.softDoomed());
EXPECT_EQUAL(0.5, stats.softDoomFactor());
stats.softDoomed(1);
- stats.updatesoftDoomFactor(1000ms, 500ms, 2000ms);
+ stats.updatesoftDoomFactor(1.0, 0.5, 2.0);
EXPECT_EQUAL(1ul, stats.softDoomed());
EXPECT_EQUAL(0.47, stats.softDoomFactor());
- stats.updatesoftDoomFactor(1000ms, 500ms, 2000ms);
+ stats.updatesoftDoomFactor(1.0, 0.5, 2.0);
EXPECT_EQUAL(1ul, stats.softDoomed());
EXPECT_EQUAL(0.44, stats.softDoomFactor());
- stats.updatesoftDoomFactor(900us, 500ms, 2000ms); // hard limits less than 1ms should be ignored
+ stats.updatesoftDoomFactor(0.0009, 0.5, 2.0); // hard limits less than 1ms should be ignored
EXPECT_EQUAL(1ul, stats.softDoomed());
EXPECT_EQUAL(0.44, stats.softDoomFactor());
- stats.updatesoftDoomFactor(1000ms, 900us, 2000ms); // soft limits less than 1ms should be ignored
+ stats.updatesoftDoomFactor(1.0, 0.0009, 2.0); // soft limits less than 1ms should be ignored
EXPECT_EQUAL(1ul, stats.softDoomed());
EXPECT_EQUAL(0.44, stats.softDoomFactor());
- stats.updatesoftDoomFactor(1000ms, 500ms, 10s); // Prevent changes above 10%
+ stats.updatesoftDoomFactor(1.0, 0.5, 10.0); // Prevent changes above 10%
EXPECT_EQUAL(1ul, stats.softDoomed());
EXPECT_EQUAL(0.396, stats.softDoomFactor());
}
@@ -302,20 +302,20 @@ TEST("requireThatSoftDoomFacorIsComputedCorrectlyForUpAdjustment") {
EXPECT_EQUAL(0ul, stats.softDoomed());
EXPECT_EQUAL(0.5, stats.softDoomFactor());
stats.softDoomed(1);
- stats.updatesoftDoomFactor(1s, 900ms, 100ms);
+ stats.updatesoftDoomFactor(1.0, 0.9, 0.1);
EXPECT_EQUAL(1ul, stats.softDoomed());
EXPECT_EQUAL(0.508, stats.softDoomFactor());
- stats.updatesoftDoomFactor(1s, 900ms, 100ms);
+ stats.updatesoftDoomFactor(1.0, 0.9, 0.1);
EXPECT_EQUAL(1ul, stats.softDoomed());
EXPECT_EQUAL(0.516, stats.softDoomFactor());
- stats.updatesoftDoomFactor(900us, 900ms, 100ms); // hard limits less than 1ms should be ignored
+ stats.updatesoftDoomFactor(0.0009, 0.9, 0.1); // hard limits less than 1ms should be ignored
EXPECT_EQUAL(1ul, stats.softDoomed());
EXPECT_EQUAL(0.516, stats.softDoomFactor());
- stats.updatesoftDoomFactor(1s, 900us, 100ms); // soft limits less than 1ms should be ignored
+ stats.updatesoftDoomFactor(1.0, 0.0009, 0.1); // soft limits less than 1ms should be ignored
EXPECT_EQUAL(1ul, stats.softDoomed());
EXPECT_EQUAL(0.516, stats.softDoomFactor());
stats.softDoomFactor(0.1);
- stats.updatesoftDoomFactor(1s, 900ms, 1ms); // Prevent changes above 5%
+ stats.updatesoftDoomFactor(1.0, 0.9, 0.001); // Prevent changes above 5%
EXPECT_EQUAL(1ul, stats.softDoomed());
EXPECT_EQUAL(0.105, stats.softDoomFactor());
}
diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp
index 8c4bf0d55b0..88705e73bc5 100644
--- a/searchcore/src/tests/proton/matching/matching_test.cpp
+++ b/searchcore/src/tests/proton/matching/matching_test.cpp
@@ -261,7 +261,7 @@ struct MyWorld {
static SearchRequest::SP createRequest(const vespalib::string &stack_dump)
{
SearchRequest::SP request(new SearchRequest);
- request->setTimeout(60s);
+ request->setTimeout(60 * fastos::TimeStamp::SEC);
setStackDump(*request, stack_dump);
request->maxhits = 10;
return request;
@@ -768,7 +768,8 @@ TEST("require that getSummaryFeatures prefers cached query setup") {
ASSERT_EQUAL(0u, fs->numDocs()); // "spread" has no hits
// Empty cache
- auto pruneTime = vespalib::steady_clock::now() + 600s;
+ auto pruneTime = fastos::ClockSteady::now() +
+ fastos::TimeStamp::MINUTE * 10;
world.sessionManager->pruneTimedOutSessions(pruneTime);
fs = world.getSummaryFeatures(req);
diff --git a/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp b/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp
index 109a4cc7a25..3152b737ea7 100644
--- a/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp
+++ b/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp
@@ -42,7 +42,7 @@ private:
public:
RequestContextTest()
: _clock(),
- _doom(_clock, vespalib::steady_time(), vespalib::steady_time(), false),
+ _doom(_clock, fastos::SteadyTimeStamp::ZERO, fastos::SteadyTimeStamp::ZERO, false),
_attr_ctx(),
_props(),
_request_ctx(_doom, _attr_ctx, _props),
diff --git a/searchcore/src/tests/proton/matching/sessionmanager_test.cpp b/searchcore/src/tests/proton/matching/sessionmanager_test.cpp
index f3edf2bf747..5998b165b51 100644
--- a/searchcore/src/tests/proton/matching/sessionmanager_test.cpp
+++ b/searchcore/src/tests/proton/matching/sessionmanager_test.cpp
@@ -18,7 +18,7 @@ using vespalib::string;
using namespace proton;
using namespace proton::matching;
using vespalib::StateExplorer;
-using vespalib::steady_time;
+using fastos::SteadyTimeStamp;
namespace {
@@ -35,8 +35,8 @@ void checkStats(SessionManager::Stats stats, uint32_t numInsert,
TEST("require that SessionManager handles SearchSessions.") {
string session_id("foo");
- steady_time start(100ns);
- steady_time doom(1000ns);
+ SteadyTimeStamp start(100);
+ SteadyTimeStamp doom(1000);
MatchToolsFactory::UP mtf;
SearchSession::OwnershipBundle owned_objects;
auto session = std::make_shared<SearchSession>(session_id, start, doom, std::move(mtf), std::move(owned_objects));
@@ -50,9 +50,9 @@ TEST("require that SessionManager handles SearchSessions.") {
TEST_DO(checkStats(session_manager.getSearchStats(), 0, 1, 0, 1, 0));
session_manager.insert(std::move(session));
TEST_DO(checkStats(session_manager.getSearchStats(), 1, 0, 0, 1, 0));
- session_manager.pruneTimedOutSessions(steady_time(500ns));
+ session_manager.pruneTimedOutSessions(SteadyTimeStamp(500));
TEST_DO(checkStats(session_manager.getSearchStats(), 0, 0, 0, 1, 0));
- session_manager.pruneTimedOutSessions(steady_time(2000ns));
+ session_manager.pruneTimedOutSessions(SteadyTimeStamp(2000));
TEST_DO(checkStats(session_manager.getSearchStats(), 0, 0, 0, 0, 1));
session = session_manager.pickSearch(session_id);
@@ -60,8 +60,8 @@ TEST("require that SessionManager handles SearchSessions.") {
}
TEST("require that SessionManager can be explored") {
- steady_time start(100ns);
- steady_time doom(1000ns);
+ SteadyTimeStamp start(100);
+ SteadyTimeStamp doom(1000);
SessionManager session_manager(10);
session_manager.insert(std::make_shared<SearchSession>("foo", start, doom,
MatchToolsFactory::UP(), SearchSession::OwnershipBundle()));
diff --git a/searchcore/src/tests/proton/server/memoryflush/memoryflush_test.cpp b/searchcore/src/tests/proton/server/memoryflush/memoryflush_test.cpp
index 549b2d2626a..41eda598726 100644
--- a/searchcore/src/tests/proton/server/memoryflush/memoryflush_test.cpp
+++ b/searchcore/src/tests/proton/server/memoryflush/memoryflush_test.cpp
@@ -9,6 +9,7 @@
using fastos::TimeStamp;
using vespalib::system_time;
+using fastos::SteadyTimeStamp;
using search::SerialNum;
using namespace proton;
using namespace searchcorespi;
diff --git a/searchcore/src/vespa/searchcore/grouping/groupingcontext.cpp b/searchcore/src/vespa/searchcore/grouping/groupingcontext.cpp
index 5c9321a6ff3..3869ffe8a6a 100644
--- a/searchcore/src/vespa/searchcore/grouping/groupingcontext.cpp
+++ b/searchcore/src/vespa/searchcore/grouping/groupingcontext.cpp
@@ -50,7 +50,7 @@ GroupingContext::setDistributionKey(uint32_t distributionKey)
}
}
-GroupingContext::GroupingContext(const vespalib::Clock & clock, vespalib::steady_time timeOfDoom, const char *groupSpec, uint32_t groupSpecLen) :
+GroupingContext::GroupingContext(const vespalib::Clock & clock, fastos::SteadyTimeStamp timeOfDoom, const char *groupSpec, uint32_t groupSpecLen) :
_clock(clock),
_timeOfDoom(timeOfDoom),
_os(),
@@ -59,7 +59,7 @@ GroupingContext::GroupingContext(const vespalib::Clock & clock, vespalib::steady
deserialize(groupSpec, groupSpecLen);
}
-GroupingContext::GroupingContext(const vespalib::Clock & clock, vespalib::steady_time timeOfDoom) :
+GroupingContext::GroupingContext(const vespalib::Clock & clock, fastos::SteadyTimeStamp timeOfDoom) :
_clock(clock),
_timeOfDoom(timeOfDoom),
_os(),
diff --git a/searchcore/src/vespa/searchcore/grouping/groupingcontext.h b/searchcore/src/vespa/searchcore/grouping/groupingcontext.h
index 3ec16fab2cc..eb6afca5f59 100644
--- a/searchcore/src/vespa/searchcore/grouping/groupingcontext.h
+++ b/searchcore/src/vespa/searchcore/grouping/groupingcontext.h
@@ -3,7 +3,6 @@
#include <vespa/searchlib/aggregation/grouping.h>
#include <vespa/vespalib/objects/nbostream.h>
-#include <vespa/vespalib/util/time.h>
#include <vector>
#include <memory>
@@ -22,10 +21,10 @@ public:
using GroupingList = std::vector<GroupingPtr>;
private:
- const vespalib::Clock & _clock;
- vespalib::steady_time _timeOfDoom;
- vespalib::nbostream _os;
- GroupingList _groupingList;
+ const vespalib::Clock & _clock;
+ fastos::SteadyTimeStamp _timeOfDoom;
+ vespalib::nbostream _os;
+ GroupingList _groupingList;
public:
/**
@@ -41,14 +40,14 @@ public:
* @param groupSpec The grouping specification to use for initialization.
* @param groupSpecLen The length of the grouping specification, in bytes.
**/
- GroupingContext(const vespalib::Clock & clock, vespalib::steady_time timeOfDoom, const char *groupSpec, uint32_t groupSpecLen);
+ GroupingContext(const vespalib::Clock & clock, fastos::SteadyTimeStamp timeOfDoom, const char *groupSpec, uint32_t groupSpecLen);
/**
* Create a new grouping context from a byte buffer.
* @param groupSpec The grouping specification to use for initialization.
* @param groupSpecLen The length of the grouping specification, in bytes.
**/
- GroupingContext(const vespalib::Clock & clock, vespalib::steady_time timeOfDoom);
+ GroupingContext(const vespalib::Clock & clock, fastos::SteadyTimeStamp timeOfDoom);
/**
* Shallow copy of references
@@ -106,7 +105,7 @@ public:
/**
* Obtain the time of doom.
*/
- vespalib::steady_time getTimeOfDoom() const { return _timeOfDoom; }
+ fastos::SteadyTimeStamp getTimeOfDoom() const { return _timeOfDoom; }
/**
* Figure out if ranking is necessary for any of the grouping requests here.
* @return true if ranking is required.
diff --git a/searchcore/src/vespa/searchcore/grouping/groupingsession.h b/searchcore/src/vespa/searchcore/grouping/groupingsession.h
index 70953f212d1..055fd41f0e1 100644
--- a/searchcore/src/vespa/searchcore/grouping/groupingsession.h
+++ b/searchcore/src/vespa/searchcore/grouping/groupingsession.h
@@ -3,7 +3,7 @@
#include "sessionid.h"
#include <vespa/searchlib/attribute/iattributemanager.h>
-#include <vespa/vespalib/util/time.h>
+#include <vespa/fastos/timestamp.h>
#include <vector>
#include <map>
@@ -30,7 +30,7 @@ private:
std::unique_ptr<GroupingContext> _mgrContext;
std::unique_ptr<GroupingManager> _groupingManager;
GroupingMap _groupingMap;
- vespalib::steady_time _timeOfDoom;
+ fastos::SteadyTimeStamp _timeOfDoom;
public:
typedef std::unique_ptr<GroupingSession> UP;
@@ -108,7 +108,7 @@ public:
/**
* Get this sessions timeout.
*/
- vespalib::steady_time getTimeOfDoom() const { return _timeOfDoom; }
+ fastos::SteadyTimeStamp getTimeOfDoom() const { return _timeOfDoom; }
};
}
diff --git a/searchcore/src/vespa/searchcore/proton/common/commit_time_tracker.cpp b/searchcore/src/vespa/searchcore/proton/common/commit_time_tracker.cpp
index eaf515d4fa5..c9db3d23979 100644
--- a/searchcore/src/vespa/searchcore/proton/common/commit_time_tracker.cpp
+++ b/searchcore/src/vespa/searchcore/proton/common/commit_time_tracker.cpp
@@ -4,9 +4,9 @@
namespace proton {
-CommitTimeTracker::CommitTimeTracker(vespalib::duration visibilityDelay)
+CommitTimeTracker::CommitTimeTracker(fastos::TimeStamp visibilityDelay)
: _visibilityDelay(visibilityDelay),
- _nextCommit(vespalib::steady_clock::now()),
+ _nextCommit(fastos::ClockSteady::now()),
_replayDone(false)
{
_nextCommit = _nextCommit + visibilityDelay;
@@ -15,11 +15,11 @@ CommitTimeTracker::CommitTimeTracker(vespalib::duration visibilityDelay)
bool
CommitTimeTracker::needCommit() const
{
- if (hasVisibilityDelay()) {
+ if (_visibilityDelay > 0) {
if (_replayDone) {
return false; // maintenance job will do forced commits now
}
- vespalib::steady_time now(vespalib::steady_clock::now());
+ fastos::SteadyTimeStamp now(fastos::ClockSteady::now());
if (now > _nextCommit) {
_nextCommit = now + _visibilityDelay;
return true;
@@ -30,13 +30,13 @@ CommitTimeTracker::needCommit() const
}
void
-CommitTimeTracker::setVisibilityDelay(vespalib::duration visibilityDelay)
+CommitTimeTracker::setVisibilityDelay(fastos::TimeStamp visibilityDelay)
{
- vespalib::steady_time nextCommit = vespalib::steady_clock::now() + visibilityDelay;
+ fastos::SteadyTimeStamp nextCommit = fastos::ClockSteady::now() + visibilityDelay;
if (nextCommit < _nextCommit) {
_nextCommit = nextCommit;
}
_visibilityDelay = visibilityDelay;
}
-}
+} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/common/commit_time_tracker.h b/searchcore/src/vespa/searchcore/proton/common/commit_time_tracker.h
index 02bf87f0a08..d00152cf372 100644
--- a/searchcore/src/vespa/searchcore/proton/common/commit_time_tracker.h
+++ b/searchcore/src/vespa/searchcore/proton/common/commit_time_tracker.h
@@ -1,7 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/vespalib/util/time.h>
+#include <vespa/fastos/timestamp.h>
namespace proton {
@@ -11,18 +11,18 @@ namespace proton {
class CommitTimeTracker
{
private:
- vespalib::duration _visibilityDelay;
- mutable vespalib::steady_time _nextCommit;
- bool _replayDone;
+ fastos::TimeStamp _visibilityDelay;
+ mutable fastos::SteadyTimeStamp _nextCommit;
+ bool _replayDone;
public:
- CommitTimeTracker(vespalib::duration visibilityDelay);
+ CommitTimeTracker(fastos::TimeStamp visibilityDelay);
bool needCommit() const;
- void setVisibilityDelay(vespalib::duration visibilityDelay);
+ void setVisibilityDelay(fastos::TimeStamp visibilityDelay);
- bool hasVisibilityDelay() const { return _visibilityDelay != vespalib::duration::zero(); }
+ bool hasVisibilityDelay() const { return _visibilityDelay != 0; }
void setReplayDone() { _replayDone = true; }
};
diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp
index 872b4b27584..e19719fa966 100644
--- a/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp
+++ b/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.cpp
@@ -78,7 +78,7 @@ DocsumContext::createReply()
Slime slime(Slime::Params(std::move(symbols)));
vespalib::slime::SlimeInserter inserter(slime);
if (_request.expired()) {
- inserter.insertString(make_string("Timed out with %" PRId64 "us left.", vespalib::count_us(_request.getTimeLeft())));
+ inserter.insertString(make_string("Timed out with %" PRId64 "us left.", _request.getTimeLeft().us()));
} else {
_docsumWriter.insertDocsum(rci, docId, &_docsumState, &_docsumStore, slime, inserter);
}
@@ -129,7 +129,7 @@ DocsumContext::createSlimeReply()
Cursor & timeout = errors.addObject();
timeout.setString(TYPE, TIMEOUT);
timeout.setString(MESSAGE, make_string("Timed out %d summaries with %" PRId64 "us left.",
- numTimedOut, vespalib::count_us(_request.getTimeLeft())));
+ numTimedOut, _request.getTimeLeft().us()));
}
return response;
}
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.cpp
index a1a8297d5c0..c4b6d88c1c3 100644
--- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.cpp
@@ -44,14 +44,14 @@ DocumentMetaStoreInitializer::run()
vespalib::string attrFileName = _baseDir + "/" + snap.dirName + "/" + name;
_dms->setBaseFileName(attrFileName);
assert(_dms->hasLoadData());
- vespalib::Timer stopWatch;
+ fastos::StopWatch stopWatch;
EventLogger::loadDocumentMetaStoreStart(_subDbName);
if (!_dms->load()) {
throw IllegalStateException(failedMsg(_docTypeName.c_str()));
} else {
_dms->commit(snap.syncToken, snap.syncToken);
}
- EventLogger::loadDocumentMetaStoreComplete(_subDbName, vespalib::count_ms(stopWatch.elapsed()));
+ EventLogger::loadDocumentMetaStoreComplete(_subDbName, stopWatch.elapsed().ms());
}
} else {
vespalib::mkdir(_baseDir, false);
diff --git a/searchcore/src/vespa/searchcore/proton/matching/fakesearchcontext.cpp b/searchcore/src/vespa/searchcore/proton/matching/fakesearchcontext.cpp
index 5758b9a796f..c7a75bff9ca 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/fakesearchcontext.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/fakesearchcontext.cpp
@@ -6,7 +6,7 @@ namespace proton::matching {
FakeSearchContext::FakeSearchContext(size_t initialNumDocs)
: _clock(),
- _doom(_clock, vespalib::steady_time()),
+ _doom(_clock, fastos::SteadyTimeStamp::ZERO),
_selector(new search::FixedSourceSelector(0, "fs", initialNumDocs)),
_indexes(new IndexCollection(_selector)),
_attrSearchable(),
diff --git a/searchcore/src/vespa/searchcore/proton/matching/isessioncachepruner.h b/searchcore/src/vespa/searchcore/proton/matching/isessioncachepruner.h
index a34e7211de7..2d38ec13cda 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/isessioncachepruner.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/isessioncachepruner.h
@@ -2,14 +2,14 @@
#pragma once
-#include <vespa/vespalib/util/time.h>
+#include <vespa/fastos/timestamp.h>
namespace proton::matching {
struct ISessionCachePruner {
virtual ~ISessionCachePruner() {}
- virtual void pruneTimedOutSessions(vespalib::steady_time currentTime) = 0;
+ virtual void pruneTimedOutSessions(fastos::SteadyTimeStamp currentTime) = 0;
};
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
index 3cbf88facd5..370569276d5 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
@@ -26,20 +26,20 @@ namespace {
struct TimedMatchLoopCommunicator : IMatchLoopCommunicator {
IMatchLoopCommunicator &communicator;
- vespalib::Timer timer;
- vespalib::duration elapsed;
- TimedMatchLoopCommunicator(IMatchLoopCommunicator &com) : communicator(com), elapsed(vespalib::duration::zero()) {}
+ fastos::StopWatch rerank_time;
+ fastos::TimeStamp elapsed;
+ TimedMatchLoopCommunicator(IMatchLoopCommunicator &com) : communicator(com) {}
double estimate_match_frequency(const Matches &matches) override {
return communicator.estimate_match_frequency(matches);
}
Hits selectBest(SortedHitSequence sortedHits) override {
auto result = communicator.selectBest(sortedHits);
- timer = vespalib::Timer();
+ rerank_time.restart();
return result;
}
RangePair rangeCover(const RangePair &ranges) override {
RangePair result = communicator.rangeCover(ranges);
- elapsed = timer.elapsed();
+ elapsed = rerank_time.elapsed();
return result;
}
};
@@ -67,7 +67,7 @@ MatchMaster::match(search::engine::Trace & trace,
uint32_t distributionKey,
uint32_t numSearchPartitions)
{
- vespalib::Timer query_latency_time;
+ fastos::StopWatch query_latency_time;
vespalib::DualMergeDirector mergeDirector(threadBundle.size());
MatchLoopCommunicator communicator(threadBundle.size(), params.heapSize, mtf.createDiversifier(params.heapSize));
TimedMatchLoopCommunicator timedCommunicator(communicator);
@@ -87,8 +87,8 @@ MatchMaster::match(search::engine::Trace & trace,
resultProcessor.prepareThreadContextCreation(threadBundle.size());
threadBundle.run(targets);
ResultProcessor::Result::UP reply = resultProcessor.makeReply(threadState[0]->extract_result());
- double query_time_s = vespalib::to_s(query_latency_time.elapsed());
- double rerank_time_s = vespalib::to_s(timedCommunicator.elapsed);
+ double query_time_s = query_latency_time.elapsed().sec();
+ double rerank_time_s = timedCommunicator.elapsed.sec();
double match_time_s = 0.0;
std::unique_ptr<vespalib::slime::Inserter> inserter;
if (trace.shouldTrace(4)) {
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
index 7c5e7584eed..a0381af29a8 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
@@ -34,12 +34,12 @@ namespace {
struct WaitTimer {
double &wait_time_s;
- vespalib::Timer wait_time;
+ fastos::StopWatch wait_time;
WaitTimer(double &wait_time_s_in)
: wait_time_s(wait_time_s_in), wait_time()
{ }
void done() {
- wait_time_s += vespalib::to_s(wait_time.elapsed());
+ wait_time_s += wait_time.elapsed().sec();
}
};
@@ -184,7 +184,7 @@ MatchThread::match_loop(MatchTools &tools, HitCollector &hits)
{
bool softDoomed = false;
uint32_t docsCovered = 0;
- vespalib::duration overtime(vespalib::duration::zero());
+ fastos::TimeStamp overtime(0);
Context context(matchParams.rankDropLimit, tools, hits, num_threads);
for (DocidRange docid_range = scheduler.first_range(thread_id);
!docid_range.empty();
@@ -425,12 +425,12 @@ MatchThread::MatchThread(size_t thread_id_in,
void
MatchThread::run()
{
- vespalib::Timer total_time;
- vespalib::Timer match_time(total_time);
+ fastos::StopWatch total_time;
+ fastos::StopWatch match_time;
trace->addEvent(4, "Start MatchThread::run");
MatchTools::UP matchTools = matchToolsFactory.createMatchTools();
search::ResultSet::UP result = findMatches(*matchTools);
- match_time_s = vespalib::to_s(match_time.elapsed());
+ match_time_s = match_time.elapsed().sec();
resultContext = resultProcessor.createThreadContext(matchTools->getDoom(), thread_id, _distributionKey);
{
trace->addEvent(5, "Wait for result processing token");
@@ -445,7 +445,7 @@ MatchThread::run()
trace->addEvent(5, "Start result processing");
processResult(matchTools->getDoom(), std::move(result), *resultContext);
}
- total_time_s = vespalib::to_s(total_time.elapsed());
+ total_time_s = total_time.elapsed().sec();
thread_stats.active_time(total_time_s - wait_time_s).wait_time(wait_time_s);
trace->addEvent(4, "Start thread merge");
mergeDirector.dualMerge(thread_id, *resultContext->result, resultContext->groupingSource);
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.h b/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
index 66bd8d29c2f..7ecbfef634e 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
@@ -74,7 +74,7 @@ private:
bool isBelowLimit() const { return matches < _matches_limit; }
bool isAtLimit() const { return matches == _matches_limit; }
bool atSoftDoom() const { return _doom.soft_doom(); }
- vespalib::duration timeLeft() const { return _doom.soft_left(); }
+ fastos::TimeStamp timeLeft() const { return _doom.soft_left(); }
uint32_t matches;
private:
uint32_t _matches_limit;
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
index 0be67a424ee..426bb353826 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
@@ -134,11 +134,11 @@ Matcher::create_match_tools_factory(const search::engine::Request &request, ISea
? Factor::lookup(rankProperties, _stats.softDoomFactor())
: _stats.softDoomFactor())
: 0.95;
- vespalib::duration safeLeft = std::chrono::duration_cast<vespalib::duration>(request.getTimeLeft() * factor);
- vespalib::steady_time safeDoom(_clock.getTimeNSAssumeRunning() + safeLeft);
+ int64_t safeLeft = request.getTimeLeft() * factor;
+ fastos::SteadyTimeStamp safeDoom(_clock.getTimeNSAssumeRunning() + safeLeft);
if (softTimeoutEnabled) {
LOG(debug, "Soft-timeout computed factor=%1.3f, used factor=%1.3f, userSupplied=%d, softTimeout=%" PRId64,
- _stats.softDoomFactor(), factor, hasFactorOverride, vespalib::count_ns(safeLeft));
+ _stats.softDoomFactor(), factor, hasFactorOverride, safeLeft);
}
vespalib::Doom doom(_clock, safeDoom, request.getTimeOfDoom(), hasFactorOverride);
return std::make_unique<MatchToolsFactory>(_queryLimiter, doom, searchContext, attrContext, request.getStackRef(),
@@ -288,15 +288,15 @@ Matcher::match(const SearchRequest &request, vespalib::ThreadBundle &threadBundl
}
my_stats.queryCollateralTime(total_matching_time.elapsed().sec() - my_stats.queryLatencyAvg());
{
- vespalib::duration duration = request.getTimeUsed();
+ fastos::TimeStamp duration = request.getTimeUsed();
std::lock_guard<std::mutex> guard(_statsLock);
_stats.add(my_stats);
if (my_stats.softDoomed()) {
double old = _stats.softDoomFactor();
- vespalib::duration overtimeLimit = std::chrono::duration_cast<vespalib::duration>((1.0 - _rankSetup->getSoftTimeoutTailCost()) * request.getTimeout());
- vespalib::duration adjustedDuration = duration - my_stats.doomOvertime();
- if (adjustedDuration < vespalib::duration::zero()) {
- adjustedDuration = vespalib::duration::zero();
+ fastos::TimeStamp overtimeLimit = (1.0 - _rankSetup->getSoftTimeoutTailCost()) * request.getTimeout();
+ fastos::TimeStamp adjustedDuration = duration - my_stats.doomOvertime();
+ if (adjustedDuration < 0) {
+ adjustedDuration = 0;
}
bool allowedSoftTimeoutFactorAdjustment = (std::chrono::duration_cast<std::chrono::seconds>(my_clock::now() - _startTime).count() > SECONDS_BEFORE_ALLOWING_SOFT_TIMEOUT_FACTOR_ADJUSTMENT)
&& ! isDoomExplicit;
@@ -307,7 +307,7 @@ Matcher::match(const SearchRequest &request, vespalib::ThreadBundle &threadBundl
", factor %sadjusted from %1.3f to %1.3f",
isDoomExplicit ? "with query override" : "factor adjustment",
covered, numActiveLids,
- vespalib::to_s(request.getTimeout()), vespalib::to_s(my_stats.doomOvertime()), vespalib::to_s(overtimeLimit), vespalib::to_s(duration),
+ request.getTimeout().sec(), my_stats.doomOvertime().sec(), overtimeLimit.sec(), duration.sec(),
request.ranking.c_str(), (allowedSoftTimeoutFactorAdjustment ? "" : "NOT "), old, _stats.softDoomFactor());
}
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matching_stats.cpp b/searchcore/src/vespa/searchcore/proton/matching/matching_stats.cpp
index 84e5b9dfd15..7280653c4f9 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/matching_stats.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/matching_stats.cpp
@@ -14,7 +14,7 @@ MatchingStats::Partition &get_writable_partition(std::vector<MatchingStats::Part
return state[id];
}
-constexpr vespalib::duration MIN_TIMEOUT = 1ms;
+constexpr double MIN_TIMEOUT_SEC = 0.001;
constexpr double MAX_CHANGE_FACTOR = 5;
} // namespace proton::matching::<unnamed>
@@ -81,13 +81,13 @@ MatchingStats::add(const MatchingStats &rhs)
}
MatchingStats &
-MatchingStats::updatesoftDoomFactor(vespalib::duration hardLimit, vespalib::duration softLimit, vespalib::duration duration) {
+MatchingStats::updatesoftDoomFactor(double hardLimit, double softLimit, double duration) {
// The safety capping here should normally not be necessary as all input numbers
// will normally be within reasonable values.
// It is merely a safety measure to avoid overflow on bad input as can happen with time senstive stuff
// in any soft real time system.
- if ((hardLimit >= MIN_TIMEOUT) && (softLimit >= MIN_TIMEOUT)) {
- double diff = vespalib::to_s(softLimit - duration)/vespalib::to_s(hardLimit);
+ if ((hardLimit >= MIN_TIMEOUT_SEC) && (softLimit >= MIN_TIMEOUT_SEC)) {
+ double diff = (softLimit - duration)/hardLimit;
if (duration < softLimit) {
diff = std::min(diff, _softDoomFactor*MAX_CHANGE_FACTOR);
_softDoomFactor += 0.01*diff;
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matching_stats.h b/searchcore/src/vespa/searchcore/proton/matching/matching_stats.h
index f5eccdd1127..a28c423eb7b 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/matching_stats.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/matching_stats.h
@@ -4,7 +4,7 @@
#include <vector>
#include <cstddef>
-#include <vespa/vespalib/util/time.h>
+#include <vespa/fastos/timestamp.h>
namespace proton::matching {
@@ -87,8 +87,8 @@ public:
size_t docsReRanked() const { return _docsReRanked; }
Partition &softDoomed(bool v) { _softDoomed += v ? 1 : 0; return *this; }
size_t softDoomed() const { return _softDoomed; }
- Partition & doomOvertime(vespalib::duration overtime) { _doomOvertime.set(vespalib::to_s(overtime)); return *this; }
- vespalib::duration doomOvertime() const { return vespalib::from_s(_doomOvertime.max()); }
+ Partition & doomOvertime(fastos::TimeStamp overtime) { _doomOvertime.set(overtime.sec()); return *this; }
+ fastos::TimeStamp doomOvertime() const { return fastos::TimeStamp::fromSec(_doomOvertime.max()); }
Partition &active_time(double time_s) { _active_time.set(time_s); return *this; }
double active_time_avg() const { return _active_time.avg(); }
@@ -162,11 +162,11 @@ public:
MatchingStats &softDoomed(size_t value) { _softDoomed = value; return *this; }
size_t softDoomed() const { return _softDoomed; }
- vespalib::duration doomOvertime() const { return vespalib::from_s(_doomOvertime.max()); }
+ fastos::TimeStamp doomOvertime() const { return fastos::TimeStamp::fromSec(_doomOvertime.max()); }
MatchingStats &softDoomFactor(double value) { _softDoomFactor = value; return *this; }
double softDoomFactor() const { return _softDoomFactor; }
- MatchingStats &updatesoftDoomFactor(vespalib::duration hardLimit, vespalib::duration softLimit, vespalib::duration duration);
+ MatchingStats &updatesoftDoomFactor(double hardLimit, double softLimit, double duration);
MatchingStats &queryCollateralTime(double time_s) { _queryCollateralTime.set(time_s); return *this; }
double queryCollateralTimeAvg() const { return _queryCollateralTime.avg(); }
diff --git a/searchcore/src/vespa/searchcore/proton/matching/querylimiter.cpp b/searchcore/src/vespa/searchcore/proton/matching/querylimiter.cpp
index 37ab0054851..5053cc5fdbe 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/querylimiter.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/querylimiter.cpp
@@ -20,9 +20,9 @@ QueryLimiter::grabToken(const Doom & doom)
{
std::unique_lock<std::mutex> guard(_lock);
while ((_maxThreads > 0) && (_activeThreads >= _maxThreads) && !doom.hard_doom()) {
- vespalib::duration left = doom.hard_left();
- if (left > vespalib::duration::zero()) {
- _cond.wait_for(guard, left);
+ int left = doom.hard_left().ms();
+ if (left > 0) {
+ _cond.wait_for(guard, std::chrono::milliseconds(left));
}
}
_activeThreads++;
diff --git a/searchcore/src/vespa/searchcore/proton/matching/search_session.cpp b/searchcore/src/vespa/searchcore/proton/matching/search_session.cpp
index d502a8aba5d..055325b851f 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/search_session.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/search_session.cpp
@@ -5,7 +5,7 @@
namespace proton::matching {
-SearchSession::SearchSession(const SessionId &id, vespalib::steady_time create_time, vespalib::steady_time time_of_doom,
+SearchSession::SearchSession(const SessionId &id, fastos::SteadyTimeStamp create_time, fastos::SteadyTimeStamp time_of_doom,
std::unique_ptr<MatchToolsFactory> match_tools_factory,
OwnershipBundle &&owned_objects)
: _session_id(id),
diff --git a/searchcore/src/vespa/searchcore/proton/matching/search_session.h b/searchcore/src/vespa/searchcore/proton/matching/search_session.h
index 0aec02e9d31..5f9436cce72 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/search_session.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/search_session.h
@@ -5,8 +5,8 @@
#include <vespa/searchcore/proton/documentmetastore/i_document_meta_store_context.h>
#include <vespa/searchcore/proton/summaryengine/isearchhandler.h>
#include <vespa/vespalib/stllike/string.h>
-#include <vespa/vespalib/util/time.h>
#include <memory>
+#include <vespa/fastos/timestamp.h>
namespace search::fef { class Properties; }
@@ -34,16 +34,16 @@ public:
private:
typedef vespalib::string SessionId;
- SessionId _session_id;
- vespalib::steady_time _create_time;
- vespalib::steady_time _time_of_doom;
- OwnershipBundle _owned_objects;
+ SessionId _session_id;
+ fastos::SteadyTimeStamp _create_time;
+ fastos::SteadyTimeStamp _time_of_doom;
+ OwnershipBundle _owned_objects;
std::unique_ptr<MatchToolsFactory> _match_tools_factory;
public:
typedef std::shared_ptr<SearchSession> SP;
- SearchSession(const SessionId &id, vespalib::steady_time create_time, vespalib::steady_time time_of_doom,
+ SearchSession(const SessionId &id, fastos::SteadyTimeStamp create_time, fastos::SteadyTimeStamp time_of_doom,
std::unique_ptr<MatchToolsFactory> match_tools_factory,
OwnershipBundle &&owned_objects);
~SearchSession();
@@ -54,12 +54,12 @@ public:
/**
* Gets this session's create time.
*/
- vespalib::steady_time getCreateTime() const { return _create_time; }
+ fastos::SteadyTimeStamp getCreateTime() const { return _create_time; }
/**
* Gets this session's timeout.
*/
- vespalib::steady_time getTimeOfDoom() const { return _time_of_doom; }
+ fastos::SteadyTimeStamp getTimeOfDoom() const { return _time_of_doom; }
MatchToolsFactory &getMatchToolsFactory() { return *_match_tools_factory; }
};
diff --git a/searchcore/src/vespa/searchcore/proton/matching/session_manager_explorer.cpp b/searchcore/src/vespa/searchcore/proton/matching/session_manager_explorer.cpp
index 785ceadba9a..1976bf8252f 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/session_manager_explorer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/session_manager_explorer.cpp
@@ -3,7 +3,6 @@
#include "session_manager_explorer.h"
#include "sessionmanager.h"
#include <vespa/vespalib/data/slime/slime.h>
-#include <vespa/fastos/timestamp.h>
using vespalib::slime::Inserter;
using vespalib::slime::Cursor;
@@ -31,8 +30,8 @@ public:
for (const auto &session: sessions) {
Cursor &entry = array.addObject();
entry.setString("id", session.id);
- entry.setString("created", fastos::TimeStamp::asString(vespalib::to_utc(session.created)));
- entry.setString("doom", fastos::TimeStamp::asString(vespalib::to_utc(session.doom)));
+ entry.setString("created", fastos::TimeStamp::asString(session.created.toUTC()));
+ entry.setString("doom", fastos::TimeStamp::asString(session.doom.toUTC()));
}
}
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.cpp b/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.cpp
index cf3a788ef7d..02c08a1c401 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.cpp
@@ -50,11 +50,11 @@ struct SessionCache : SessionCacheBase {
}
return ret;
}
- void pruneTimedOutSessions(vespalib::steady_time currentTime) {
+ void pruneTimedOutSessions(fastos::SteadyTimeStamp currentTime) {
std::vector<EntryUP> toDestruct = stealTimedOutSessions(currentTime);
toDestruct.clear();
}
- std::vector<EntryUP> stealTimedOutSessions(vespalib::steady_time currentTime) {
+ std::vector<EntryUP> stealTimedOutSessions(fastos::SteadyTimeStamp currentTime) {
std::vector<EntryUP> toDestruct;
std::lock_guard<std::mutex> guard(_lock);
toDestruct.reserve(_cache.size());
@@ -103,11 +103,11 @@ struct SessionMap : SessionCacheBase {
}
return EntrySP();
}
- void pruneTimedOutSessions(vespalib::steady_time currentTime) {
+ void pruneTimedOutSessions(fastos::SteadyTimeStamp currentTime) {
std::vector<EntrySP> toDestruct = stealTimedOutSessions(currentTime);
toDestruct.clear();
}
- std::vector<EntrySP> stealTimedOutSessions(vespalib::steady_time currentTime) {
+ std::vector<EntrySP> stealTimedOutSessions(fastos::SteadyTimeStamp currentTime) {
std::vector<EntrySP> toDestruct;
std::vector<SessionId> keys;
std::lock_guard<std::mutex> guard(_lock);
@@ -210,13 +210,13 @@ SessionManager::getSortedSearchSessionInfo() const
return sessions;
}
-void SessionManager::pruneTimedOutSessions(vespalib::steady_time currentTime) {
+void SessionManager::pruneTimedOutSessions(fastos::SteadyTimeStamp currentTime) {
_grouping_cache->pruneTimedOutSessions(currentTime);
_search_map->pruneTimedOutSessions(currentTime);
}
void SessionManager::close() {
- pruneTimedOutSessions(vespalib::steady_time::max());
+ pruneTimedOutSessions(fastos::SteadyTimeStamp::FUTURE);
assert(_grouping_cache->empty());
assert(_search_map->empty());
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.h b/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.h
index 96c83270735..dc981c939b4 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.h
@@ -9,7 +9,7 @@
namespace proton::matching {
-using SessionId = vespalib::string;
+typedef vespalib::string SessionId;
struct GroupingSessionCache;
struct SearchSessionCache;
@@ -33,11 +33,11 @@ public:
struct SearchSessionInfo {
vespalib::string id;
- vespalib::steady_time created;
- vespalib::steady_time doom;
+ fastos::SteadyTimeStamp created;
+ fastos::SteadyTimeStamp doom;
SearchSessionInfo(const vespalib::string &id_in,
- vespalib::steady_time created_in,
- vespalib::steady_time doom_in)
+ fastos::SteadyTimeStamp created_in,
+ fastos::SteadyTimeStamp doom_in)
: id(id_in), created(created_in), doom(doom_in) {}
};
@@ -62,7 +62,7 @@ public:
size_t getNumSearchSessions() const;
std::vector<SearchSessionInfo> getSortedSearchSessionInfo() const;
- void pruneTimedOutSessions(vespalib::steady_time currentTime) override;
+ void pruneTimedOutSessions(fastos::SteadyTimeStamp currentTime) override;
void close();
};
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
index 1532ab35c26..45784fc2683 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
@@ -87,7 +87,7 @@ makeSubDBConfig(const ProtonConfig::Distribution & distCfg, const Allocation & a
index::IndexConfig
makeIndexConfig(const ProtonConfig::Index & cfg) {
- return index::IndexConfig(WarmupConfig(vespalib::from_s(cfg.warmup.time), cfg.warmup.unpack), cfg.maxflushed, cfg.cache.size);
+ return index::IndexConfig(WarmupConfig(cfg.warmup.time, cfg.warmup.unpack), cfg.maxflushed, cfg.cache.size);
}
ProtonConfig::Documentdb _G_defaultProtonDocumentDBConfig;
diff --git a/searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.cpp b/searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.cpp
index 70ed5b29541..7c27728bc22 100644
--- a/searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.cpp
@@ -1,5 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "prune_session_cache_job.h"
+#include <vespa/fastos/timestamp.h>
+#include <chrono>
namespace proton {
@@ -14,7 +16,7 @@ PruneSessionCacheJob::PruneSessionCacheJob(ISessionCachePruner &pruner, double j
bool
PruneSessionCacheJob::run()
{
- _pruner.pruneTimedOutSessions(vespalib::steady_clock::now());
+ _pruner.pruneTimedOutSessions(fastos::ClockSteady::now());
return true;
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp
index 309dd44391d..e5b5bc0e559 100644
--- a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp
@@ -13,6 +13,7 @@ LOG_SETUP(".proton.server.rtchooks");
using namespace vespalib;
using vespalib::compression::CompressionConfig;
+using fastos::SteadyTimeStamp;
using fastos::TimeStamp;
namespace {
@@ -37,11 +38,10 @@ namespace proton {
void
RPCHooksBase::checkState(std::unique_ptr<StateArg> arg)
{
- steady_time now(steady_clock::now());
+ SteadyTimeStamp now(fastos::ClockSteady::now());
if (now < arg->_dueTime) {
std::unique_lock<std::mutex> guard(_stateLock);
- vespalib::duration left = (arg->_dueTime - now);
- if (_stateCond.wait_for(guard, left) == std::cv_status::no_timeout) {
+ if (_stateCond.wait_for(guard, std::chrono::milliseconds(std::min(INT64_C(1000), (arg->_dueTime - now)/TimeStamp::MS))) == std::cv_status::no_timeout) {
LOG(debug, "state has changed");
reportState(*arg->_session, arg->_req);
arg->_req->Return();
@@ -285,7 +285,7 @@ RPCHooksBase::rpc_GetState(FRT_RPCRequest *req)
if (sharedSession->getGen() < 0 || sharedSession->getNumDocs() != numDocs) { // NB Should use something else to define generation.
reportState(*sharedSession, req);
} else {
- steady_time dueTime(steady_clock::now() + std::chrono::milliseconds(timeoutMS));
+ SteadyTimeStamp dueTime(fastos::ClockSteady::now() + TimeStamp(timeoutMS * TimeStamp::MS));
auto stateArg = std::make_unique<StateArg>(sharedSession, req, dueTime);
if (_executor.execute(makeTask(makeClosure(this, &RPCHooksBase::checkState, std::move(stateArg))))) {
reportState(*sharedSession, req);
@@ -350,7 +350,7 @@ RPCHooksBase::rpc_getIncrementalState(FRT_RPCRequest *req)
if (sharedSession->getGen() < 0 || sharedSession->getNumDocs() != numDocs) { // NB Should use something else to define generation.
reportState(*sharedSession, req);
} else {
- steady_time dueTime(steady_clock::now() + std::chrono::milliseconds(timeoutMS));
+ SteadyTimeStamp dueTime(fastos::ClockSteady::now() + TimeStamp(timeoutMS * TimeStamp::MS));
auto stateArg = std::make_unique<StateArg>(sharedSession, req, dueTime);
if (_executor.execute(makeTask(makeClosure(this, &RPCHooksBase::checkState, std::move(stateArg))))) {
reportState(*sharedSession, req);
diff --git a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h
index 494551c05bf..21c3283d790 100644
--- a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h
+++ b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h
@@ -49,14 +49,14 @@ private:
};
struct StateArg {
- StateArg(Session::SP session, FRT_RPCRequest * req, vespalib::steady_time dueTime) :
+ StateArg(Session::SP session, FRT_RPCRequest * req, fastos::SteadyTimeStamp dueTime) :
_session(std::move(session)),
_req(req),
_dueTime(dueTime)
{ }
- Session::SP _session;
- FRT_RPCRequest * _req;
- vespalib::steady_time _dueTime;
+ Session::SP _session;
+ FRT_RPCRequest * _req;
+ fastos::SteadyTimeStamp _dueTime;
};
Proton & _proton;
@@ -122,4 +122,6 @@ public:
RPCHooks(Params &params);
};
-}
+
+} // namespace proton
+
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
index 4f55d7fc127..609982a46d5 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
@@ -125,7 +125,7 @@ StoreOnlyDocSubDB::StoreOnlyDocSubDB(const Config &cfg, const Context &ctx)
_subDbType(cfg._subDbType),
_fileHeaderContext(*this, ctx._fileHeaderContext, _docTypeName, _baseDir),
_lidReuseDelayer(),
- _commitTimeTracker(3600s),
+ _commitTimeTracker(TimeStamp::Seconds(3600.0)),
_gidToLidChangeHandler(std::make_shared<DummyGidToLidChangeHandler>())
{
vespalib::mkdir(_baseDir, false); // Assume parent is created.
@@ -401,7 +401,7 @@ StoreOnlyDocSubDB::updateLidReuseDelayer(const LidReuseDelayerConfig &config)
* feed view before applying the new config to the sub dbs.
*/
_lidReuseDelayer->setImmediateCommit(immediateCommit);
- _commitTimeTracker.setVisibilityDelay(vespalib::from_s(config.visibilityDelay()));
+ _commitTimeTracker.setVisibilityDelay(config.visibilityDelay());
}
IReprocessingTask::List
diff --git a/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp b/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp
index e154c6761e2..9744b24a74c 100644
--- a/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp
+++ b/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp
@@ -1,9 +1,9 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "summaryengine.h"
-#include <vespa/vespalib/data/slime/slime.h>
#include <vespa/log/log.h>
LOG_SETUP(".proton.summaryengine.summaryengine");
+#include <vespa/vespalib/data/slime/slime.h>
using namespace search::engine;
using namespace proton;
@@ -137,7 +137,7 @@ SummaryEngine::getDocsums(DocsumRequest::UP req)
reply = snapshot->get()->getDocsums(*req); // use the first handler
}
}
- updateDocsumMetrics(vespalib::to_s(req->getTimeUsed()), getNumDocs(*reply));
+ updateDocsumMetrics(req->getTimeUsed().sec(), getNumDocs(*reply));
}
reply->request = std::move(req);
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
index fc05a5bbc4c..0ca6d299288 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
@@ -391,8 +391,8 @@ IndexMaintainer::swapInNewIndex(LockGuard & guard,
{
assert(indexes->valid());
(void) guard;
- if (_warmupConfig.getDuration() > vespalib::duration::zero()) {
- if (dynamic_cast<const IDiskIndex *>(&source) != nullptr) {
+ if (_warmupConfig.getDuration() > 0) {
+ if (dynamic_cast<const IDiskIndex *>(&source) != NULL) {
LOG(debug, "Warming up a disk index.");
indexes = std::make_shared<WarmupIndexCollection>
(_warmupConfig, getLeaf(guard, _source_list, true), indexes,
diff --git a/searchcorespi/src/vespa/searchcorespi/index/warmupconfig.h b/searchcorespi/src/vespa/searchcorespi/index/warmupconfig.h
index 9ec5b29b3b6..4c2e431f082 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/warmupconfig.h
+++ b/searchcorespi/src/vespa/searchcorespi/index/warmupconfig.h
@@ -1,8 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/vespalib/util/time.h>
-
namespace searchcorespi::index {
/**
@@ -10,13 +8,13 @@ namespace searchcorespi::index {
**/
class WarmupConfig {
public:
- WarmupConfig() : _duration(vespalib::duration::zero()), _unpack(false) { }
- WarmupConfig(vespalib::duration duration, bool unpack) : _duration(duration), _unpack(unpack) { }
- vespalib::duration getDuration() const { return _duration; }
+ WarmupConfig() : _duration(0.0), _unpack(false) { }
+ WarmupConfig(double duration, bool unpack) : _duration(duration), _unpack(unpack) { }
+ double getDuration() const { return _duration; }
bool getUnpack() const { return _unpack; }
private:
- const vespalib::duration _duration;
- const bool _unpack;
+ const double _duration;
+ const bool _unpack;
};
}
diff --git a/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp b/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp
index 72ac28bfd8c..a49518a6d50 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp
@@ -12,6 +12,7 @@ LOG_SETUP(".searchcorespi.index.warmupindexcollection");
namespace searchcorespi {
+using fastos::ClockSteady;
using fastos::TimeStamp;
using index::IDiskIndex;
using search::fef::MatchDataLayout;
@@ -41,7 +42,7 @@ WarmupIndexCollection::WarmupIndexCollection(const WarmupConfig & warmupConfig,
_warmup(warmup),
_executor(executor),
_warmupDone(warmupDone),
- _warmupEndTime(vespalib::steady_clock::now() + warmupConfig.getDuration()),
+ _warmupEndTime(ClockSteady::now() + TimeStamp::Seconds(warmupConfig.getDuration())),
_handledTerms(std::make_unique<FieldTermMap>())
{
if (next->valid()) {
@@ -49,7 +50,7 @@ WarmupIndexCollection::WarmupIndexCollection(const WarmupConfig & warmupConfig,
} else {
LOG(warning, "Next index is not valid, Dangerous !! : %s", next->toString().c_str());
}
- LOG(debug, "For %g seconds I will warm up '%s' %s unpack.", vespalib::to_s(warmupConfig.getDuration()), typeid(_warmup).name(), warmupConfig.getUnpack() ? "with" : "without");
+ LOG(debug, "For %g seconds I will warm up '%s' %s unpack.", warmupConfig.getDuration(), typeid(_warmup).name(), warmupConfig.getUnpack() ? "with" : "without");
LOG(debug, "%s", toString().c_str());
}
@@ -80,7 +81,7 @@ WarmupIndexCollection::toString() const
WarmupIndexCollection::~WarmupIndexCollection()
{
- if (_warmupEndTime != vespalib::steady_time()) {
+ if (_warmupEndTime != fastos::SteadyTimeStamp::ZERO) {
LOG(info, "Warmup aborted due to new state change or application shutdown");
}
_executor.sync();
@@ -113,13 +114,13 @@ WarmupIndexCollection::getSourceId(uint32_t i) const
void
WarmupIndexCollection::fireWarmup(Task::UP task)
{
- vespalib::steady_time now(vespalib::steady_clock::now());
+ fastos::SteadyTimeStamp now(fastos::ClockSteady::now());
if (now < _warmupEndTime) {
_executor.execute(std::move(task));
} else {
std::unique_lock<std::mutex> guard(_lock);
- if (_warmupEndTime != vespalib::steady_time()) {
- _warmupEndTime = vespalib::steady_time();
+ if (_warmupEndTime != fastos::SteadyTimeStamp::ZERO) {
+ _warmupEndTime = fastos::SteadyTimeStamp::ZERO;
guard.unlock();
LOG(info, "Done warming up. Posting WarmupDoneTask");
_warmupDone.warmupDone(shared_from_this());
@@ -154,7 +155,7 @@ WarmupIndexCollection::createBlueprint(const IRequestContext & requestContext,
const FieldSpecList &fields,
const Node &term)
{
- if ( _warmupEndTime == vespalib::steady_time()) {
+ if ( _warmupEndTime == fastos::SteadyTimeStamp::ZERO) {
// warmup done
return _next->createBlueprint(requestContext, fields, term);
}
@@ -223,7 +224,7 @@ WarmupIndexCollection::getSearchableSP(uint32_t i) const
void
WarmupIndexCollection::WarmupTask::run()
{
- if (_warmup._warmupEndTime != vespalib::steady_time()) {
+ if (_warmup._warmupEndTime != fastos::SteadyTimeStamp::ZERO) {
LOG(debug, "Warming up %s", _bluePrint->asString().c_str());
_bluePrint->fetchPostings(true);
SearchIterator::UP it(_bluePrint->createSearch(*_matchData, true));
diff --git a/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.h b/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.h
index 571353574c1..c13a0257019 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.h
+++ b/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.h
@@ -101,7 +101,7 @@ private:
IndexSearchable & _warmup;
vespalib::SyncableThreadExecutor & _executor;
IWarmupDone & _warmupDone;
- vespalib::steady_time _warmupEndTime;
+ fastos::SteadyTimeStamp _warmupEndTime;
std::mutex _lock;
std::unique_ptr<FieldTermMap> _handledTerms;
};
diff --git a/searchlib/src/apps/vespa-attribute-inspect/vespa-attribute-inspect.cpp b/searchlib/src/apps/vespa-attribute-inspect/vespa-attribute-inspect.cpp
index 245f082a2db..f4de610a06d 100644
--- a/searchlib/src/apps/vespa-attribute-inspect/vespa-attribute-inspect.cpp
+++ b/searchlib/src/apps/vespa-attribute-inspect/vespa-attribute-inspect.cpp
@@ -165,16 +165,16 @@ LoadAttribute::Main()
c.setFastSearch(doFastSearch);
c.setHuge(doHuge);
AttributePtr ptr = AttributeFactory::createAttribute(fileName, c);
- vespalib::Timer timer;
+ fastos::StopWatch timer;
load(ptr);
- std::cout << "load time: " << vespalib::to_s(timer.elapsed()) << " seconds " << std::endl;
+ std::cout << "load time: " << timer.elapsed().sec() << " seconds " << std::endl;
std::cout << "numDocs: " << ptr->getNumDocs() << std::endl;
if (doApplyUpdate) {
- timer = vespalib::Timer();
+ timer.restart();
applyUpdate(ptr);
- std::cout << "update time: " << vespalib::to_s(timer.elapsed()) << " seconds " << std::endl;
+ std::cout << "update time: " << timer.elapsed().sec() << " seconds " << std::endl;
}
if (doPrintContent) {
@@ -191,9 +191,9 @@ LoadAttribute::Main()
if (doSave) {
vespalib::string saveFile = fileName + ".save";
std::cout << "saving attribute: " << saveFile << std::endl;
- timer = vespalib::Timer();
+ timer.restart();
ptr->save(saveFile);
- std::cout << "save time: " << vespalib::to_s(timer.elapsed()) << " seconds " << std::endl;
+ std::cout << "save time: " << timer.elapsed().sec() << " seconds " << std::endl;
}
return 0;
diff --git a/searchlib/src/tests/aggregator/perdocexpr.cpp b/searchlib/src/tests/aggregator/perdocexpr.cpp
index 513e94321e1..c078282c442 100644
--- a/searchlib/src/tests/aggregator/perdocexpr.cpp
+++ b/searchlib/src/tests/aggregator/perdocexpr.cpp
@@ -694,9 +694,9 @@ TEST("testDebugFunction") {
DebugWaitFunctionNode n(std::move(add), 1.3, false);
n.prepare(false);
- vespalib::Timer timer;
+ fastos::StopWatch timer;
n.execute();
- EXPECT_TRUE(timer.elapsed() > 1s);
+ EXPECT_TRUE(timer.elapsed().ms() > 1000.0);
EXPECT_EQUAL(static_cast<const Int64ResultNode &>(n.getResult()).get(), 7);
}
{
@@ -706,9 +706,9 @@ TEST("testDebugFunction") {
DebugWaitFunctionNode n(std::move(add), 1.3, true);
n.prepare(false);
- vespalib::Timer timer;
+ fastos::StopWatch timer;
n.execute();
- EXPECT_TRUE(timer.elapsed() > 1s);
+ EXPECT_TRUE(timer.elapsed().ms() > 1000.0);
EXPECT_EQUAL(static_cast<const Int64ResultNode &>(n.getResult()).get(), 7);
}
}
diff --git a/searchlib/src/tests/attribute/benchmark/attributesearcher.h b/searchlib/src/tests/attribute/benchmark/attributesearcher.h
index 8ff6ba46e86..66bb6467194 100644
--- a/searchlib/src/tests/attribute/benchmark/attributesearcher.h
+++ b/searchlib/src/tests/attribute/benchmark/attributesearcher.h
@@ -26,7 +26,7 @@ performSearch(queryeval::SearchIterator & sb, uint32_t numDocs)
class AttributeSearcherStatus
{
public:
- vespalib::duration _totalSearchTime;
+ double _totalSearchTime;
uint64_t _totalHitCount;
uint64_t _numQueries;
uint64_t _numClients;
@@ -39,20 +39,20 @@ public:
_numClients += status._numClients;
}
void printXML() const {
- std::cout << "<total-search-time>" << vespalib::count_ms(_totalSearchTime) << "</total-search-time>" << std::endl; // ms
+ std::cout << "<total-search-time>" << _totalSearchTime << "</total-search-time>" << std::endl; // ms
std::cout << "<avg-search-time>" << avgSearchTime() << "</avg-search-time>" << std::endl; // ms
std::cout << "<search-throughput>" << searchThroughout() << "</search-throughput>" << std::endl; // per/sec
std::cout << "<total-hit-count>" << _totalHitCount << "</total-hit-count>" << std::endl;
std::cout << "<avg-hit-count>" << avgHitCount() << "</avg-hit-count>" << std::endl;
}
double avgSearchTime() const {
- return vespalib::count_ms(_totalSearchTime/_numQueries);
+ return _totalSearchTime / _numQueries;
}
double searchThroughout() const {
- return _numClients * 1000 * _numQueries / (vespalib::count_ns(_totalSearchTime)/1000000.0);
+ return _numClients * 1000 * _numQueries / _totalSearchTime;
}
double avgHitCount() const {
- return _totalHitCount / double(_numQueries);
+ return _totalHitCount / static_cast<double>(_numQueries);
}
};
@@ -62,8 +62,8 @@ class AttributeSearcher : public Runnable
protected:
typedef AttributeVector::SP AttributePtr;
- const AttributePtr & _attrPtr;
- vespalib::Timer _timer;
+ const AttributePtr & _attrPtr;
+ fastos::StopWatch _timer;
AttributeSearcherStatus _status;
public:
@@ -121,7 +121,7 @@ template <typename T>
void
AttributeFindSearcher<T>::doRun()
{
- _timer = vespalib::Timer();
+ _timer.restart();
for (uint32_t i = 0; i < _status._numQueries; ++i) {
// build simple term query
vespalib::asciistream ss;
@@ -139,7 +139,7 @@ AttributeFindSearcher<T>::doRun()
_status._totalHitCount += results->getNumHits();
}
- _status._totalSearchTime += _timer.elapsed();
+ _status._totalSearchTime += _timer.elapsed().ms();
}
@@ -198,7 +198,7 @@ public:
void
AttributeRangeSearcher::doRun()
{
- _timer = vespalib::Timer();
+ _timer.restart();
RangeIterator iter(_spec);
for (uint32_t i = 0; i < _status._numQueries; ++i, ++iter) {
// build simple range term query
@@ -217,7 +217,7 @@ AttributeRangeSearcher::doRun()
_status._totalHitCount += results->getNumHits();
}
- _status._totalSearchTime += _timer.elapsed();
+ _status._totalSearchTime += _timer.elapsed().ms();
}
@@ -240,7 +240,7 @@ public:
void
AttributePrefixSearcher::doRun()
{
- _timer = vespalib::Timer();
+ _timer.restart();
for (uint32_t i = 0; i < _status._numQueries; ++i) {
// build simple prefix term query
buildTermQuery(_query, _attrPtr->getName(), _values[i % _values.size()].c_str(), true);
@@ -256,7 +256,7 @@ AttributePrefixSearcher::doRun()
_status._totalHitCount += results->getNumHits();
}
- _status._totalSearchTime += _timer.elapsed();
+ _status._totalSearchTime += _timer.elapsed().ms();
}
} // search
diff --git a/searchlib/src/tests/attribute/benchmark/attributeupdater.h b/searchlib/src/tests/attribute/benchmark/attributeupdater.h
index e4cfaf430d8..c56c809457b 100644
--- a/searchlib/src/tests/attribute/benchmark/attributeupdater.h
+++ b/searchlib/src/tests/attribute/benchmark/attributeupdater.h
@@ -49,19 +49,19 @@ public:
class AttributeUpdaterStatus
{
public:
- vespalib::duration _totalUpdateTime;
+ double _totalUpdateTime;
uint64_t _numDocumentUpdates;
uint64_t _numValueUpdates;
AttributeUpdaterStatus() :
- _totalUpdateTime(vespalib::duration::zero()), _numDocumentUpdates(0), _numValueUpdates(0) {}
+ _totalUpdateTime(0), _numDocumentUpdates(0), _numValueUpdates(0) {}
void reset() {
- _totalUpdateTime = vespalib::duration::zero();
+ _totalUpdateTime = 0;
_numDocumentUpdates = 0;
_numValueUpdates = 0;
}
void printXML() const {
- std::cout << "<total-update-time>" << vespalib::count_ms(_totalUpdateTime) << "</total-update-time>" << std::endl;
+ std::cout << "<total-update-time>" << _totalUpdateTime << "</total-update-time>" << std::endl;
std::cout << "<documents-updated>" << _numDocumentUpdates << "</documents-updated>" << std::endl;
std::cout << "<document-update-throughput>" << documentUpdateThroughput() << "</document-update-throughput>" << std::endl;
std::cout << "<avg-document-update-time>" << avgDocumentUpdateTime() << "</avg-document-update-time>" << std::endl;
@@ -70,19 +70,17 @@ public:
std::cout << "<avg-value-update-time>" << avgValueUpdateTime() << "</avg-value-update-time>" << std::endl;
}
double documentUpdateThroughput() const {
- return _numDocumentUpdates * 1000 / as_ms();
+ return _numDocumentUpdates * 1000 / _totalUpdateTime;
}
double avgDocumentUpdateTime() const {
- return vespalib::count_ms(_totalUpdateTime / _numDocumentUpdates);
+ return _totalUpdateTime / _numDocumentUpdates;
}
double valueUpdateThroughput() const {
- return _numValueUpdates * 1000 / as_ms();
+ return _numValueUpdates * 1000 / _totalUpdateTime;
}
double avgValueUpdateTime() const {
- return vespalib::count_ms(_totalUpdateTime / _numValueUpdates);
+ return _totalUpdateTime / _numValueUpdates;
}
-private:
- double as_ms() const { return vespalib::count_ns(_totalUpdateTime)/1000000.0;}
};
// AttributeVectorInstance, AttributeVectorType, AttributeVectorBufferType
@@ -100,7 +98,7 @@ protected:
std::vector<BT> _getBuffer;
RandomGenerator & _rndGen;
AttributeCommit _expected;
- vespalib::Timer _timer;
+ fastos::StopWatch _timer;
AttributeUpdaterStatus _status;
AttributeValidator _validator;
@@ -150,7 +148,7 @@ AttributeUpdater<Vector, T, BT>::AttributeUpdater(const AttributePtr & attrPtr,
{}
template <typename Vector, typename T, typename BT>
-AttributeUpdater<Vector, T, BT>::~AttributeUpdater() = default;
+AttributeUpdater<Vector, T, BT>::~AttributeUpdater() {}
template <typename Vector, typename T, typename BT>
class AttributeUpdaterThread : public AttributeUpdater<Vector, T, BT>, public Runnable
@@ -175,7 +173,7 @@ AttributeUpdaterThread<Vector, T, BT>::AttributeUpdaterThread(const AttributePtr
Runnable()
{}
template <typename Vector, typename T, typename BT>
-AttributeUpdaterThread<Vector, T, BT>::~AttributeUpdaterThread() = default;
+AttributeUpdaterThread<Vector, T, BT>::~AttributeUpdaterThread() { }
template <typename Vector, typename T, typename BT>
@@ -269,7 +267,7 @@ template <typename Vector, typename T, typename BT>
void
AttributeUpdater<Vector, T, BT>::populate()
{
- _timer = vespalib::Timer();
+ _timer.restart();
for (uint32_t doc = 0; doc < _attrPtr->getNumDocs(); ++doc) {
updateValues(doc);
if (doc % _commitFreq == (_commitFreq - 1)) {
@@ -277,7 +275,7 @@ AttributeUpdater<Vector, T, BT>::populate()
}
}
commit();
- _status._totalUpdateTime += _timer.elapsed();
+ _status._totalUpdateTime += _timer.elapsed().ms();
}
@@ -285,7 +283,7 @@ template <typename Vector, typename T, typename BT>
void
AttributeUpdater<Vector, T, BT>::update(uint32_t numUpdates)
{
- _timer = vespalib::Timer();
+ _timer.restart();
for (uint32_t i = 0; i < numUpdates; ++i) {
uint32_t doc = getRandomDoc();
updateValues(doc);
@@ -294,7 +292,7 @@ AttributeUpdater<Vector, T, BT>::update(uint32_t numUpdates)
}
}
commit();
- _status._totalUpdateTime += _timer.elapsed();
+ _status._totalUpdateTime += _timer.elapsed().ms();
}
@@ -302,7 +300,7 @@ template <typename Vector, typename T, typename BT>
void
AttributeUpdaterThread<Vector, T, BT>::doRun()
{
- this->_timer = vespalib::Timer();
+ this->_timer.restart();
while(!_done) {
uint32_t doc = this->getRandomDoc();
this->updateValues(doc);
@@ -311,7 +309,9 @@ AttributeUpdaterThread<Vector, T, BT>::doRun()
}
}
this->commit();
- this->_status._totalUpdateTime += this->_timer.elapsed();
+ this->_status._totalUpdateTime += this->_timer.elapsed().ms();
}
+
} // search
+
diff --git a/searchlib/src/tests/engine/proto_converter/proto_converter_test.cpp b/searchlib/src/tests/engine/proto_converter/proto_converter_test.cpp
index 3e129457d46..7526326b6ca 100644
--- a/searchlib/src/tests/engine/proto_converter/proto_converter_test.cpp
+++ b/searchlib/src/tests/engine/proto_converter/proto_converter_test.cpp
@@ -46,7 +46,7 @@ TEST_F(SearchRequestTest, require_that_hits_is_converted) {
TEST_F(SearchRequestTest, require_that_timeout_is_converted) {
proto.set_timeout(500);
convert();
- EXPECT_EQ(request.getTimeout(), 500ms);
+ EXPECT_EQ(request.getTimeout().ms(), 500);
}
TEST_F(SearchRequestTest, require_that_trace_level_is_converted) {
@@ -317,7 +317,7 @@ TEST_F(DocsumRequestTest, require_that_root_slime_is_used) {
TEST_F(DocsumRequestTest, require_that_timeout_is_converted) {
proto.set_timeout(500);
convert();
- EXPECT_EQ(request.getTimeout(), 500ms);
+ EXPECT_EQ(request.getTimeout().ms(), 500);
}
TEST_F(DocsumRequestTest, require_that_session_key_is_converted) {
diff --git a/searchlib/src/tests/features/featurebenchmark.cpp b/searchlib/src/tests/features/featurebenchmark.cpp
index 6e1c5b1487c..43b1e38f4a4 100644
--- a/searchlib/src/tests/features/featurebenchmark.cpp
+++ b/searchlib/src/tests/features/featurebenchmark.cpp
@@ -105,10 +105,10 @@ public:
private:
search::fef::BlueprintFactory _factory;
- vespalib::Timer _timer;
- vespalib::duration _sample;
+ fastos::StopWatch _timer;
+ fastos::TimeStamp _sample;
- void start() { _timer = vespalib::Timer(); }
+ void start() { _timer.restart(); }
void sample() { _sample = _timer.elapsed(); }
void setupPropertyMap(Properties & props, const KeyValueVector & values);
void runFieldMatch(Config & cfg);
@@ -648,8 +648,8 @@ Benchmark::Main()
std::cout << "feature case '" << cfg.getCase() << "' is not known" << std::endl;
}
- std::cout << "TET: " << vespalib::count_ms(_sample) << " (ms)" << std::endl;
- std::cout << "ETPD: " << std::fixed << std::setprecision(10) << double(vespalib::count_ms(_sample)) / cfg.getNumRuns() << " (ms)" << std::endl;
+ std::cout << "TET: " << _sample.ms() << " (ms)" << std::endl;
+ std::cout << "ETPD: " << std::fixed << std::setprecision(10) << _sample.ms() / cfg.getNumRuns() << " (ms)" << std::endl;
std::cout << "**** '" << cfg.getFeature() << "' ****" << std::endl;
TEST_DONE();
diff --git a/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp b/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp
index 36a567e5675..8f22ab87c97 100644
--- a/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp
+++ b/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp
@@ -277,7 +277,7 @@ Test::Main()
LOG(info, "sizeof(CountAggregationResult) = %ld", sizeof(CountAggregationResult));
LOG(info, "sizeof(Int64ResultNode) = %ld", sizeof(Int64ResultNode));
- vespalib::steady_time start(vespalib::steady_clock::now());
+ fastos::SteadyTimeStamp start(fastos::ClockSteady::now());
if (idType == "int") {
if (aggrType == "sum") {
benchmarkIntegerSum(useEngine, numDocs, numQueries, maxGroups);
diff --git a/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp b/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp
index 0743ac8408d..bf1b5352778 100644
--- a/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp
+++ b/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp
@@ -170,7 +170,7 @@ public:
};
PhraseSearchTest::PhraseSearchTest(bool expiredDoom)
- : _requestContext(nullptr, expiredDoom ? vespalib::steady_time(): vespalib::steady_time::max()),
+ : _requestContext(nullptr, expiredDoom ? fastos::SteadyTimeStamp::ZERO : fastos::SteadyTimeStamp::FUTURE),
_index(),
_phrase_fs(field, fieldId, phrase_handle),
_phrase(_phrase_fs, _requestContext, false),
@@ -199,7 +199,7 @@ void Test::requireThatIteratorHonorsFutureDoom() {
test.fetchPostings(false);
vespalib::Clock clock;
- vespalib::Doom futureDoom(clock, vespalib::steady_time::max());
+ vespalib::Doom futureDoom(clock, fastos::SteadyTimeStamp::FUTURE);
unique_ptr<SearchIterator> search(test.createSearch(false));
static_cast<SimplePhraseSearch &>(*search).setDoom(&futureDoom);
EXPECT_TRUE(!search->seek(1u));
@@ -213,7 +213,7 @@ void Test::requireThatIteratorHonorsDoom() {
test.fetchPostings(false);
vespalib::Clock clock;
- vespalib::Doom futureDoom(clock, vespalib::steady_time());
+ vespalib::Doom futureDoom(clock, fastos::SteadyTimeStamp::ZERO);
unique_ptr<SearchIterator> search(test.createSearch(false));
static_cast<SimplePhraseSearch &>(*search).setDoom(&futureDoom);
EXPECT_TRUE(!search->seek(1u));
diff --git a/searchlib/src/tests/queryeval/sparse_vector_benchmark/sparse_vector_benchmark_test.cpp b/searchlib/src/tests/queryeval/sparse_vector_benchmark/sparse_vector_benchmark_test.cpp
index 3b61aaaac3e..7d2efc5f2bc 100644
--- a/searchlib/src/tests/queryeval/sparse_vector_benchmark/sparse_vector_benchmark_test.cpp
+++ b/searchlib/src/tests/queryeval/sparse_vector_benchmark/sparse_vector_benchmark_test.cpp
@@ -131,8 +131,8 @@ int Plot::_plots = 0;
//-----------------------------------------------------------------------------
-constexpr uint32_t default_weight = 100;
-constexpr vespalib::duration max_time = 1000s;
+uint32_t default_weight = 100;
+double max_time = 1000000.0;
//-----------------------------------------------------------------------------
@@ -312,20 +312,20 @@ struct NegativeFilterAfterStrategy : FilterStrategy {
//-----------------------------------------------------------------------------
struct Result {
- vespalib::duration time;
+ double time_ms;
uint32_t num_hits;
- Result() : time(max_time), num_hits(0) {}
- Result(vespalib::duration t, uint32_t n) : time(t), num_hits(n) {}
+ Result() : time_ms(max_time), num_hits(0) {}
+ Result(double t, uint32_t n) : time_ms(t), num_hits(n) {}
void combine(const Result &r) {
- if (time == max_time) {
+ if (time_ms == max_time) {
*this = r;
} else {
assert(num_hits == r.num_hits);
- time = std::min(time, r.time);
+ time_ms = std::min(time_ms, r.time_ms);
}
}
std::string toString() const {
- return vespalib::make_string("%u hits, %ld ms", num_hits, vespalib::count_ms(time));
+ return vespalib::make_string("%u hits, %g ms", num_hits, time_ms);
}
};
@@ -333,12 +333,12 @@ Result run_single_benchmark(FilterStrategy &filterStrategy, SparseVectorFactory
SearchIterator::UP search(filterStrategy.createRoot(vectorFactory, childFactory, childCnt, limit));
SearchIterator &sb = *search;
uint32_t num_hits = 0;
- vespalib::Timer timer;
+ fastos::StopWatch timer;
for (sb.seek(1); !sb.isAtEnd(); sb.seek(sb.getDocId() + 1)) {
++num_hits;
sb.unpack(sb.getDocId());
}
- return Result(timer.elapsed(), num_hits);
+ return Result(timer.elapsed().ms(), num_hits);
}
//-----------------------------------------------------------------------------
@@ -371,7 +371,7 @@ public:
for (int j = 0; j < 5; ++j) {
result.combine(run_single_benchmark(_filterStrategy, svf, _childFactory, childCnt, _limit));
}
- graph->addValue(childCnt, vespalib::count_ms(result.time));
+ graph->addValue(childCnt, result.time_ms);
fprintf(stderr, " %u children => %s\n", childCnt, result.toString().c_str());
}
}
diff --git a/searchlib/src/tests/queryeval/weak_and/wand_bench_setup.hpp b/searchlib/src/tests/queryeval/weak_and/wand_bench_setup.hpp
index 576c9abe249..65890f81e16 100644
--- a/searchlib/src/tests/queryeval/weak_and/wand_bench_setup.hpp
+++ b/searchlib/src/tests/queryeval/weak_and/wand_bench_setup.hpp
@@ -187,21 +187,22 @@ struct FilterFactory : WandFactory {
struct Setup {
Stats stats;
- vespalib::duration minTime;
- Setup() : stats(), minTime(10000s) {}
+ double minTimeMs;
+ Setup() : stats(), minTimeMs(10000000.0) {}
virtual ~Setup() {}
virtual std::string name() const = 0;
virtual SearchIterator::UP create() = 0;
void perform() {
SearchIterator::UP search = create();
SearchIterator &sb = *search;
- vespalib::Timer timer;
+ fastos::StopWatch timer;
for (sb.seek(1); !sb.isAtEnd(); sb.seek(sb.getDocId() + 1)) {
stats.hit();
sb.unpack(sb.getDocId());
}
- if (timer.elapsed() < minTime) {
- minTime = timer.elapsed();
+ double ms = timer.elapsed().ms();
+ if (ms < minTimeMs) {
+ minTimeMs = ms;
}
}
void benchmark() {
@@ -212,7 +213,7 @@ struct Setup {
stats.print();
}
}
- fprintf(stderr, "time (ms): %ld\n", vespalib::count_ms(minTime));
+ fprintf(stderr, "time (ms): %g\n", minTimeMs);
}
};
diff --git a/searchlib/src/tests/sortspec/multilevelsort.cpp b/searchlib/src/tests/sortspec/multilevelsort.cpp
index 8c4b931a265..640e6f45e80 100644
--- a/searchlib/src/tests/sortspec/multilevelsort.cpp
+++ b/searchlib/src/tests/sortspec/multilevelsort.cpp
@@ -241,7 +241,7 @@ MultilevelSortTest::sortAndCheck(const std::vector<Spec> &spec, uint32_t num,
}
vespalib::Clock clock;
- vespalib::Doom doom(clock, vespalib::steady_time::max());
+ vespalib::Doom doom(clock, fastos::SteadyTimeStamp::FUTURE);
search::uca::UcaConverterFactory ucaFactory;
FastS_SortSpec sorter(7, doom, ucaFactory, _sortMethod);
// init sorter with sort data
@@ -263,9 +263,9 @@ MultilevelSortTest::sortAndCheck(const std::vector<Spec> &spec, uint32_t num,
}
}
- vespalib::Timer timer;
+ fastos::StopWatch timer;
sorter.sortResults(hits, num, num);
- LOG(info, "sort time = %ld ms", vespalib::count_ms(timer.elapsed()));
+ LOG(info, "sort time = %ld ms", timer.elapsed().ms());
uint32_t *offsets = new uint32_t[num + 1];
char *buf = new char[sorter.getSortDataSize(0, num)];
@@ -398,7 +398,7 @@ TEST("require that all sort methods behave the same")
TEST("test that [docid] translates to [lid][paritionid]") {
vespalib::Clock clock;
- vespalib::Doom doom(clock, vespalib::steady_time::max());
+ vespalib::Doom doom(clock, fastos::SteadyTimeStamp::FUTURE);
search::uca::UcaConverterFactory ucaFactory;
FastS_SortSpec asc(7, doom, ucaFactory);
RankedHit hits[2] = {RankedHit(91, 0.0), RankedHit(3, 2.0)};
diff --git a/searchlib/src/vespa/searchlib/aggregation/grouping.cpp b/searchlib/src/vespa/searchlib/aggregation/grouping.cpp
index 4ad8e0089d9..5c93fb4161c 100644
--- a/searchlib/src/vespa/searchlib/aggregation/grouping.cpp
+++ b/searchlib/src/vespa/searchlib/aggregation/grouping.cpp
@@ -115,8 +115,8 @@ Grouping::Grouping()
_lastLevel(0),
_levels(),
_root(),
- _clock(nullptr),
- _timeOfDoom(vespalib::duration::zero())
+ _clock(NULL),
+ _timeOfDoom(0)
{
}
diff --git a/searchlib/src/vespa/searchlib/aggregation/grouping.h b/searchlib/src/vespa/searchlib/aggregation/grouping.h
index 249262438da..4230bd777d6 100644
--- a/searchlib/src/vespa/searchlib/aggregation/grouping.h
+++ b/searchlib/src/vespa/searchlib/aggregation/grouping.h
@@ -31,7 +31,7 @@ private:
GroupingLevelList _levels; // grouping parameters per level
Group _root; // the grouping tree
const vespalib::Clock *_clock; // An optional clock to be used for timeout handling.
- vespalib::steady_time _timeOfDoom; // Used if clock is specified. This is time when request expires.
+ fastos::SteadyTimeStamp _timeOfDoom; // Used if clock is specified. This is time when request expires.
bool hasExpired() const { return _clock->getTimeNS() > _timeOfDoom; }
void aggregateWithoutClock(const RankedHit * rankedHit, unsigned int len);
@@ -59,7 +59,7 @@ public:
Grouping &addLevel(GroupingLevel && level) { _levels.push_back(std::move(level)); return *this; }
Grouping &setRoot(const Group &root_) { _root = root_; return *this; }
Grouping &setClock(const vespalib::Clock * clock) { _clock = clock; return *this; }
- Grouping &setTimeOfDoom(vespalib::steady_time timeOfDoom) { _timeOfDoom = timeOfDoom; return *this; }
+ Grouping &setTimeOfDoom(fastos::SteadyTimeStamp timeOfDoom) { _timeOfDoom = timeOfDoom; return *this; }
unsigned int getId() const { return _id; }
bool valid() const { return _valid; }
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
index 4c060c5fab8..e79db2fae11 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
@@ -136,9 +136,9 @@ AttributeVector::~AttributeVector() = default;
void AttributeVector::updateStat(bool force) {
if (force) {
onUpdateStat();
- } else if (_nextStatUpdateTime < vespalib::steady_clock::now()) {
+ } else if (_nextStatUpdateTime < fastos::ClockSteady::now()) {
onUpdateStat();
- _nextStatUpdateTime = vespalib::steady_clock::now() + 5s;
+ _nextStatUpdateTime = fastos::ClockSteady::now() + fastos::TimeStamp(5ul * fastos::TimeStamp::SEC);
}
}
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h
index 48ef8257329..d45cd995ea5 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.h
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h
@@ -20,7 +20,7 @@
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/util/address_space.h>
#include <vespa/vespalib/util/rcuvector.h>
-#include <vespa/vespalib/util/time.h>
+#include <vespa/fastos/timestamp.h>
#include <cmath>
#include <mutex>
#include <shared_mutex>
@@ -587,7 +587,7 @@ private:
uint64_t _compactLidSpaceGeneration;
bool _hasEnum;
bool _loaded;
- vespalib::steady_time _nextStatUpdateTime;
+ fastos::SteadyTimeStamp _nextStatUpdateTime;
////// Locking strategy interface. only available from the Guards.
/**
diff --git a/searchlib/src/vespa/searchlib/engine/proto_converter.cpp b/searchlib/src/vespa/searchlib/engine/proto_converter.cpp
index e5846734a8d..2495a6e12bd 100644
--- a/searchlib/src/vespa/searchlib/engine/proto_converter.cpp
+++ b/searchlib/src/vespa/searchlib/engine/proto_converter.cpp
@@ -52,7 +52,7 @@ ProtoConverter::search_request_from_proto(const ProtoSearchRequest &proto, Searc
{
request.offset = proto.offset();
request.maxhits = proto.hits();
- request.setTimeout(1ms * proto.timeout());
+ request.setTimeout(fastos::TimeStamp::Seconds(0.001 * proto.timeout()));
request.setTraceLevel(proto.trace_level());
request.sortSpec = make_sort_spec(proto.sorting());
request.sessionId.assign(proto.session_key().begin(), proto.session_key().end());
@@ -111,7 +111,7 @@ ProtoConverter::search_reply_to_proto(const SearchReply &reply, ProtoSearchReply
void
ProtoConverter::docsum_request_from_proto(const ProtoDocsumRequest &proto, DocsumRequest &request)
{
- request.setTimeout(1ms * proto.timeout());
+ request.setTimeout(fastos::TimeStamp::Seconds(0.001 * proto.timeout()));
request.sessionId.assign(proto.session_key().begin(), proto.session_key().end());
request.propertiesMap.lookupCreate(MapNames::MATCH).add("documentdb.searchdoctype", proto.document_type());
request.resultClassName = proto.summary_class();
diff --git a/searchlib/src/vespa/searchlib/engine/proto_rpc_adapter.cpp b/searchlib/src/vespa/searchlib/engine/proto_rpc_adapter.cpp
index 4634c192a51..4fa7079fe46 100644
--- a/searchlib/src/vespa/searchlib/engine/proto_rpc_adapter.cpp
+++ b/searchlib/src/vespa/searchlib/engine/proto_rpc_adapter.cpp
@@ -115,7 +115,7 @@ struct SearchCompletionHandler : SearchClient {
encode_search_reply(msg, *req.GetReturn());
stats.reply_size = (*req.GetReturn())[2]._data._len;
if (reply->request) {
- stats.latency = vespalib::to_s(reply->request->getTimeUsed());
+ stats.latency = reply->request->getTimeUsed().sec();
metrics.update_query_metrics(stats);
}
req.Return();
@@ -161,7 +161,7 @@ struct GetDocsumsCompletionHandler : DocsumClient {
encode_message(msg, *req.GetReturn());
stats.reply_size = (*req.GetReturn())[2]._data._len;
if (reply->request) {
- stats.latency = vespalib::to_s(reply->request->getTimeUsed());
+ stats.latency = reply->request->getTimeUsed().sec();
metrics.update_docsum_metrics(stats);
}
req.Return();
diff --git a/searchlib/src/vespa/searchlib/engine/request.cpp b/searchlib/src/vespa/searchlib/engine/request.cpp
index cb00dfcf09b..84615105579 100644
--- a/searchlib/src/vespa/searchlib/engine/request.cpp
+++ b/searchlib/src/vespa/searchlib/engine/request.cpp
@@ -6,7 +6,7 @@ namespace search::engine {
Request::Request(RelativeTime relativeTime)
: _relativeTime(std::move(relativeTime)),
- _timeOfDoom(vespalib::steady_time::max()),
+ _timeOfDoom(fastos::TimeStamp(fastos::TimeStamp::FUTURE)),
dumpFeatures(false),
ranking(),
location(),
@@ -19,17 +19,17 @@ Request::Request(RelativeTime relativeTime)
Request::~Request() = default;
-void Request::setTimeout(vespalib::duration timeout)
+void Request::setTimeout(const fastos::TimeStamp & timeout)
{
_timeOfDoom = getStartTime() + timeout;
}
-vespalib::duration Request::getTimeUsed() const
+fastos::TimeStamp Request::getTimeUsed() const
{
return _relativeTime.timeSinceDawn();
}
-vespalib::duration Request::getTimeLeft() const
+fastos::TimeStamp Request::getTimeLeft() const
{
return _timeOfDoom - _relativeTime.now();
}
diff --git a/searchlib/src/vespa/searchlib/engine/request.h b/searchlib/src/vespa/searchlib/engine/request.h
index ef90e38dc3d..4f4bf526920 100644
--- a/searchlib/src/vespa/searchlib/engine/request.h
+++ b/searchlib/src/vespa/searchlib/engine/request.h
@@ -4,6 +4,7 @@
#include "propertiesmap.h"
#include "trace.h"
+#include <vespa/fastos/timestamp.h>
namespace search::engine {
@@ -14,14 +15,14 @@ public:
Request(const Request &) = delete;
Request & operator =(const Request &) = delete;
virtual ~Request();
- void setTimeout(vespalib::duration timeout);
- vespalib::steady_time getStartTime() const { return _relativeTime.timeOfDawn(); }
- vespalib::steady_time getTimeOfDoom() const { return _timeOfDoom; }
- vespalib::duration getTimeout() const { return _timeOfDoom - getStartTime(); }
- vespalib::duration getTimeUsed() const;
- vespalib::duration getTimeLeft() const;
+ void setTimeout(const fastos::TimeStamp & timeout);
+ fastos::SteadyTimeStamp getStartTime() const { return _relativeTime.timeOfDawn(); }
+ fastos::SteadyTimeStamp getTimeOfDoom() const { return _timeOfDoom; }
+ fastos::TimeStamp getTimeout() const { return _timeOfDoom - getStartTime(); }
+ fastos::TimeStamp getTimeUsed() const;
+ fastos::TimeStamp getTimeLeft() const;
const RelativeTime & getRelativeTime() const { return _relativeTime; }
- bool expired() const { return getTimeLeft() <= vespalib::duration::zero(); }
+ bool expired() const { return getTimeLeft() <= 0l; }
const vespalib::stringref getStackRef() const {
return vespalib::stringref(&stackDump[0], stackDump.size());
@@ -36,8 +37,8 @@ public:
Trace & trace() const { return _trace; }
private:
- RelativeTime _relativeTime;
- vespalib::steady_time _timeOfDoom;
+ RelativeTime _relativeTime;
+ fastos::SteadyTimeStamp _timeOfDoom;
public:
/// Everything here should move up to private section and have accessors
bool dumpFeatures;
diff --git a/searchlib/src/vespa/searchlib/engine/trace.cpp b/searchlib/src/vespa/searchlib/engine/trace.cpp
index 95d6c967369..ae0c6810ca1 100644
--- a/searchlib/src/vespa/searchlib/engine/trace.cpp
+++ b/searchlib/src/vespa/searchlib/engine/trace.cpp
@@ -2,13 +2,12 @@
#include "trace.h"
#include <vespa/vespalib/data/slime/slime.h>
-#include <vespa/fastos/timestamp.h>
namespace search::engine {
-vespalib::steady_time
+fastos::SteadyTimeStamp
SteadyClock::now() const {
- return vespalib::steady_clock::now();
+ return fastos::ClockSteady::now();
}
RelativeTime::RelativeTime(std::unique_ptr<Clock> clock)
@@ -37,12 +36,9 @@ Trace::Trace(const RelativeTime & relativeTime, uint32_t level)
}
void
-Trace::start(int level, bool useUTC) {
+Trace::start(int level) {
if (shouldTrace(level) && !hasTrace()) {
- vespalib::duration since_epoch = useUTC
- ? vespalib::to_utc(_relativeTime.timeOfDawn()).time_since_epoch()
- : _relativeTime.timeOfDawn().time_since_epoch();
- root().setString("start_time", fastos::TimeStamp::asString(vespalib::to_s(since_epoch)));
+ root().setString("start_time_relative", _relativeTime.timeOfDawn().toString());
}
}
@@ -72,13 +68,13 @@ Trace::addEvent(uint32_t level, vespalib::stringref event) {
void
Trace::addTimeStamp(Cursor & trace) {
- trace.setDouble("timestamp_ms", vespalib::count_ns(_relativeTime.timeSinceDawn())/1000000.0);
+ trace.setDouble("timestamp_ms", _relativeTime.timeSinceDawn()/1000000.0);
}
void Trace::done() {
if (!hasTrace()) { return; }
- root().setDouble("duration_ms", vespalib::count_ns(_relativeTime.timeSinceDawn())/1000000.0);
+ root().setDouble("duration_ms", _relativeTime.timeSinceDawn()/1000000.0);
}
vespalib::string
diff --git a/searchlib/src/vespa/searchlib/engine/trace.h b/searchlib/src/vespa/searchlib/engine/trace.h
index 4076f0a3daa..0d7dc2982f1 100644
--- a/searchlib/src/vespa/searchlib/engine/trace.h
+++ b/searchlib/src/vespa/searchlib/engine/trace.h
@@ -3,7 +3,7 @@
#pragma once
#include <vespa/vespalib/stllike/string.h>
-#include <vespa/vespalib/util/time.h>
+#include <vespa/fastos/timestamp.h>
namespace vespalib { class Slime; }
namespace vespalib::slime { struct Cursor; }
@@ -13,21 +13,21 @@ namespace search::engine {
class Clock {
public:
virtual ~Clock() = default;
- virtual vespalib::steady_time now() const = 0;
+ virtual fastos::SteadyTimeStamp now() const = 0;
};
class SteadyClock : public Clock {
public:
- vespalib::steady_time now() const override;
+ fastos::SteadyTimeStamp now() const override;
};
class CountingClock : public Clock {
public:
CountingClock(int64_t start, int64_t increment) : _increment(increment), _nextTime(start) { }
- vespalib::steady_time now() const override {
+ fastos::SteadyTimeStamp now() const override {
int64_t prev = _nextTime;
_nextTime += _increment;
- return vespalib::steady_time(vespalib::duration(prev));
+ return fastos::SteadyTimeStamp(prev);
}
private:
const int64_t _increment;
@@ -37,11 +37,11 @@ private:
class RelativeTime {
public:
RelativeTime(std::unique_ptr<Clock> clock);
- vespalib::steady_time timeOfDawn() const { return _start; }
- vespalib::duration timeSinceDawn() const { return _clock->now() - _start; }
- vespalib::steady_time now() const { return _clock->now(); }
+ fastos::SteadyTimeStamp timeOfDawn() const { return _start; }
+ fastos::TimeStamp timeSinceDawn() const { return _clock->now() - _start; }
+ fastos::SteadyTimeStamp now() const { return _clock->now(); }
private:
- vespalib::steady_time _start;
+ fastos::SteadyTimeStamp _start;
std::unique_ptr<Clock> _clock;
};
@@ -60,7 +60,7 @@ public:
* Will add start timestamp if level is high enough
* @param level
*/
- void start(int level, bool useUTC=true);
+ void start(int level);
/**
* Will give you a trace entry. It will also add a timestamp relative to the creation of the trace.
diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.cpp b/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.cpp
index 28af2c14781..9af6d7024a2 100644
--- a/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.cpp
@@ -1,10 +1,10 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include "fake_requestcontext.h"
+#include <vespa/searchlib/queryeval/fake_requestcontext.h>
namespace search::queryeval {
-FakeRequestContext::FakeRequestContext(attribute::IAttributeContext * context, vespalib::steady_time softDoom, vespalib::steady_time hardDoom)
+FakeRequestContext::FakeRequestContext(attribute::IAttributeContext * context, fastos::SteadyTimeStamp softDoom, fastos::SteadyTimeStamp hardDoom)
: _clock(),
_doom(_clock, softDoom, hardDoom, false),
_attributeContext(context),
diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h b/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h
index 3de464224f9..184e0f7faf8 100644
--- a/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h
+++ b/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h
@@ -17,8 +17,8 @@ class FakeRequestContext : public IRequestContext
{
public:
FakeRequestContext(attribute::IAttributeContext * context = nullptr,
- vespalib::steady_time soft=vespalib::steady_time::max(),
- vespalib::steady_time hard=vespalib::steady_time::max());
+ fastos::SteadyTimeStamp soft=fastos::SteadyTimeStamp::FUTURE,
+ fastos::SteadyTimeStamp hard=fastos::SteadyTimeStamp::FUTURE);
~FakeRequestContext();
const vespalib::Doom & getDoom() const override { return _doom; }
const attribute::IAttributeVector *getAttribute(const vespalib::string &name) const override {
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.cpp b/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.cpp
index 4e1544ee5d7..8f8166a2806 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.cpp
+++ b/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.cpp
@@ -11,7 +11,7 @@ GetDocsumArgs::GetDocsumArgs()
_stackItems(0),
_stackDump(),
_location(),
- _timeout(30s),
+ _timeout(30 * fastos::TimeStamp::SEC),
_propertiesMap()
{ }
@@ -19,6 +19,18 @@ GetDocsumArgs::GetDocsumArgs()
GetDocsumArgs::~GetDocsumArgs() = default;
void
+GetDocsumArgs::setTimeout(const fastos::TimeStamp & timeout)
+{
+ _timeout = timeout;
+}
+
+fastos::TimeStamp
+GetDocsumArgs::getTimeout() const
+{
+ return _timeout;
+}
+
+void
GetDocsumArgs::initFromDocsumRequest(const search::engine::DocsumRequest &req)
{
_ranking = req.ranking;
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.h b/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.h
index c17f44baec9..ce5dc695f08 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.h
+++ b/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.h
@@ -14,14 +14,14 @@ public:
typedef engine::PropertiesMap PropsMap;
private:
- vespalib::string _ranking;
- vespalib::string _resultClassName;
- bool _dumpFeatures;
- uint32_t _stackItems;
- std::vector<char> _stackDump;
- vespalib::string _location;
- vespalib::duration _timeout;
- PropsMap _propertiesMap;
+ vespalib::string _ranking;
+ vespalib::string _resultClassName;
+ bool _dumpFeatures;
+ uint32_t _stackItems;
+ std::vector<char> _stackDump;
+ vespalib::string _location;
+ fastos::TimeStamp _timeout;
+ PropsMap _propertiesMap;
public:
GetDocsumArgs();
~GetDocsumArgs();
@@ -35,8 +35,8 @@ public:
_location = location;
}
- void setTimeout(vespalib::duration timeout) { _timeout = timeout; }
- vespalib::duration getTimeout() const { return _timeout; }
+ void setTimeout(const fastos::TimeStamp & timeout);
+ fastos::TimeStamp getTimeout() const;
const vespalib::string & getResultClassName() const { return _resultClassName; }
const vespalib::string & getLocation() const { return _location; }
diff --git a/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp b/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp
index db468044e48..a9e1499f014 100644
--- a/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp
+++ b/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp
@@ -111,7 +111,7 @@ Test::Main()
count = strtol(_argv[2], NULL, 0);
}
TEST_INIT("allocinarray_benchmark");
- steady_time start(steady_clock::now());
+ fastos::SteadyTimeStamp start(fastos::ClockSteady::now());
if (type == "direct") {
benchmarkTree(count);
} else {
diff --git a/staging_vespalib/src/tests/array/sort_benchmark.cpp b/staging_vespalib/src/tests/array/sort_benchmark.cpp
index 3fd900503c4..03a99aa044f 100644
--- a/staging_vespalib/src/tests/array/sort_benchmark.cpp
+++ b/staging_vespalib/src/tests/array/sort_benchmark.cpp
@@ -100,7 +100,7 @@ Test::Main()
payLoad = strtol(_argv[3], NULL, 0);
}
TEST_INIT("sort_benchmark");
- steady_time start(steady_clock::now());
+ fastos::SteadyTimeStamp start(fastos::ClockSteady::now());
if (payLoad < 8) {
typedef TT<8> T;
if (type == "sortdirect") {
diff --git a/staging_vespalib/src/tests/clock/clock_benchmark.cpp b/staging_vespalib/src/tests/clock/clock_benchmark.cpp
index cbf7275f06e..a9618d50682 100644
--- a/staging_vespalib/src/tests/clock/clock_benchmark.cpp
+++ b/staging_vespalib/src/tests/clock/clock_benchmark.cpp
@@ -10,10 +10,7 @@
#include <mutex>
using vespalib::Clock;
-using vespalib::steady_time;
-using vespalib::steady_clock;
-using vespalib::duration;
-using vespalib::to_s;
+using fastos::TimeStamp;
struct UpdateClock {
virtual ~UpdateClock() {}
@@ -92,12 +89,12 @@ struct Sampler : public SamplerBase {
{ }
void Run(FastOS_ThreadInterface *, void *) override {
uint64_t samples;
- steady_time prev = _func();
+ fastos::SteadyTimeStamp prev = _func();
for (samples = 0; (samples < _samples); samples++) {
- steady_time now = _func();
- duration diff = now - prev;
- if (diff > duration::zero()) prev = now;
- _count[1 + ((diff == duration::zero()) ? 0 : (diff > duration::zero()) ? 1 : -1)]++;
+ fastos::SteadyTimeStamp now = _func();
+ fastos::TimeStamp diff = now - prev;
+ if (diff > 0) prev = now;
+ _count[1 + ((diff == 0) ? 0 : (diff > 0) ? 1 : -1)]++;
}
}
@@ -108,7 +105,7 @@ template<typename Func>
void benchmark(const char * desc, FastOS_ThreadPool & pool, uint64_t samples, uint32_t numThreads, Func func) {
std::vector<std::unique_ptr<SamplerBase>> threads;
threads.reserve(numThreads);
- steady_time start = steady_clock::now();
+ fastos::SteadyTimeStamp start = fastos::ClockSteady::now();
for (uint32_t i(0); i < numThreads; i++) {
SamplerBase * sampler = new Sampler<Func>(func, i);
sampler->_samples = samples;
@@ -123,7 +120,7 @@ void benchmark(const char * desc, FastOS_ThreadPool & pool, uint64_t samples, ui
count[i] += sampler->_count[i];
}
}
- printf("%s: Took %ld clock samples in %2.3f with [%ld, %ld, %ld] counts\n", desc, samples, to_s(steady_clock::now() - start), count[0], count[1], count[2]);
+ printf("%s: Took %ld clock samples in %2.3f with [%ld, %ld, %ld] counts\n", desc, samples, (fastos::ClockSteady::now() - start).sec(), count[0], count[1], count[2]);
}
int
@@ -149,26 +146,26 @@ main(int , char *argv[])
return clock.getTimeNSAssumeRunning();
});
benchmark("uint64_t", pool, samples, numThreads, [&nsValue]() {
- return steady_time (duration(nsValue._value));
+ return fastos::SteadyTimeStamp(nsValue._value) ;
});
benchmark("volatile uint64_t", pool, samples, numThreads, [&nsVolatile]() {
- return steady_time(duration(nsVolatile._value));
+ return fastos::SteadyTimeStamp(nsVolatile._value) ;
});
benchmark("memory_order_relaxed", pool, samples, numThreads, [&nsAtomic]() {
- return steady_time(duration(nsAtomic._value.load(std::memory_order_relaxed)));
+ return fastos::SteadyTimeStamp(nsAtomic._value.load(std::memory_order_relaxed)) ;
});
benchmark("memory_order_consume", pool, samples, numThreads, [&nsAtomic]() {
- return steady_time(duration(nsAtomic._value.load(std::memory_order_consume)));
+ return fastos::SteadyTimeStamp(nsAtomic._value.load(std::memory_order_consume)) ;
});
benchmark("memory_order_acquire", pool, samples, numThreads, [&nsAtomic]() {
- return steady_time(duration(nsAtomic._value.load(std::memory_order_acquire)));
+ return fastos::SteadyTimeStamp(nsAtomic._value.load(std::memory_order_acquire)) ;
});
benchmark("memory_order_seq_cst", pool, samples, numThreads, [&nsAtomic]() {
- return steady_time(duration(nsAtomic._value.load(std::memory_order_seq_cst)));
+ return fastos::SteadyTimeStamp(nsAtomic._value.load(std::memory_order_seq_cst)) ;
});
- benchmark("vespalib::steady_time::now()", pool, samples, numThreads, []() {
- return steady_clock::now();
+ benchmark("fastos::ClockSteady::now()", pool, samples, numThreads, []() {
+ return fastos::ClockSteady::now();
});
pool.Close();
diff --git a/staging_vespalib/src/tests/clock/clock_test.cpp b/staging_vespalib/src/tests/clock/clock_test.cpp
index 4a06787fce5..b5650244a45 100644
--- a/staging_vespalib/src/tests/clock/clock_test.cpp
+++ b/staging_vespalib/src/tests/clock/clock_test.cpp
@@ -2,11 +2,11 @@
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/clock.h>
+#include <vespa/vespalib/util/time.h>
#include <vespa/fastos/thread.h>
using vespalib::Clock;
-using vespalib::duration;
-using vespalib::steady_time;
+using fastos::TimeStamp;
TEST("Test that clock is ticking forward") {
@@ -14,15 +14,15 @@ TEST("Test that clock is ticking forward") {
Clock clock(0.050);
FastOS_ThreadPool pool(0x10000);
ASSERT_TRUE(pool.NewThread(clock.getRunnable(), nullptr) != nullptr);
- steady_time start = clock.getTimeNS();
+ fastos::SteadyTimeStamp start = clock.getTimeNS();
std::this_thread::sleep_for(5s);
- steady_time stop = clock.getTimeNS();
+ fastos::SteadyTimeStamp stop = clock.getTimeNS();
EXPECT_TRUE(stop > start);
std::this_thread::sleep_for(6s);
clock.stop();
- steady_time stop2 = clock.getTimeNS();
+ fastos::SteadyTimeStamp stop2 = clock.getTimeNS();
EXPECT_TRUE(stop2 > stop);
- EXPECT_TRUE(vespalib::count_ms(stop2 - stop) > 1000);
+ EXPECT_TRUE((stop2 - stop)/TimeStamp::MICRO > 1000);
}
TEST_MAIN() { TEST_RUN_ALL(); } \ No newline at end of file
diff --git a/staging_vespalib/src/tests/rusage/rusage_test.cpp b/staging_vespalib/src/tests/rusage/rusage_test.cpp
index 0f2992e09e8..23b9d4072b1 100644
--- a/staging_vespalib/src/tests/rusage/rusage_test.cpp
+++ b/staging_vespalib/src/tests/rusage/rusage_test.cpp
@@ -5,7 +5,23 @@
using namespace vespalib;
-TEST("testRUsage")
+class Test : public TestApp
+{
+public:
+ int Main() override;
+ void testRUsage();
+};
+
+int
+Test::Main()
+{
+ TEST_INIT("rusage_test");
+ testRUsage();
+ TEST_DONE();
+}
+
+void
+Test::testRUsage()
{
RUsage r1;
EXPECT_EQUAL("", r1.toString());
@@ -14,12 +30,12 @@ TEST("testRUsage")
RUsage diff = r2-r1;
EXPECT_EQUAL(diff.toString(), r2.toString());
{
- RUsage then = RUsage::createSelf(steady_time(7ns));
+ RUsage then = RUsage::createSelf(fastos::SteadyTimeStamp(7));
RUsage now = RUsage::createSelf();
EXPECT_NOT_EQUAL(now.toString(), then.toString());
}
{
- RUsage then = RUsage::createChildren(steady_time(1337583ns));
+ RUsage then = RUsage::createChildren(fastos::SteadyTimeStamp(1337583));
RUsage now = RUsage::createChildren();
EXPECT_NOT_EQUAL(now.toString(), then.toString());
}
@@ -54,4 +70,4 @@ TEST("testRUsage")
}
}
-TEST_MAIN() { TEST_RUN_ALL(); }
+TEST_APPHOOK(Test)
diff --git a/staging_vespalib/src/vespa/vespalib/util/clock.cpp b/staging_vespalib/src/vespa/vespalib/util/clock.cpp
index 0a7f89781e8..cd2a13029ab 100644
--- a/staging_vespalib/src/vespa/vespalib/util/clock.cpp
+++ b/staging_vespalib/src/vespa/vespalib/util/clock.cpp
@@ -80,7 +80,7 @@ Clock::~Clock()
void Clock::setTime() const
{
- _timeNS.store(count_ns(steady_clock::now().time_since_epoch()), std::memory_order_relaxed);
+ _timeNS.store(fastos::ClockSteady::now() - fastos::SteadyTimeStamp::ZERO, std::memory_order_relaxed);
}
void
diff --git a/staging_vespalib/src/vespa/vespalib/util/clock.h b/staging_vespalib/src/vespa/vespalib/util/clock.h
index d506b0c7e16..e9e1ebace3f 100644
--- a/staging_vespalib/src/vespa/vespalib/util/clock.h
+++ b/staging_vespalib/src/vespa/vespalib/util/clock.h
@@ -1,7 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/vespalib/util/time.h>
+#include <vespa/fastos/timestamp.h>
#include <atomic>
#include <memory>
@@ -31,14 +31,14 @@ public:
Clock(double timePeriod=0.100);
~Clock();
- vespalib::steady_time getTimeNS() const {
+ fastos::SteadyTimeStamp getTimeNS() const {
if (!_running) {
setTime();
}
return getTimeNSAssumeRunning();
}
- vespalib::steady_time getTimeNSAssumeRunning() const {
- return vespalib::steady_time(std::chrono::nanoseconds(_timeNS.load(std::memory_order_relaxed)));
+ fastos::SteadyTimeStamp getTimeNSAssumeRunning() const {
+ return fastos::SteadyTimeStamp(_timeNS.load(std::memory_order_relaxed));
}
void stop();
diff --git a/staging_vespalib/src/vespa/vespalib/util/doom.cpp b/staging_vespalib/src/vespa/vespalib/util/doom.cpp
index 72b854338dc..87b24799721 100644
--- a/staging_vespalib/src/vespa/vespalib/util/doom.cpp
+++ b/staging_vespalib/src/vespa/vespalib/util/doom.cpp
@@ -4,8 +4,8 @@
namespace vespalib {
-Doom::Doom(const Clock &clock, steady_time softDoom,
- steady_time hardDoom, bool explicitSoftDoom)
+Doom::Doom(const vespalib::Clock &clock, fastos::SteadyTimeStamp softDoom,
+ fastos::SteadyTimeStamp hardDoom, bool explicitSoftDoom)
: _clock(clock),
_softDoom(softDoom),
_hardDoom(hardDoom),
diff --git a/staging_vespalib/src/vespa/vespalib/util/doom.h b/staging_vespalib/src/vespa/vespalib/util/doom.h
index a1280942ad7..d85c3dc9084 100644
--- a/staging_vespalib/src/vespa/vespalib/util/doom.h
+++ b/staging_vespalib/src/vespa/vespalib/util/doom.h
@@ -8,22 +8,22 @@ namespace vespalib {
class Doom {
public:
- Doom(const Clock &clock, steady_time doom)
+ Doom(const vespalib::Clock &clock, fastos::SteadyTimeStamp doom)
: Doom(clock, doom, doom, false)
{}
- Doom(const Clock &clock, steady_time softDoom,
- steady_time hardDoom, bool explicitSoftDoom);
+ Doom(const vespalib::Clock &clock, fastos::SteadyTimeStamp softDoom,
+ fastos::SteadyTimeStamp hardDoom, bool explicitSoftDoom);
bool soft_doom() const { return (_clock.getTimeNSAssumeRunning() > _softDoom); }
bool hard_doom() const { return (_clock.getTimeNSAssumeRunning() > _hardDoom); }
- duration soft_left() const { return _softDoom - _clock.getTimeNS(); }
- duration hard_left() const { return _hardDoom - _clock.getTimeNS(); }
+ fastos::TimeStamp soft_left() const { return _softDoom - _clock.getTimeNS(); }
+ fastos::TimeStamp hard_left() const { return _hardDoom - _clock.getTimeNS(); }
bool isExplicitSoftDoom() const { return _isExplicitSoftDoom; }
private:
- const Clock &_clock;
- steady_time _softDoom;
- steady_time _hardDoom;
- bool _isExplicitSoftDoom;
+ const vespalib::Clock &_clock;
+ fastos::SteadyTimeStamp _softDoom;
+ fastos::SteadyTimeStamp _hardDoom;
+ bool _isExplicitSoftDoom;
};
}
diff --git a/staging_vespalib/src/vespa/vespalib/util/rusage.cpp b/staging_vespalib/src/vespa/vespalib/util/rusage.cpp
index d5910148c79..32f76775586 100644
--- a/staging_vespalib/src/vespa/vespalib/util/rusage.cpp
+++ b/staging_vespalib/src/vespa/vespalib/util/rusage.cpp
@@ -33,20 +33,20 @@ RUsage::RUsage() :
RUsage
RUsage::createSelf()
{
- return createSelf(vespalib::steady_time());
+ return createSelf(fastos::SteadyTimeStamp());
}
RUsage
RUsage::createChildren()
{
- return createChildren(vespalib::steady_time());
+ return createChildren(fastos::SteadyTimeStamp());
}
RUsage
-RUsage::createSelf(vespalib::steady_time since)
+RUsage::createSelf(fastos::SteadyTimeStamp since)
{
RUsage r;
- r._time = vespalib::steady_clock::now() - since;
+ r._time = fastos::ClockSteady::now() - since;
if (getrusage(RUSAGE_SELF, &r) != 0) {
throw std::runtime_error(vespalib::make_string("getrusage failed with errno = %d", errno).c_str());
}
@@ -54,10 +54,10 @@ RUsage::createSelf(vespalib::steady_time since)
}
RUsage
-RUsage::createChildren(vespalib::steady_time since)
+RUsage::createChildren(fastos::SteadyTimeStamp since)
{
RUsage r;
- r._time = vespalib::steady_clock::now() - since;
+ r._time = fastos::ClockSteady::now() - since;
if (getrusage(RUSAGE_CHILDREN, &r) != 0) {
throw std::runtime_error(vespalib::make_string("getrusage failed with errno = %d", errno).c_str());
}
@@ -68,9 +68,9 @@ vespalib::string
RUsage::toString()
{
vespalib::string s;
- if (_time != duration::zero()) s += make_string("duration = %1.6f\n", vespalib::to_s(_time));
- if (from_timeval(ru_utime) > duration::zero()) s += make_string("user time = %1.6f\n", to_s(from_timeval(ru_utime)));
- if (from_timeval(ru_stime) > duration::zero()) s += make_string("system time = %1.6f\n", to_s(from_timeval(ru_stime)));
+ if (_time.sec() != 0.0) s += make_string("duration = %1.6f\n", _time.sec());
+ if (fastos::TimeStamp(ru_utime).sec() != 0.0) s += make_string("user time = %1.6f\n", fastos::TimeStamp(ru_utime).sec());
+ if (fastos::TimeStamp(ru_stime).sec() != 0.0) s += make_string("system time = %1.6f\n", fastos::TimeStamp(ru_stime).sec());
if (ru_maxrss != 0) s += make_string("ru_maxrss = %ld\n", ru_maxrss);
if (ru_ixrss != 0) s += make_string("ru_ixrss = %ld\n", ru_ixrss);
if (ru_idrss != 0) s += make_string("ru_idrss = %ld\n", ru_idrss);
diff --git a/staging_vespalib/src/vespa/vespalib/util/rusage.h b/staging_vespalib/src/vespa/vespalib/util/rusage.h
index f2cea3ba0ab..381d4d764e7 100644
--- a/staging_vespalib/src/vespa/vespalib/util/rusage.h
+++ b/staging_vespalib/src/vespa/vespalib/util/rusage.h
@@ -2,7 +2,7 @@
#pragma once
#include <vespa/vespalib/stllike/string.h>
-#include <vespa/vespalib/util/time.h>
+#include <vespa/fastos/timestamp.h>
#include <sys/resource.h>
namespace vespalib {
@@ -17,19 +17,19 @@ public:
* Will create an RUsage and initialize member with RUSAGE_SELF
**/
static RUsage createSelf();
- static RUsage createSelf(vespalib::steady_time since);
+ static RUsage createSelf(fastos::SteadyTimeStamp since);
/**
* Will create an RUsage and initialize member with RUSAGE_CHILDREN
**/
static RUsage createChildren();
- static RUsage createChildren(vespalib::steady_time since);
+ static RUsage createChildren(fastos::SteadyTimeStamp since);
/**
* Will create an RUsage and initialize member with RUSAGE_CHILDREN
**/
vespalib::string toString();
RUsage & operator -= (const RUsage & rhs);
private:
- vespalib::duration _time;
+ fastos::TimeStamp _time;
};
RUsage operator -(const RUsage & a, const RUsage & b);
diff --git a/vespalib/src/tests/time/time_test.cpp b/vespalib/src/tests/time/time_test.cpp
index 40542b6ca62..667511f6a94 100644
--- a/vespalib/src/tests/time/time_test.cpp
+++ b/vespalib/src/tests/time/time_test.cpp
@@ -29,16 +29,6 @@ TEST(TimeTest, double_conversion_works_as_expected) {
EXPECT_EQ(10ms, from_s(0.010));
}
-TEST(TimeTest, timeval_conversion_works_as_expected) {
- timeval tv1;
- tv1.tv_sec = 7;
- tv1.tv_usec = 342356;
- EXPECT_EQ(from_timeval(tv1), 7342356us);
- tv1.tv_sec = 7;
- tv1.tv_usec = 1342356;
- EXPECT_EQ(from_timeval(tv1), 8342356us);
-}
-
TEST(TimeTest, unit_counting_works_as_expected) {
auto d = 3ms + 5us + 7ns;
EXPECT_EQ(count_ns(d), 3005007);
diff --git a/vespalib/src/vespa/vespalib/testkit/test_comparators.cpp b/vespalib/src/vespa/vespalib/testkit/test_comparators.cpp
index b30b3aaa421..d00ad8d954c 100644
--- a/vespalib/src/vespa/vespalib/testkit/test_comparators.cpp
+++ b/vespalib/src/vespa/vespalib/testkit/test_comparators.cpp
@@ -8,11 +8,7 @@ ostream & operator << (ostream & os, system_clock::time_point ts) {
return os << ts.time_since_epoch() << "ns";
}
-ostream & operator << (ostream & os, steady_clock::time_point ts) {
- return os << ts.time_since_epoch() << "ns";
-}
-
}
namespace vespalib {
-} \ No newline at end of file
+} // namespace vespalib
diff --git a/vespalib/src/vespa/vespalib/testkit/test_comparators.h b/vespalib/src/vespa/vespalib/testkit/test_comparators.h
index 164e486cf4a..161c125757b 100644
--- a/vespalib/src/vespa/vespalib/testkit/test_comparators.h
+++ b/vespalib/src/vespa/vespalib/testkit/test_comparators.h
@@ -14,7 +14,7 @@ ostream & operator << (ostream & os, duration<rep, period> ts) {
}
ostream & operator << (ostream & os, system_clock::time_point ts);
-ostream & operator << (ostream & os, steady_clock::time_point ts);
+
}
diff --git a/vespalib/src/vespa/vespalib/util/time.cpp b/vespalib/src/vespa/vespalib/util/time.cpp
index fdd13849287..d38e40a6d6a 100644
--- a/vespalib/src/vespa/vespalib/util/time.cpp
+++ b/vespalib/src/vespa/vespalib/util/time.cpp
@@ -4,13 +4,6 @@
namespace vespalib {
-system_time
-to_utc(steady_time ts) {
- system_clock::time_point nowUtc = system_clock::now();
- steady_time nowSteady = steady_clock::now();
- return system_time(nowUtc.time_since_epoch() - nowSteady.time_since_epoch() + ts.time_since_epoch());
-}
-
Timer::~Timer() = default;
}
diff --git a/vespalib/src/vespa/vespalib/util/time.h b/vespalib/src/vespa/vespalib/util/time.h
index 3111239ffab..2f8ae0ae016 100644
--- a/vespalib/src/vespa/vespalib/util/time.h
+++ b/vespalib/src/vespa/vespalib/util/time.h
@@ -39,8 +39,6 @@ constexpr double to_s(duration d) {
return std::chrono::duration_cast<std::chrono::duration<double>>(d).count();
}
-system_time to_utc(steady_time ts);
-
constexpr duration from_s(double seconds) {
return std::chrono::duration_cast<duration>(std::chrono::duration<double>(seconds));
}
@@ -57,10 +55,6 @@ constexpr int64_t count_ns(duration d) {
return std::chrono::duration_cast<std::chrono::nanoseconds>(d).count();
}
-constexpr duration from_timeval(const timeval & tv) {
- return duration(tv.tv_sec*1000000000L + tv.tv_usec*1000L);
-}
-
/**
* Simple utility class used to measure how much time has elapsed
* since it was constructed.