summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/src/tests/configfetcher/configfetcher.cpp6
-rw-r--r--config/src/tests/configholder/configholder.cpp22
-rw-r--r--config/src/tests/configretriever/configretriever.cpp10
-rw-r--r--config/src/tests/file_subscription/file_subscription.cpp6
-rw-r--r--config/src/tests/frt/frt.cpp10
-rw-r--r--config/src/tests/subscriber/subscriber.cpp20
-rw-r--r--config/src/tests/subscription/subscription.cpp12
-rw-r--r--messagebus_test/src/tests/speed/cpp-client.cpp6
-rw-r--r--searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp22
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/docsummary/summarymanagerinitializer.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matcher.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.h6
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/fusionrunner.cpp4
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp8
-rw-r--r--searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp21
-rw-r--r--searchlib/src/tests/fef/phrasesplitter/benchmark.cpp16
-rw-r--r--searchlib/src/tests/grouping/grouping_test.cpp6
-rw-r--r--searchlib/src/tests/postinglistbm/stress_runner.cpp10
-rw-r--r--searchlib/src/tests/transactionlogstress/translogstress.cpp43
-rw-r--r--searchlib/src/vespa/searchlib/test/fakedata/fakewordset.cpp6
-rw-r--r--searchsummary/src/tests/extractkeywords/extractkeywordstest.cpp6
-rw-r--r--vespalib/src/tests/btree/iteratespeed.cpp6
-rw-r--r--vespalib/src/tests/executor/stress_test.cpp22
-rw-r--r--vespalib/src/tests/simple_thread_bundle/threading_speed_test.cpp4
-rw-r--r--vespalib/src/tests/slime/summary-feature-benchmark/summary-feature-benchmark.cpp8
29 files changed, 148 insertions, 156 deletions
diff --git a/config/src/tests/configfetcher/configfetcher.cpp b/config/src/tests/configfetcher/configfetcher.cpp
index be25e913980..24b943ec626 100644
--- a/config/src/tests/configfetcher/configfetcher.cpp
+++ b/config/src/tests/configfetcher/configfetcher.cpp
@@ -145,12 +145,12 @@ TEST_F("verify that config generation can be obtained from config fetcher", Conf
f1.builder.myField = "bar";
cb._configured = false;
f1.context->reload();
- fastos::StopWatch timer;
- while (timer.elapsed().ms() < 120000) {
+ vespalib::Timer timer;
+ while (timer.elapsed() < 120s) {
if (cb._configured) {
break;
}
- std::this_thread::sleep_for(std::chrono::milliseconds(10));;
+ std::this_thread::sleep_for(10ms);;
}
EXPECT_EQUAL(2, fetcher.getGeneration());
EXPECT_EQUAL("bar", cb._config.get()->myField);
diff --git a/config/src/tests/configholder/configholder.cpp b/config/src/tests/configholder/configholder.cpp
index ce7e4f0531d..d69ad8022f9 100644
--- a/config/src/tests/configholder/configholder.cpp
+++ b/config/src/tests/configholder/configholder.cpp
@@ -1,15 +1,13 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/config/common/configholder.h>
-#include <vespa/fastos/timestamp.h>
using namespace config;
-using namespace std::chrono_literals;
namespace {
-constexpr long ONE_SEC = 1000;
-constexpr long ONE_MINUTE = 60 * ONE_SEC;
+constexpr vespalib::duration ONE_SEC = 1s;
+constexpr vespalib::duration ONE_MINUTE = 60s;
}
@@ -34,10 +32,10 @@ TEST("Require that waiting is done")
ConfigValue value;
ConfigHolder holder;
- fastos::StopWatch timer;
+ vespalib::Timer timer;
holder.wait(1000ms);
- EXPECT_GREATER_EQUAL(timer.elapsed().ms(), ONE_SEC);
- EXPECT_LESS(timer.elapsed().ms(), ONE_MINUTE);
+ EXPECT_GREATER_EQUAL(timer.elapsed(), ONE_SEC);
+ EXPECT_LESS(timer.elapsed(), ONE_MINUTE);
holder.handle(std::make_unique<ConfigUpdate>(value, true, 0));
ASSERT_TRUE(holder.wait(100ms));
@@ -57,23 +55,23 @@ TEST("Require that polling for elements work")
TEST("Require that negative time does not mean forever.") {
ConfigHolder holder;
- fastos::StopWatch timer;
+ vespalib::Timer timer;
ASSERT_FALSE(holder.poll());
ASSERT_FALSE(holder.wait(10ms));
ASSERT_FALSE(holder.wait(0ms));
ASSERT_FALSE(holder.wait(-1ms));
ASSERT_FALSE(holder.wait(-7ms));
- EXPECT_LESS(timer.elapsed().ms(), ONE_MINUTE);
+ EXPECT_LESS(timer.elapsed(), ONE_MINUTE);
}
TEST_MT_F("Require that wait is interrupted", 2, ConfigHolder)
{
if (thread_id == 0) {
- fastos::StopWatch timer;
+ vespalib::Timer timer;
TEST_BARRIER();
f.wait(1000ms);
- EXPECT_LESS(timer.elapsed().ms(), ONE_MINUTE);
- EXPECT_GREATER(timer.elapsed().ms(), 400.0);
+ EXPECT_LESS(timer.elapsed(), ONE_MINUTE);
+ EXPECT_GREATER(timer.elapsed(), 400ms);
TEST_BARRIER();
} else {
TEST_BARRIER();
diff --git a/config/src/tests/configretriever/configretriever.cpp b/config/src/tests/configretriever/configretriever.cpp
index 87f189ad7d3..756ee815d56 100644
--- a/config/src/tests/configretriever/configretriever.cpp
+++ b/config/src/tests/configretriever/configretriever.cpp
@@ -245,9 +245,9 @@ public:
snap = snapshot;
configured = true;
}
- bool waitUntilConfigured(int64_t timeoutInMillis) {
- fastos::StopWatch timer;
- while (timer.elapsed().ms() < timeoutInMillis) {
+ bool waitUntilConfigured(vespalib::duration timeout) {
+ vespalib::Timer timer;
+ while (timer.elapsed() < timeout) {
if (configured) {
return true;
}
@@ -296,7 +296,7 @@ TEST_F("require that SimpleConfigurer usage works", ConfigurableFixture()) {
f1.configured = false;
fooBuilder.fooValue = "bimz";
ctx->reload();
- ASSERT_TRUE(f1.waitUntilConfigured(60000));
+ ASSERT_TRUE(f1.waitUntilConfigured(60s));
snap = f1.snap;
foo = snap.getConfig<FooConfig>("id");
ASSERT_EQUAL("bimz", foo->fooValue);
@@ -304,7 +304,7 @@ TEST_F("require that SimpleConfigurer usage works", ConfigurableFixture()) {
fooBuilder.fooValue = "bamz";
f1.configured = false;
ctx->reload();
- ASSERT_FALSE(f1.waitUntilConfigured(2000));
+ ASSERT_FALSE(f1.waitUntilConfigured(2s));
SimpleConfigurer configurer2(SimpleConfigRetriever::UP(new SimpleConfigRetriever(sub, ctx)), &f1);
f1.throwException = true;
diff --git a/config/src/tests/file_subscription/file_subscription.cpp b/config/src/tests/file_subscription/file_subscription.cpp
index 9c40e2ffd77..ceaf16c9191 100644
--- a/config/src/tests/file_subscription/file_subscription.cpp
+++ b/config/src/tests/file_subscription/file_subscription.cpp
@@ -12,8 +12,6 @@
#include <config-bar.h>
#include <config-foobar.h>
#include <vespa/log/log.h>
-#include <vespa/fastos/timestamp.h>
-
LOG_SETUP(".filesubscription_test");
using namespace config;
@@ -103,8 +101,8 @@ TEST("requireThatReconfigIsCalledWhenConfigChanges") {
writeFile("my.cfg", "bar");
context->reload();
bool correctValue = false;
- fastos::StopWatch timer;
- while (!correctValue && timer.elapsed().ms() < 20000.0) {
+ vespalib::Timer timer;
+ while (!correctValue && timer.elapsed() < 20s) {
LOG(info, "Testing value...");
if (s.nextConfig(1000ms)) {
break;
diff --git a/config/src/tests/frt/frt.cpp b/config/src/tests/frt/frt.cpp
index 28dea82bfe7..1925b87d600 100644
--- a/config/src/tests/frt/frt.cpp
+++ b/config/src/tests/frt/frt.cpp
@@ -43,10 +43,10 @@ namespace {
bool poll() override { return notified; }
void interrupt() override { }
- bool waitUntilResponse(int timeoutInMillis)
+ bool waitUntilResponse(vespalib::duration timeout)
{
- fastos::StopWatch timer;
- while (timer.elapsed().ms() < timeoutInMillis) {
+ vespalib::Timer timer;
+ while (timer.elapsed() < timeout) {
if (notified)
break;
std::this_thread::sleep_for(100ms);
@@ -255,8 +255,8 @@ TEST_FF("require that request is config task is scheduled", SourceFixture(), FRT
f2.src.getConfig();
ASSERT_TRUE(f2.result.notified);
f2.result.notified = false;
- fastos::StopWatch timer;
- while (timer.elapsed().ms() < 10000) {
+ vespalib::Timer timer;
+ while (timer.elapsed() < 10s) {
f1.conn.scheduler.CheckTasks();
if (f2.result.notified)
break;
diff --git a/config/src/tests/subscriber/subscriber.cpp b/config/src/tests/subscriber/subscriber.cpp
index 0c14928521e..0fbf0d4bee8 100644
--- a/config/src/tests/subscriber/subscriber.cpp
+++ b/config/src/tests/subscriber/subscriber.cpp
@@ -274,10 +274,10 @@ TEST_FFF("requireThatCorrectConfigIsReturnedAfterTimestampUpdate", MyManager, AP
TEST_MT_FFF("requireThatConfigIsReturnedWhenUpdatedDuringNextConfig", 2, MyManager, APIFixture(f1), StandardFixture(f1, f2)) {
if (thread_id == 0) {
- fastos::StopWatch timer;
+ vespalib::Timer timer;
ASSERT_TRUE(f3.s.nextConfig(10000ms));
- ASSERT_TRUE(timer.elapsed().ms() > 250);
- ASSERT_TRUE(timer.elapsed().ms() <= 5000);
+ ASSERT_TRUE(timer.elapsed() > 250ms);
+ ASSERT_TRUE(timer.elapsed() <= 5s);
verifyConfig("foo2", f3.h1->getConfig());
verifyConfig("bar", f3.h2->getConfig());
} else {
@@ -289,14 +289,14 @@ TEST_MT_FFF("requireThatConfigIsReturnedWhenUpdatedDuringNextConfig", 2, MyManag
}
TEST_FFF("requireThatConfigIsReturnedWhenUpdatedBeforeNextConfig", MyManager, APIFixture(f1), StandardFixture(f1, f2)) {
- fastos::StopWatch timer;
+ vespalib::Timer timer;
ASSERT_FALSE(f3.s.nextConfig(1000ms));
- ASSERT_TRUE(timer.elapsed().ms() > 850);
+ ASSERT_TRUE(timer.elapsed() > 850ms);
f1.updateGeneration(0, 2);
f1.updateGeneration(1, 2);
- timer.restart();
+ timer = vespalib::Timer();
ASSERT_TRUE(f3.s.nextGeneration(10000ms));
- ASSERT_TRUE(timer.elapsed().ms() <= 5000);
+ ASSERT_TRUE(timer.elapsed() <= 5s);
verifyConfig("foo", f3.h1->getConfig());
verifyConfig("bar", f3.h2->getConfig());
}
@@ -324,10 +324,10 @@ TEST_FFF("requireThatNothingCanBeCalledAfterClose", MyManager, APIFixture(f1), S
TEST_MT_FFF("requireThatNextConfigIsInterruptedOnClose", 2, MyManager, APIFixture(f1), StandardFixture(f1, f2)) {
if (thread_id == 0) {
- fastos::StopWatch timer;
+ vespalib::Timer timer;
ASSERT_FALSE(f3.s.nextConfig(5000ms));
- ASSERT_TRUE(timer.elapsed().ms() >= 500.0);
- ASSERT_TRUE(timer.elapsed().ms() < 60000.0);
+ ASSERT_TRUE(timer.elapsed() >= 500ms);
+ ASSERT_TRUE(timer.elapsed() < 60s);
} else {
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
f3.s.close();
diff --git a/config/src/tests/subscription/subscription.cpp b/config/src/tests/subscription/subscription.cpp
index 5b8fc22bf4e..90dc678ecb7 100644
--- a/config/src/tests/subscription/subscription.cpp
+++ b/config/src/tests/subscription/subscription.cpp
@@ -66,18 +66,18 @@ TEST_F("requireThatNextUpdateBlocks", SubscriptionFixture(ConfigKey::create<MyCo
{
ASSERT_FALSE(f1.sub.nextUpdate(0, 0ms));
f1.holder->handle(std::make_unique<ConfigUpdate>(ConfigValue(), 1, 1));
- fastos::StopWatch timer;
+ vespalib::Timer timer;
ASSERT_FALSE(f1.sub.nextUpdate(1, 500ms));
- ASSERT_TRUE(timer.elapsed().ms() > 400.0);
+ ASSERT_TRUE(timer.elapsed() > 400ms);
}
TEST_MT_F("requireThatNextUpdateReturnsWhenNotified", 2, SubscriptionFixture(ConfigKey::create<MyConfig>("myid")))
{
if (thread_id == 0) {
- fastos::StopWatch timer;
+ vespalib::Timer timer;
f1.holder->handle(std::make_unique<ConfigUpdate>(ConfigValue(), 1, 1));
ASSERT_TRUE(f1.sub.nextUpdate(2, 5000ms));
- ASSERT_TRUE(timer.elapsed().ms() > 200.0);
+ ASSERT_TRUE(timer.elapsed() > 200ms);
} else {
std::this_thread::sleep_for(std::chrono::milliseconds(500));
f1.holder->handle(std::make_unique<ConfigUpdate>(ConfigValue(), 1, 1));
@@ -88,10 +88,10 @@ TEST_MT_F("requireThatNextUpdateReturnsWhenNotified", 2, SubscriptionFixture(Con
TEST_MT_F("requireThatNextUpdateReturnsInterrupted", 2, SubscriptionFixture(ConfigKey::create<MyConfig>("myid")))
{
if (thread_id == 0) {
- fastos::StopWatch timer;
+ vespalib::Timer timer;
f1.holder->handle(std::make_unique<ConfigUpdate>(ConfigValue(), 1, 1));
ASSERT_TRUE(f1.sub.nextUpdate(1, 5000ms));
- ASSERT_TRUE(timer.elapsed().ms() > 300.0);
+ ASSERT_TRUE(timer.elapsed() > 300ms);
} else {
std::this_thread::sleep_for(std::chrono::milliseconds(500));
f1.sub.close();
diff --git a/messagebus_test/src/tests/speed/cpp-client.cpp b/messagebus_test/src/tests/speed/cpp-client.cpp
index ff00128037a..db0dd4b23ae 100644
--- a/messagebus_test/src/tests/speed/cpp-client.cpp
+++ b/messagebus_test/src/tests/speed/cpp-client.cpp
@@ -112,7 +112,7 @@ App::Main()
// let the system 'warm up'
std::this_thread::sleep_for(5s);
- fastos::StopWatch stopWatch;
+ vespalib::Timer timer;
uint32_t okBefore = 0;
uint32_t okAfter = 0;
uint32_t failBefore = 0;
@@ -120,9 +120,9 @@ App::Main()
client.sample(okBefore, failBefore);
std::this_thread::sleep_for(10s); // Benchmark time
- fastos::TimeStamp elapsed = stopWatch.elapsed();
+ vespalib::duration elapsed = timer.elapsed();
client.sample(okAfter, failAfter);
- double time = elapsed.ms();
+ double time = vespalib::count_ms(elapsed);
double msgCnt = (double)(okAfter - okBefore);
double throughput = (msgCnt / time) * 1000.0;
fprintf(stdout, "CPP-CLIENT: %g msg/s\n", throughput);
diff --git a/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp b/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp
index ec31e980a2e..6301b8a343c 100644
--- a/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp
+++ b/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp
@@ -170,9 +170,9 @@ struct ProtonConfigOwner : public proton::IProtonConfigurer
VarHolder<std::shared_ptr<ProtonConfigSnapshot>> _config;
ProtonConfigOwner() : _configured(false), _config() { }
- bool waitUntilConfigured(int64_t timeout) {
- fastos::StopWatch timer;
- while (timer.elapsed().ms() < timeout) {
+ bool waitUntilConfigured(vespalib::duration timeout) {
+ vespalib::Timer timer;
+ while (timer.elapsed() < timeout) {
if (getConfigured())
return true;
std::this_thread::sleep_for(100ms);
@@ -290,14 +290,14 @@ TEST_FF("require that documentdb config manager builds schema with imported attr
TEST_FFF("require that proton config fetcher follows changes to bootstrap",
ConfigTestFixture("search"),
ProtonConfigOwner(),
- ProtonConfigFetcher(ConfigUri(f1.configId, f1.context), f2, 60000ms)) {
+ ProtonConfigFetcher(ConfigUri(f1.configId, f1.context), f2, 60s)) {
f3.start();
ASSERT_TRUE(f2._configured);
ASSERT_TRUE(f1.configEqual(f2.getBootstrapConfig()));
f2._configured = false;
f1.protonBuilder.rpcport = 9010;
f1.reload();
- ASSERT_TRUE(f2.waitUntilConfigured(120000));
+ ASSERT_TRUE(f2.waitUntilConfigured(120s));
ASSERT_TRUE(f1.configEqual(f2.getBootstrapConfig()));
f3.close();
}
@@ -305,19 +305,19 @@ TEST_FFF("require that proton config fetcher follows changes to bootstrap",
TEST_FFF("require that proton config fetcher follows changes to doctypes",
ConfigTestFixture("search"),
ProtonConfigOwner(),
- ProtonConfigFetcher(ConfigUri(f1.configId, f1.context), f2, 60000ms)) {
+ ProtonConfigFetcher(ConfigUri(f1.configId, f1.context), f2, 60s)) {
f3.start();
f2._configured = false;
f1.addDocType("typea");
f1.reload();
- ASSERT_TRUE(f2.waitUntilConfigured(60000));
+ ASSERT_TRUE(f2.waitUntilConfigured(60s));
ASSERT_TRUE(f1.configEqual(f2.getBootstrapConfig()));
f2._configured = false;
f1.removeDocType("typea");
f1.reload();
- ASSERT_TRUE(f2.waitUntilConfigured(60000));
+ ASSERT_TRUE(f2.waitUntilConfigured(60s));
ASSERT_TRUE(f1.configEqual(f2.getBootstrapConfig()));
f3.close();
}
@@ -325,7 +325,7 @@ TEST_FFF("require that proton config fetcher follows changes to doctypes",
TEST_FFF("require that proton config fetcher reconfigures dbowners",
ConfigTestFixture("search"),
ProtonConfigOwner(),
- ProtonConfigFetcher(ConfigUri(f1.configId, f1.context), f2, 60000ms)) {
+ ProtonConfigFetcher(ConfigUri(f1.configId, f1.context), f2, 60s)) {
f3.start();
ASSERT_FALSE(f2.getDocumentDBConfig("typea"));
@@ -333,7 +333,7 @@ TEST_FFF("require that proton config fetcher reconfigures dbowners",
f2._configured = false;
f1.addDocType("typea");
f1.reload();
- ASSERT_TRUE(f2.waitUntilConfigured(60000));
+ ASSERT_TRUE(f2.waitUntilConfigured(60s));
ASSERT_TRUE(f1.configEqual(f2.getBootstrapConfig()));
ASSERT_TRUE(static_cast<bool>(f2.getDocumentDBConfig("typea")));
ASSERT_TRUE(f1.configEqual("typea", f2.getDocumentDBConfig("typea")));
@@ -342,7 +342,7 @@ TEST_FFF("require that proton config fetcher reconfigures dbowners",
f2._configured = false;
f1.removeDocType("typea");
f1.reload();
- ASSERT_TRUE(f2.waitUntilConfigured(60000));
+ ASSERT_TRUE(f2.waitUntilConfigured(60s));
ASSERT_FALSE(f2.getDocumentDBConfig("typea"));
f3.close();
}
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp
index bb41004d834..0ccebd34a39 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp
@@ -175,7 +175,7 @@ AttributeInitializer::loadAttribute(const AttributeVectorSP &attr,
search::SerialNum serialNum) const
{
assert(attr->hasLoadData());
- fastos::StopWatch stopWatch;
+ vespalib::Timer timer;
EventLogger::loadAttributeStart(_documentSubDbName, attr->getName());
if (!attr->load()) {
LOG(warning, "Could not load attribute vector '%s' from disk. Returning empty attribute vector",
@@ -183,7 +183,7 @@ AttributeInitializer::loadAttribute(const AttributeVectorSP &attr,
return false;
} else {
attr->commit(serialNum, serialNum);
- EventLogger::loadAttributeComplete(_documentSubDbName, attr->getName(), stopWatch.elapsed().ms());
+ EventLogger::loadAttributeComplete(_documentSubDbName, attr->getName(), vespalib::count_ms(timer.elapsed()));
}
return true;
}
diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanagerinitializer.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanagerinitializer.cpp
index 1915d9107cc..415d13314a2 100644
--- a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanagerinitializer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanagerinitializer.cpp
@@ -38,12 +38,12 @@ void
SummaryManagerInitializer::run()
{
vespalib::mkdir(_baseDir, false);
- fastos::StopWatch stopWatch;
+ vespalib::Timer timer;
EventLogger::loadDocumentStoreStart(_subDbName);
*_result = std::make_shared<SummaryManager>
(_summaryExecutor, _storeCfg, _grow, _baseDir, _docTypeName,
_tuneFile, _fileHeaderContext, _tlSyncer, _bucketizer);
- EventLogger::loadDocumentStoreComplete(_subDbName, stopWatch.elapsed().ms());
+ EventLogger::loadDocumentStoreComplete(_subDbName, vespalib::count_ms(timer.elapsed()));
}
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
index 0be67a424ee..2ec3488fe3c 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
@@ -185,7 +185,7 @@ Matcher::match(const SearchRequest &request, vespalib::ThreadBundle &threadBundl
ISearchContext &searchContext, IAttributeContext &attrContext, SessionManager &sessionMgr,
const search::IDocumentMetaStore &metaStore, SearchSession::OwnershipBundle &&owned_objects)
{
- fastos::StopWatch total_matching_time;
+ vespalib::Timer total_matching_time;
MatchingStats my_stats;
SearchReply::UP reply = std::make_unique<SearchReply>();
size_t covered = 0;
@@ -286,7 +286,7 @@ Matcher::match(const SearchRequest &request, vespalib::ThreadBundle &threadBundl
numThreadsPerSearch, _rankSetup->getNumThreadsPerSearch(), estHits, reply->totalHitCount,
request.ranking.c_str());
}
- my_stats.queryCollateralTime(total_matching_time.elapsed().sec() - my_stats.queryLatencyAvg());
+ my_stats.queryCollateralTime(vespalib::to_s(total_matching_time.elapsed()) - my_stats.queryLatencyAvg());
{
vespalib::duration duration = request.getTimeUsed();
std::lock_guard<std::mutex> guard(_statsLock);
diff --git a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.cpp
index 271393ea3c8..3ad98cba3ac 100644
--- a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.cpp
@@ -18,9 +18,9 @@ namespace proton {
void
TransactionLogManager::doLogReplayComplete(const vespalib::string &domainName,
- std::chrono::milliseconds elapsedTime) const
+ vespalib::duration elapsedTime) const
{
- EventLogger::transactionLogReplayComplete(domainName, elapsedTime.count());
+ EventLogger::transactionLogReplayComplete(domainName, vespalib::count_ms(elapsedTime));
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.h b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.h
index 82c4f9f7449..15666c38483 100644
--- a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.h
+++ b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.h
@@ -18,7 +18,7 @@ class TransactionLogManager : public TransactionLogManagerBase
{
TransLogClient::Visitor::UP _visitor;
- void doLogReplayComplete(const vespalib::string &domainName, std::chrono::milliseconds elapsedTime) const override;
+ void doLogReplayComplete(const vespalib::string &domainName, vespalib::duration elapsedTime) const override;
public:
/**
@@ -28,7 +28,7 @@ public:
* @param domainName the name of the domain this manager should handle.
**/
TransactionLogManager(const vespalib::string &tlsSpec, const vespalib::string &domainName);
- ~TransactionLogManager();
+ ~TransactionLogManager() override;
/**
* Init the transaction log.
diff --git a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.cpp b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.cpp
index 985e042c97b..8b18a7ae566 100644
--- a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.cpp
@@ -69,7 +69,7 @@ TransactionLogManagerBase::internalStartReplay()
std::lock_guard<std::mutex> guard(_replayLock);
_replayStarted = true;
_replayDone = false;
- _replayStopWatch.restart();
+ _replayStopWatch = vespalib::Timer();
}
void TransactionLogManagerBase::changeReplayDone()
@@ -117,7 +117,7 @@ bool TransactionLogManagerBase::isDoingReplay() const {
}
void TransactionLogManagerBase::logReplayComplete() const {
- doLogReplayComplete(_domainName, std::chrono::milliseconds(_replayStopWatch.elapsed().ms()));
+ doLogReplayComplete(_domainName, _replayStopWatch.elapsed());
}
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.h b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.h
index 8c4bc2bbfa3..4b5d001a28e 100644
--- a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.h
+++ b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanagerbase.h
@@ -3,9 +3,9 @@
#pragma once
#include <vespa/searchlib/transactionlog/translogclient.h>
+#include <vespa/vespalib/util/time.h>
#include <mutex>
#include <condition_variable>
-#include <vespa/fastos/timestamp.h>
namespace proton {
@@ -23,7 +23,7 @@ private:
mutable std::condition_variable _replayCond;
volatile bool _replayDone;
bool _replayStarted;
- fastos::StopWatch _replayStopWatch;
+ vespalib::Timer _replayStopWatch;
protected:
typedef search::SerialNum SerialNum;
@@ -38,7 +38,7 @@ protected:
StatusResult init();
void internalStartReplay();
- virtual void doLogReplayComplete(const vespalib::string &domainName, std::chrono::milliseconds elapsedTime) const = 0;
+ virtual void doLogReplayComplete(const vespalib::string &domainName, vespalib::duration elapsedTime) const = 0;
public:
TransactionLogManagerBase(const TransactionLogManagerBase &) = delete;
diff --git a/searchcorespi/src/vespa/searchcorespi/index/fusionrunner.cpp b/searchcorespi/src/vespa/searchcorespi/index/fusionrunner.cpp
index ca709362152..841b24af576 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/fusionrunner.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/fusionrunner.cpp
@@ -107,7 +107,7 @@ FusionRunner::fuse(const FusionSpec &fusion_spec,
if (LOG_WOULD_LOG(event)) {
EventLogger::diskFusionStart(sources, fusion_dir);
}
- fastos::StopWatch stopWatch;
+ vespalib::Timer timer;
const string selector_name = IndexDiskLayout::getSelectorFileName(_diskLayout.getFlushDir(fusion_id));
SelectorArray selector_array;
@@ -124,7 +124,7 @@ FusionRunner::fuse(const FusionSpec &fusion_spec,
}
if (LOG_WOULD_LOG(event)) {
- EventLogger::diskFusionComplete(fusion_dir, stopWatch.elapsed().ms());
+ EventLogger::diskFusionComplete(fusion_dir, vespalib::count_ms(timer.elapsed()));
}
return fusion_id;
}
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
index fc05a5bbc4c..32dc2531061 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
@@ -277,13 +277,13 @@ IndexMaintainer::loadDiskIndex(const string &indexDir)
if (LOG_WOULD_LOG(event)) {
EventLogger::diskIndexLoadStart(indexDir);
}
- fastos::StopWatch stopWatch;
+ vespalib::Timer timer;
_active_indexes->setActive(indexDir);
IDiskIndex::SP retval(new DiskIndexWithDestructorClosure
(_operations.loadDiskIndex(indexDir),
makeClosure(this, &IndexMaintainer::deactivateDiskIndexes, indexDir)));
if (LOG_WOULD_LOG(event)) {
- EventLogger::diskIndexLoadComplete(indexDir, stopWatch.elapsed().ms());
+ EventLogger::diskIndexLoadComplete(indexDir, vespalib::count_ms(timer.elapsed()));
}
return retval;
}
@@ -296,7 +296,7 @@ IndexMaintainer::reloadDiskIndex(const IDiskIndex &oldIndex)
if (LOG_WOULD_LOG(event)) {
EventLogger::diskIndexLoadStart(indexDir);
}
- fastos::StopWatch stopWatch;
+ vespalib::Timer timer;
_active_indexes->setActive(indexDir);
const IDiskIndex &wrappedDiskIndex =
(dynamic_cast<const DiskIndexWithDestructorClosure &>(oldIndex)).getWrapped();
@@ -304,7 +304,7 @@ IndexMaintainer::reloadDiskIndex(const IDiskIndex &oldIndex)
(_operations.reloadDiskIndex(wrappedDiskIndex),
makeClosure(this, &IndexMaintainer::deactivateDiskIndexes, indexDir)));
if (LOG_WOULD_LOG(event)) {
- EventLogger::diskIndexLoadComplete(indexDir, stopWatch.elapsed().ms());
+ EventLogger::diskIndexLoadComplete(indexDir, vespalib::count_ms(timer.elapsed()));
}
return retval;
}
diff --git a/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp b/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp
index 18bcde35020..ef55ea60c2b 100644
--- a/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp
+++ b/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp
@@ -16,7 +16,7 @@
#include <vespa/searchlib/diskindex/pagedict4file.h>
#include <vespa/searchlib/diskindex/pagedict4randread.h>
#include <vespa/vespalib/stllike/asciistream.h>
-#include <vespa/fastos/timestamp.h>
+#include <vespa/vespalib/util/time.h>
#include <openssl/sha.h>
#include <vespa/fastos/app.h>
#include <vespa/log/log.h>
@@ -364,7 +364,7 @@ writeField(FakeWordSet &wordSet,
namepref.c_str(),
dynamicKStr,
bool_to_str(encode_interleaved_features));
- fastos::StopWatch tv;
+ vespalib::Timer tv;
WrappedFieldWriter ostate(namepref,
dynamicK, encode_interleaved_features,
wordSet.getNumWords(), docIdLimit);
@@ -388,7 +388,7 @@ writeField(FakeWordSet &wordSet,
namepref.c_str(),
dynamicKStr,
bool_to_str(encode_interleaved_features),
- tv.elapsed().sec());
+ vespalib::to_s(tv.elapsed()));
}
@@ -406,7 +406,7 @@ readField(FakeWordSet &wordSet,
LOG(info, "enter readField, namepref=%s, dynamicK=%s, decode_interleaved_features=%s",
namepref.c_str(), dynamicKStr, bool_to_str(decode_interleaved_features));
- fastos::StopWatch tv;
+ vespalib::Timer tv;
istate.open();
if (istate._fieldReader->isValid())
istate._fieldReader->read();
@@ -432,7 +432,7 @@ readField(FakeWordSet &wordSet,
LOG(info, "leave readField, namepref=%s, dynamicK=%s, decode_interleaved_features=%s elapsed=%10.6f",
namepref.c_str(), dynamicKStr,
bool_to_str(decode_interleaved_features),
- tv.elapsed().sec());
+ vespalib::to_s(tv.elapsed()));
}
@@ -450,13 +450,12 @@ randReadField(FakeWordSet &wordSet,
LOG(info, "enter randReadField, namepref=%s, dynamicK=%s, decode_interleaved_features=%s",
namepref.c_str(), dynamicKStr, bool_to_str(decode_interleaved_features));
- fastos::StopWatch tv;
+ vespalib::Timer tv;
std::string cname = dirprefix + namepref;
cname += "dictionary";
- std::unique_ptr<search::index::DictionaryFileRandRead> dictFile;
- dictFile.reset(new PageDict4RandRead);
+ auto dictFile = std::make_unique<PageDict4RandRead>();
search::index::PostingListFileRandRead *postingFile = nullptr;
if (dynamicK)
@@ -529,7 +528,7 @@ randReadField(FakeWordSet &wordSet,
namepref.c_str(),
dynamicKStr,
bool_to_str(decode_interleaved_features),
- tv.elapsed().sec());
+ vespalib::to_s(tv.elapsed()));
}
@@ -558,7 +557,7 @@ fusionField(uint32_t numWordIds,
WrappedFieldWriter ostate(opref, dynamicK, encode_interleaved_features, numWordIds, docIdLimit);
WrappedFieldReader istate(ipref, numWordIds, docIdLimit);
- fastos::StopWatch tv;
+ vespalib::Timer tv;
ostate.open();
istate.open();
@@ -587,7 +586,7 @@ fusionField(uint32_t numWordIds,
opref.c_str(),
rawStr,
dynamicKStr, bool_to_str(encode_interleaved_features),
- tv.elapsed().sec());
+ vespalib::to_s(tv.elapsed()));
}
diff --git a/searchlib/src/tests/fef/phrasesplitter/benchmark.cpp b/searchlib/src/tests/fef/phrasesplitter/benchmark.cpp
index bed5d656b93..8b3fc81efb9 100644
--- a/searchlib/src/tests/fef/phrasesplitter/benchmark.cpp
+++ b/searchlib/src/tests/fef/phrasesplitter/benchmark.cpp
@@ -1,12 +1,10 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/testapp.h>
-
-#include <iomanip>
-#include <iostream>
#include <vespa/searchlib/fef/matchdatalayout.h>
#include <vespa/searchlib/fef/phrasesplitter.h>
#include <vespa/searchlib/fef/test/queryenvironment.h>
-#include <vespa/fastos/timestamp.h>
+#include <iomanip>
+#include <iostream>
#include <vespa/log/log.h>
LOG_SETUP("phrasesplitter_test");
@@ -16,10 +14,10 @@ namespace search::fef {
class Benchmark : public vespalib::TestApp
{
private:
- fastos::StopWatch _timer;
- fastos::TimeStamp _sample;
+ vespalib::Timer _timer;
+ vespalib::duration _sample;
- void start() { _timer.restart(); }
+ void start() { _timer = vespalib::Timer(); }
void sample() { _sample = _timer.elapsed(); }
void run(size_t numRuns, size_t numPositions);
@@ -74,8 +72,8 @@ Benchmark::Main()
run(numRuns, numPositions);
- std::cout << "TET: " << _sample.ms() << " (ms)" << std::endl;
- std::cout << "ETPD: " << std::fixed << std::setprecision(10) << _sample.ms() / numRuns << " (ms)" << std::endl;
+ std::cout << "TET: " << vespalib::count_ms(_sample) << " (ms)" << std::endl;
+ std::cout << "ETPD: " << std::fixed << std::setprecision(10) << vespalib::count_ms(_sample) / numRuns << " (ms)" << std::endl;
TEST_DONE();
}
diff --git a/searchlib/src/tests/grouping/grouping_test.cpp b/searchlib/src/tests/grouping/grouping_test.cpp
index 237c8035b86..4c94e4a2641 100644
--- a/searchlib/src/tests/grouping/grouping_test.cpp
+++ b/searchlib/src/tests/grouping/grouping_test.cpp
@@ -1896,11 +1896,11 @@ Test::testNanSorting()
EXPECT_FALSE(0.2 < myNan);
EXPECT_FALSE(0.2 > myNan);
- fastos::StopWatch timer;
+ fastos::Timer timer;
std::vector<double> groups;
- while (timer.elapsed().ms() < 60000.0) {
+ while (timer.elapsed() < 60s) {
std::vector<double> vec;
- srand((unsigned int)timer.elapsed().us());
+ srand((unsigned int)count_us(timer.elapsed()));
size_t limit = 2345678;
size_t mod = rand() % limit;
for (size_t i = 0; i < limit; i++) {
diff --git a/searchlib/src/tests/postinglistbm/stress_runner.cpp b/searchlib/src/tests/postinglistbm/stress_runner.cpp
index 100a4fcd70d..9c78515a03f 100644
--- a/searchlib/src/tests/postinglistbm/stress_runner.cpp
+++ b/searchlib/src/tests/postinglistbm/stress_runner.cpp
@@ -232,7 +232,7 @@ StressMaster::makePostingsHelper(FPFactory *postingFactory,
const std::string &postingFormat,
bool validate, bool verbose)
{
- fastos::StopWatch tv;
+ vespalib::Timer tv;
postingFactory->setup(_wordSet);
for (size_t i = 0; i < _wordSet.words().size(); ++i)
@@ -244,7 +244,7 @@ StressMaster::makePostingsHelper(FPFactory *postingFactory,
LOG(info,
"StressMaster::makePostingsHelper() elapsed %10.6f s for %s format",
- tv.elapsed().sec(),
+ vespalib::to_s(tv.elapsed()),
postingFormat.c_str());
}
@@ -314,7 +314,7 @@ StressMaster::run()
double
StressMaster::runWorkers(const std::string &postingFormat)
{
- fastos::StopWatch tv;
+ vespalib::Timer tv;
uint32_t numWorkers = 8;
for (uint32_t i = 0; i < numWorkers; ++i) {
@@ -340,11 +340,11 @@ StressMaster::runWorkers(const std::string &postingFormat)
LOG(info,
"StressMaster::run() elapsed %10.6f s for workers %s format",
- tv.elapsed().sec(),
+ vespalib::to_s(tv.elapsed()),
postingFormat.c_str());
_workers.clear();
_workersDone = 0;
- return tv.elapsed().sec();
+ return vespalib::to_s(tv.elapsed());
}
StressWorker::StressWorker(StressMaster& master, uint32_t id)
diff --git a/searchlib/src/tests/transactionlogstress/translogstress.cpp b/searchlib/src/tests/transactionlogstress/translogstress.cpp
index 2ec193cfe45..5d70c32cd7d 100644
--- a/searchlib/src/tests/transactionlogstress/translogstress.cpp
+++ b/searchlib/src/tests/transactionlogstress/translogstress.cpp
@@ -202,7 +202,7 @@ private:
Packet _packet;
SerialNum _current;
SerialNum _lastCommited;
- fastos::StopWatch _timer;
+ vespalib::Timer _timer;
void commitPacket();
bool addEntry(const Packet::Entry & e);
@@ -267,10 +267,9 @@ FeederThread::doRun()
}
commitPacket();
- int64_t milliSecsUsed = _timer.elapsed().ms();
- if (milliSecsUsed < 1000) {
+ if (_timer.elapsed() < 1s) {
//LOG(info, "FeederThread: sleep %u ms", 1000 - milliSecsUsed);
- std::this_thread::sleep_for(std::chrono::milliseconds(1000 - milliSecsUsed));
+ std::this_thread::sleep_for(1s - _timer.elapsed());
} else {
LOG(info, "FeederThread: max throughput");
}
@@ -460,9 +459,9 @@ private:
EntryGenerator _generator;
std::vector<std::shared_ptr<VisitorAgent> > _visitors;
std::vector<std::shared_ptr<VisitorAgent> > _rndVisitors;
- vespalib::duration _visitorInterval; // in milliseconds
- int64_t _pruneInterval; // in milliseconds
- fastos::StopWatch _pruneTimer;
+ vespalib::duration _visitorInterval;
+ vespalib::duration _pruneInterval;
+ vespalib::Timer _pruneTimer;
SerialNum _begin;
SerialNum _end;
size_t _count;
@@ -472,7 +471,7 @@ private:
public:
ControllerThread(const std::string & tlsSpec, const std::string & domain, const EntryGenerator & generator,
- uint32_t numVisitors, uint64_t visitorInterval, uint64_t pruneInterval);
+ uint32_t numVisitors, vespalib::duration visitorInterval, vespalib::duration pruneInterval);
~ControllerThread();
uint32_t runningVisitors();
std::vector<std::shared_ptr<VisitorAgent> > & getVisitors() { return _visitors; }
@@ -482,9 +481,9 @@ public:
ControllerThread::ControllerThread(const std::string & tlsSpec, const std::string & domain,
const EntryGenerator & generator, uint32_t numVisitors,
- uint64_t visitorInterval, uint64_t pruneInterval)
+ vespalib::duration visitorInterval, vespalib::duration pruneInterval)
: _tlsSpec(tlsSpec), _domain(domain), _client(tlsSpec.c_str()), _session(),
- _generator(generator), _visitors(), _rndVisitors(), _visitorInterval(std::chrono::milliseconds(visitorInterval)),
+ _generator(generator), _visitors(), _rndVisitors(), _visitorInterval(visitorInterval),
_pruneInterval(pruneInterval), _pruneTimer(), _begin(0), _end(0), _count(0)
{
for (uint32_t i = 0; i < numVisitors; ++i) {
@@ -521,7 +520,7 @@ ControllerThread::doRun()
throw std::runtime_error(vespalib::make_string("ControllerThread: Could not open session to %s", _tlsSpec.c_str()));
}
- _pruneTimer.restart();
+ _pruneTimer = vespalib::Timer();
while (!_done) {
// set finished visitors as idle
for (size_t i = 0; i < _visitors.size(); ++i) {
@@ -541,7 +540,7 @@ ControllerThread::doRun()
}
}
// prune transaction log server
- if (_pruneTimer.elapsed().ms() > _pruneInterval) {
+ if (_pruneTimer.elapsed() > _pruneInterval) {
getStatus();
SerialNum safePrune = _end;
for (size_t i = 0; i < _visitors.size(); ++i) {
@@ -554,7 +553,7 @@ ControllerThread::doRun()
if (!_session->erase(safePrune)) {
throw std::runtime_error(vespalib::make_string("ControllerThread: Could not erase up to %" PRIu64, safePrune));
}
- _pruneTimer.restart();
+ _pruneTimer = vespalib::Timer();
}
std::this_thread::sleep_for(_visitorInterval);
}
@@ -575,8 +574,8 @@ private:
std::chrono::milliseconds stressTime;
uint32_t feedRate;
uint32_t numVisitors;
- uint64_t visitorInterval;
- uint64_t pruneInterval;
+ vespalib::duration visitorInterval;
+ vespalib::duration pruneInterval;
uint32_t numPreGeneratedBuffers;
uint32_t minStrLen;
@@ -604,8 +603,8 @@ TransLogStress::printConfig()
std::cout << "stressTime: " << vespalib::to_s(_cfg.stressTime) << " s" << std::endl;
std::cout << "feedRate: " << _cfg.feedRate << " per/sec" << std::endl;
std::cout << "numVisitors: " << _cfg.numVisitors << std::endl;
- std::cout << "visitorInterval: " << _cfg.visitorInterval << " ms" << std::endl;
- std::cout << "pruneInterval: " << _cfg.pruneInterval / 1000 << " s" << std::endl;
+ std::cout << "visitorInterval: " << vespalib::count_ms(_cfg.visitorInterval) << " ms" << std::endl;
+ std::cout << "pruneInterval: " << vespalib::to_s(_cfg.pruneInterval) << " s" << std::endl;
std::cout << "numPreGeneratedBuffers: " << _cfg.numPreGeneratedBuffers << std::endl;
std::cout << "minStrLen: " << _cfg.minStrLen << std::endl;
std::cout << "maxStrLen: " << _cfg.maxStrLen << std::endl;
@@ -631,11 +630,11 @@ TransLogStress::Main()
_cfg.domainPartSize = 8000000; // ~8MB
_cfg.packetSize = 0x10000;
- _cfg.stressTime = std::chrono::milliseconds(1000 * 60);
+ _cfg.stressTime = 60s;
_cfg.feedRate = 10000;
_cfg.numVisitors = 1;
- _cfg.visitorInterval = 1000 * 1;
- _cfg.pruneInterval = 1000 * 12;
+ _cfg.visitorInterval = 1s;
+ _cfg.pruneInterval = 12s;
_cfg.numPreGeneratedBuffers = 0;
_cfg.minStrLen = 40;
@@ -666,10 +665,10 @@ TransLogStress::Main()
_cfg.numVisitors = atoi(arg);
break;
case 'c':
- _cfg.visitorInterval = atol(arg);
+ _cfg.visitorInterval = std::chrono::milliseconds(atol(arg));
break;
case 'e':
- _cfg.pruneInterval = 1000 * atol(arg);
+ _cfg.pruneInterval = vespalib::from_s(atol(arg));
break;
case 'g':
_cfg.numPreGeneratedBuffers = atoi(arg);
diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakewordset.cpp b/searchlib/src/vespa/searchlib/test/fakedata/fakewordset.cpp
index 1eec8261bf8..ba691e507fa 100644
--- a/searchlib/src/vespa/searchlib/test/fakedata/fakewordset.cpp
+++ b/searchlib/src/vespa/searchlib/test/fakedata/fakewordset.cpp
@@ -2,7 +2,7 @@
#include "fakewordset.h"
#include "fakeword.h"
-#include <vespa/fastos/timestamp.h>
+#include <vespa/vespalib/util/time.h>
#include <vespa/searchlib/bitcompression/posocc_fields_params.h>
#include <sstream>
@@ -99,7 +99,7 @@ FakeWordSet::setupWords(search::Rand48 &rnd,
_numDocs = numDocs;
LOG(info, "enter setupWords");
- fastos::StopWatch tv;
+ vespalib::Timer tv;
uint32_t packedIndex = _fieldsParams.size() - 1;
for (uint32_t i = 0; i < numWordsPerWordClass; ++i) {
@@ -122,7 +122,7 @@ FakeWordSet::setupWords(search::Rand48 &rnd,
packedIndex));
}
- LOG(info, "leave setupWords, elapsed %10.6f s", tv.elapsed().sec());
+ LOG(info, "leave setupWords, elapsed %10.6f s", vespalib::to_s(tv.elapsed()));
}
int
diff --git a/searchsummary/src/tests/extractkeywords/extractkeywordstest.cpp b/searchsummary/src/tests/extractkeywords/extractkeywordstest.cpp
index 5d1025c6de2..fcdd910fc17 100644
--- a/searchsummary/src/tests/extractkeywords/extractkeywordstest.cpp
+++ b/searchsummary/src/tests/extractkeywords/extractkeywordstest.cpp
@@ -3,7 +3,7 @@
#include "extractkeywordstest.h"
#include <vespa/searchsummary/docsummary/keywordextractor.h>
#include <vespa/searchlib/parsequery/simplequerystack.h>
-#include <vespa/fastos/timestamp.h>
+#include <vespa/vespalib/util/time.h>
#define NUMTESTS 5
@@ -97,7 +97,7 @@ ExtractKeywordsTest::Main()
_extractor = new search::docsummary::KeywordExtractor(nullptr);
_extractor->AddLegalIndexSpec("*");
- fastos::StopWatch timer;
+ vespalib::Timer timer;
// Actually run the tests that we wanted.
for (int j = 0; j < multiplier; j++)
@@ -109,7 +109,7 @@ ExtractKeywordsTest::Main()
}
// Print time taken
- double timeTaken = timer.elapsed().ms();
+ double timeTaken = vespalib::count_ms(timer.elapsed());
printf("Time taken : %f ms\n", timeTaken);
printf("Number of tests run: %d\n", testCnt);
diff --git a/vespalib/src/tests/btree/iteratespeed.cpp b/vespalib/src/tests/btree/iteratespeed.cpp
index 82aa9bb5f54..e20e9537f7f 100644
--- a/vespalib/src/tests/btree/iteratespeed.cpp
+++ b/vespalib/src/tests/btree/iteratespeed.cpp
@@ -14,9 +14,9 @@
#include <vespa/vespalib/btree/btree.hpp>
#include <vespa/vespalib/btree/btreestore.hpp>
#include <vespa/vespalib/util/rand48.h>
+#include <vespa/vespalib/util/time.h>
#include <vespa/fastos/app.h>
-#include <vespa/fastos/timestamp.h>
#include <vespa/log/log.h>
LOG_SETUP("iteratespeed");
@@ -83,7 +83,7 @@ IterateSpeed::workLoop(int loops, bool enableForward, bool enableBackwards,
assert(numEntries == tree.size());
assert(tree.isValid());
for (int l = 0; l < loops; ++l) {
- fastos::StopWatch stopWatch;
+ vespalib::Timer timer;
uint64_t sum = 0;
for (size_t innerl = 0; innerl < numInnerLoops; ++innerl) {
if (iterateMethod == IterateMethod::FORWARD) {
@@ -106,7 +106,7 @@ IterateSpeed::workLoop(int loops, bool enableForward, bool enableBackwards,
[&](int key) { sum += key; } );
}
}
- double used = stopWatch.elapsed().sec();
+ double used = vespalib::to_s(timer.elapsed());
printf("Elapsed time for iterating %ld steps is %8.5f, "
"direction=%s, fanout=%u,%u, sum=%" PRIu64 "\n",
numEntries * numInnerLoops,
diff --git a/vespalib/src/tests/executor/stress_test.cpp b/vespalib/src/tests/executor/stress_test.cpp
index bbe754be2bd..01787e2e14c 100644
--- a/vespalib/src/tests/executor/stress_test.cpp
+++ b/vespalib/src/tests/executor/stress_test.cpp
@@ -60,28 +60,28 @@ uint32_t
Test::calibrate(double wanted_ms)
{
uint32_t n = 0;
- fastos::StopWatch t0;
- fastos::StopWatch t1;
+ vespalib::Timer t0;
+ vespalib::Timer t1;
{ // calibration of calibration loop
uint32_t result = 0;
- double ms;
+ vespalib::duration dur;
do {
result += doStuff(++n);
- t1.restart();
- ms = (t1.elapsed().ms() - t0.elapsed().ms());
- } while (ms < 1000.0);
+ t1 = vespalib::Timer();
+ dur = (t1.elapsed() - t0.elapsed());
+ } while (dur < 1s);
_result += result;
}
{ // calibrate loop
- t0.restart();
+ t0 = vespalib::Timer();
uint32_t result = 0;
for (uint32_t i = 0; i < n; ++i) {
result += doStuff(i);
}
_result += result;
- t1.restart();
+ t1 = vespalib::Timer();
}
- double ms = (t1.elapsed().ms() - t0.elapsed().ms());
+ double ms = vespalib::count_ms(t1.elapsed() - t0.elapsed());
double size = (((double)n) / ms) * wanted_ms;
return (uint32_t) std::round(size);
}
@@ -121,7 +121,7 @@ Test::Main()
fprintf(stderr, "all threads have been accounted for...\n");
}
{
- fastos::StopWatch t0;
+ vespalib::Timer t0;
fprintf(stderr, "starting task submission...\n");
uint32_t result = 0;
for (uint32_t i = 0; i < tasks; ++i) {
@@ -133,7 +133,7 @@ Test::Main()
}
}
executor.sync();
- double ms = t0.elapsed().ms();
+ double ms = vespalib::count_ms(t0.elapsed());
fprintf(stderr, "total execution wall time: %g ms\n", ms);
_result += result;
}
diff --git a/vespalib/src/tests/simple_thread_bundle/threading_speed_test.cpp b/vespalib/src/tests/simple_thread_bundle/threading_speed_test.cpp
index d67c417b71a..50ee6296f16 100644
--- a/vespalib/src/tests/simple_thread_bundle/threading_speed_test.cpp
+++ b/vespalib/src/tests/simple_thread_bundle/threading_speed_test.cpp
@@ -57,11 +57,11 @@ TEST("estimate cost of thread bundle fork/join") {
}
double minTime = 1000000.0;
for (size_t samples = 0; samples < 32; ++samples) {
- fastos::StopWatch timer;
+ vespalib::Timer timer;
for (size_t n = 0; n < fork; ++n) {
threadBundle.run(targets);
}
- double time = timer.elapsed().ms();
+ double time = vespalib::count_ms(timer.elapsed());
if (time < minTime) {
minTime = time;
}
diff --git a/vespalib/src/tests/slime/summary-feature-benchmark/summary-feature-benchmark.cpp b/vespalib/src/tests/slime/summary-feature-benchmark/summary-feature-benchmark.cpp
index 61ba2593eb3..1d011e507bb 100644
--- a/vespalib/src/tests/slime/summary-feature-benchmark/summary-feature-benchmark.cpp
+++ b/vespalib/src/tests/slime/summary-feature-benchmark/summary-feature-benchmark.cpp
@@ -47,12 +47,12 @@ TEST_F("slime -> json speed", FeatureFixture()) {
double minTime = 1000000.0;
MyBuffer buffer;
for (size_t i = 0; i < 16; ++i) {
- fastos::StopWatch timer;
+ vespalib::Timer timer;
for (size_t j = 0; j < 256; ++j) {
buffer.used = 0;
slime::JsonFormat::encode(f1.slime, buffer, true);
}
- minTime = std::min(minTime, timer.elapsed().ms() / 256.0);
+ minTime = std::min(minTime, vespalib::count_ms(timer.elapsed()) / 256.0);
size = buffer.used;
}
fprintf(stderr, "time: %g ms (size: %zu bytes)\n", minTime, size);
@@ -63,12 +63,12 @@ TEST_F("slime -> binary speed", FeatureFixture()) {
double minTime = 1000000.0;
MyBuffer buffer;
for (size_t i = 0; i < 16; ++i) {
- fastos::StopWatch timer;
+ vespalib::Timer timer;
for (size_t j = 0; j < 256; ++j) {
buffer.used = 0;
slime::BinaryFormat::encode(f1.slime, buffer);
}
- minTime = std::min(minTime, timer.elapsed().ms() / 256.0);
+ minTime = std::min(minTime, vespalib::count_ms(timer.elapsed()) / 256.0);
size = buffer.used;
}
fprintf(stderr, "time: %g ms (size: %zu bytes)\n", minTime, size);