summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-12-08 20:11:13 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2019-12-16 23:48:46 +0000
commitc72bdc628b4493bfb2974ab3fe479d2af0d376f1 (patch)
treece2f82f3f6f7cfd6ece7ac9ae06edef92986432f /searchlib
parent6b4486254e67b61e7dbe7dab30ae50d3b0bf01bb (diff)
WipeHistory has not been used for a very long time.
Diffstat (limited to 'searchlib')
-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
6 files changed, 49 insertions, 53 deletions
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