summaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/matching
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 /searchcore/src/tests/proton/matching
parent2f8e6f0cb74ef77a645e7543975aca736f7649a9 (diff)
Revert "Balder/remove steadytimestamp 2"
Diffstat (limited to 'searchcore/src/tests/proton/matching')
-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
5 files changed, 35 insertions, 34 deletions
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()));