summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-11-15 10:18:26 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2019-11-15 10:18:26 +0000
commit5b2071b9f54c54cbc79225b27faf8ac645158e72 (patch)
tree78291a536308ae428be60969477e407f8f423ddc
parentd817a7407ee9cef2684a9777a0b5d33c6b35a5f3 (diff)
Use steady_clock
-rw-r--r--fastos/src/vespa/fastos/timestamp.cpp6
-rw-r--r--fastos/src/vespa/fastos/timestamp.h4
-rw-r--r--fnet/src/vespa/fnet/transport_thread.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp7
-rw-r--r--searchcore/src/vespa/searchcore/proton/docsummary/summarymanagerinitializer.cpp7
-rw-r--r--searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.cpp7
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp10
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.cpp4
8 files changed, 23 insertions, 24 deletions
diff --git a/fastos/src/vespa/fastos/timestamp.cpp b/fastos/src/vespa/fastos/timestamp.cpp
index 8f8480d09ab..de234a988cd 100644
--- a/fastos/src/vespa/fastos/timestamp.cpp
+++ b/fastos/src/vespa/fastos/timestamp.cpp
@@ -63,15 +63,17 @@ ClockSteady::now()
return steady_now();
}
-void
+StopWatch &
StopWatch::start() {
_startTime = steady_now();
_stopTime = _startTime;
+ return *this;
}
-void
+StopWatch &
StopWatch::stop() {
_stopTime = steady_now();
+ return *this;
}
}
diff --git a/fastos/src/vespa/fastos/timestamp.h b/fastos/src/vespa/fastos/timestamp.h
index 21ef9d6df75..300875ed4b8 100644
--- a/fastos/src/vespa/fastos/timestamp.h
+++ b/fastos/src/vespa/fastos/timestamp.h
@@ -72,8 +72,8 @@ class StopWatch
public:
StopWatch() : _startTime(), _stopTime() { }
- void start();
- void stop();
+ StopWatch & start();
+ StopWatch & stop();
TimeStamp startTime() const { return _startTime; }
diff --git a/fnet/src/vespa/fnet/transport_thread.h b/fnet/src/vespa/fnet/transport_thread.h
index 4fc4c58107d..c7aac54a5d4 100644
--- a/fnet/src/vespa/fnet/transport_thread.h
+++ b/fnet/src/vespa/fnet/transport_thread.h
@@ -52,7 +52,7 @@ private:
std::atomic<bool> _shutdown; // should stop event loop ?
bool _finished; // event loop stopped ?
bool _waitFinished; // someone is waiting for _finished
- bool _deleted; // destructor called ?
+ bool _deleted; // destructor called ?Ntrace
FNET_TransportThread(const FNET_TransportThread &);
FNET_TransportThread &operator=(const FNET_TransportThread &);
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp
index d8970d79ef2..39ea1b66f63 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp
@@ -175,7 +175,8 @@ AttributeInitializer::loadAttribute(const AttributeVectorSP &attr,
search::SerialNum serialNum) const
{
assert(attr->hasLoadData());
- fastos::TimeStamp startTime = fastos::ClockSystem::now();
+ fastos::StopWatch stopWatch;
+ stopWatch.start();
EventLogger::loadAttributeStart(_documentSubDbName, attr->getName());
if (!attr->load()) {
LOG(warning, "Could not load attribute vector '%s' from disk. Returning empty attribute vector",
@@ -183,9 +184,7 @@ AttributeInitializer::loadAttribute(const AttributeVectorSP &attr,
return false;
} else {
attr->commit(serialNum, serialNum);
- fastos::TimeStamp endTime = fastos::ClockSystem::now();
- int64_t elapsedTimeMs = (endTime - startTime).ms();
- EventLogger::loadAttributeComplete(_documentSubDbName, attr->getName(), elapsedTimeMs);
+ EventLogger::loadAttributeComplete(_documentSubDbName, attr->getName(), stopWatch.stop().elapsed().ms());
}
return true;
}
diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanagerinitializer.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanagerinitializer.cpp
index 32a03219416..a1a94a27c08 100644
--- a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanagerinitializer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanagerinitializer.cpp
@@ -38,14 +38,13 @@ void
SummaryManagerInitializer::run()
{
vespalib::mkdir(_baseDir, false);
- fastos::TimeStamp startTime = fastos::ClockSystem::now();
+ fastos::StopWatch stopWatch;
+ stopWatch.start();
EventLogger::loadDocumentStoreStart(_subDbName);
*_result = std::make_shared<SummaryManager>
(_summaryExecutor, _storeCfg, _grow, _baseDir, _docTypeName,
_tuneFile, _fileHeaderContext, _tlSyncer, _bucketizer);
- fastos::TimeStamp endTime = fastos::ClockSystem::now();
- int64_t elapsedTimeMs = (endTime - startTime).ms();
- EventLogger::loadDocumentStoreComplete(_subDbName, elapsedTimeMs);
+ EventLogger::loadDocumentStoreComplete(_subDbName, stopWatch.stop().elapsed().ms());
}
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.cpp
index 5703f03b32e..56da585dd9b 100644
--- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreinitializer.cpp
@@ -43,16 +43,15 @@ DocumentMetaStoreInitializer::run()
vespalib::string attrFileName = _baseDir + "/" + snap.dirName + "/" + name;
_dms->setBaseFileName(attrFileName);
assert(_dms->hasLoadData());
- fastos::TimeStamp startTime = fastos::ClockSystem::now();
+ fastos::StopWatch stopWatch;
+ stopWatch.start();
EventLogger::loadDocumentMetaStoreStart(_subDbName);
if (!_dms->load()) {
throw IllegalStateException(failedMsg(_docTypeName.c_str()));
} else {
_dms->commit(snap.syncToken, snap.syncToken);
}
- fastos::TimeStamp endTime = fastos::ClockSystem::now();
- int64_t elapsedTimeMs = (endTime - startTime).ms();
- EventLogger::loadDocumentMetaStoreComplete(_subDbName, elapsedTimeMs);
+ EventLogger::loadDocumentMetaStoreComplete(_subDbName, stopWatch.stop().elapsed().ms());
}
} else {
vespalib::mkdir(_baseDir, false);
diff --git a/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp b/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp
index 1786665c248..fab0c603189 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.cpp
@@ -12,7 +12,7 @@ LOG_SETUP(".searchcorespi.index.warmupindexcollection");
namespace searchcorespi {
-using fastos::ClockSystem;
+using fastos::ClockSteady;
using fastos::TimeStamp;
using index::IDiskIndex;
using search::fef::MatchDataLayout;
@@ -42,7 +42,7 @@ WarmupIndexCollection::WarmupIndexCollection(const WarmupConfig & warmupConfig,
_warmup(warmup),
_executor(executor),
_warmupDone(warmupDone),
- _warmupEndTime(ClockSystem::now() + TimeStamp::Seconds(warmupConfig.getDuration())),
+ _warmupEndTime(ClockSteady::now() + TimeStamp::Seconds(warmupConfig.getDuration())),
_handledTerms(std::make_unique<FieldTermMap>())
{
if (next->valid()) {
@@ -68,7 +68,7 @@ WarmupIndexCollection::toString() const
{
vespalib::asciistream os;
os << "warmup : ";
- if (dynamic_cast<const IDiskIndex *>(&_warmup) != NULL) {
+ if (dynamic_cast<const IDiskIndex *>(&_warmup) != nullptr) {
os << static_cast<const IDiskIndex &>(_warmup).getIndexDir();
} else {
os << typeid(_warmup).name();
@@ -114,7 +114,7 @@ WarmupIndexCollection::getSourceId(uint32_t i) const
void
WarmupIndexCollection::fireWarmup(Task::UP task)
{
- fastos::TimeStamp now(fastos::ClockSystem::now());
+ fastos::TimeStamp now(fastos::ClockSteady::now());
if (now < _warmupEndTime) {
_executor.execute(std::move(task));
} else {
@@ -132,7 +132,7 @@ bool
WarmupIndexCollection::handledBefore(uint32_t fieldId, const Node &term)
{
const StringBase * sb(dynamic_cast<const StringBase *>(&term));
- if (sb != NULL) {
+ if (sb != nullptr) {
const vespalib::string & s = sb->getTerm();
std::lock_guard<std::mutex> guard(_lock);
TermMap::insert_result found = (*_handledTerms)[fieldId].insert(s);
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
index 833d831466b..35f5d59bb5f 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 < fastos::ClockSystem::now()) {
+ } else if (_nextStatUpdateTime < fastos::ClockSteady::now()) {
onUpdateStat();
- _nextStatUpdateTime = fastos::ClockSystem::now() + 5ul * fastos::TimeStamp::SEC;
+ _nextStatUpdateTime = fastos::ClockSteady::now() + 5ul * fastos::TimeStamp::SEC;
}
}