aboutsummaryrefslogtreecommitdiffstats
path: root/storageframework
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-10-13 19:58:10 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-10-13 19:58:10 +0000
commit231962269b22d5f5f9d58d62ea15430587ab00b0 (patch)
tree7049ef6e33bdc265ed851e353c1e641d1dd058ed /storageframework
parentaf77cdd1fb34e8e4cb7259bea395427a91bf8a39 (diff)
Time is no longer given in milliseconds.
Diffstat (limited to 'storageframework')
-rw-r--r--storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp37
-rw-r--r--storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.h16
-rw-r--r--storageframework/src/vespa/storageframework/defaultimplementation/thread/threadpoolimpl.cpp4
-rw-r--r--storageframework/src/vespa/storageframework/defaultimplementation/thread/threadpoolimpl.h2
-rw-r--r--storageframework/src/vespa/storageframework/generic/thread/threadpool.cpp20
-rw-r--r--storageframework/src/vespa/storageframework/generic/thread/threadpool.h12
6 files changed, 45 insertions, 46 deletions
diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp
index ba3d52fb8f5..32c14a2e6a2 100644
--- a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp
+++ b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp
@@ -12,20 +12,20 @@ namespace storage::framework::defaultimplementation {
ThreadImpl::ThreadImpl(ThreadPoolImpl& pool,
Runnable& runnable,
vespalib::stringref id,
- vespalib::duration waitTimeMs,
- vespalib::duration maxProcessTimeMs,
+ vespalib::duration waitTime,
+ vespalib::duration maxProcessTime,
int ticksBeforeWait)
: Thread(id),
_pool(pool),
_runnable(runnable),
- _properties(waitTimeMs, maxProcessTimeMs, ticksBeforeWait),
+ _properties(waitTime, maxProcessTime, ticksBeforeWait),
_tickData(),
_tickDataPtr(0),
_interrupted(false),
_joined(false),
_thread(*this)
{
- _tickData[_tickDataPtr]._lastTickMs = pool.getClock().getMonotonicTime();
+ _tickData[_tickDataPtr]._lastTick = pool.getClock().getMonotonicTime();
_thread.start(_pool.getThreadPool());
}
@@ -87,11 +87,11 @@ ThreadImpl::registerTick(CycleType cycleType, vespalib::steady_time now)
vespalib::count_ms(now.time_since_epoch()), vespalib::count_ms(previousTick.time_since_epoch()));
return;
}
- vespalib::duration cycleTimeMs = now - previousTick;
+ vespalib::duration cycleTime = now - previousTick;
if (cycleType == WAIT_CYCLE) {
- data._maxWaitTimeSeen = std::max(data._maxWaitTimeSeen, cycleTimeMs);
+ data._maxWaitTimeSeen = std::max(data._maxWaitTimeSeen, cycleTime);
} else {
- data._maxProcessingTimeSeen = std::max(data._maxProcessingTimeSeen, cycleTimeMs);
+ data._maxProcessingTimeSeen = std::max(data._maxProcessingTimeSeen, cycleTime);
}
}
@@ -110,11 +110,11 @@ ThreadImpl::setTickData(const ThreadTickData& tickData)
}
void
-ThreadImpl::updateParameters(vespalib::duration waitTimeMs,
- vespalib::duration maxProcessTimeMs,
+ThreadImpl::updateParameters(vespalib::duration waitTime,
+ vespalib::duration maxProcessTime,
int ticksBeforeWait) {
- _properties.setWaitTime(waitTimeMs);
- _properties.setMaxProcessTime(maxProcessTimeMs);
+ _properties.setWaitTime(waitTime);
+ _properties.setMaxProcessTime(maxProcessTime);
_properties.setTicksBeforeWait(ticksBeforeWait);
}
@@ -124,21 +124,20 @@ ThreadImpl::AtomicThreadTickData::loadRelaxed() const noexcept
ThreadTickData result;
constexpr auto relaxed = std::memory_order_relaxed;
result._lastTickType = _lastTickType.load(relaxed);
- result._lastTick = _lastTickMs.load(relaxed);
- result._maxProcessingTimeSeen = _maxProcessingTimeSeenMs.load(relaxed);
- result._maxWaitTimeSeen = _maxWaitTimeSeenMs.load(relaxed);
+ result._lastTick = _lastTick.load(relaxed);
+ result._maxProcessingTimeSeen = _maxProcessingTimeSeen.load(relaxed);
+ result._maxWaitTimeSeen = _maxWaitTimeSeen.load(relaxed);
return result;
}
void
-ThreadImpl::AtomicThreadTickData::storeRelaxed(
- const ThreadTickData& newState) noexcept
+ThreadImpl::AtomicThreadTickData::storeRelaxed(const ThreadTickData& newState) noexcept
{
constexpr auto relaxed = std::memory_order_relaxed;
_lastTickType.store(newState._lastTickType, relaxed);
- _lastTickMs.store(newState._lastTick, relaxed);
- _maxProcessingTimeSeenMs.store(newState._maxProcessingTimeSeen, relaxed);
- _maxWaitTimeSeenMs.store(newState._maxWaitTimeSeen, relaxed);
+ _lastTick.store(newState._lastTick, relaxed);
+ _maxProcessingTimeSeen.store(newState._maxProcessingTimeSeen, relaxed);
+ _maxWaitTimeSeen.store(newState._maxWaitTimeSeen, relaxed);
}
}
diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.h b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.h
index 077e508a609..a5331ceffd1 100644
--- a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.h
+++ b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.h
@@ -28,14 +28,14 @@ class ThreadImpl : public Thread
struct AtomicThreadTickData {
AtomicThreadTickData() noexcept
: _lastTickType(),
- _lastTickMs(vespalib::steady_time(vespalib::duration::zero())),
- _maxProcessingTimeSeenMs(),
- _maxWaitTimeSeenMs()
+ _lastTick(vespalib::steady_time(vespalib::duration::zero())),
+ _maxProcessingTimeSeen(),
+ _maxWaitTimeSeen()
{}
std::atomic<CycleType> _lastTickType;
- std::atomic<vespalib::steady_time> _lastTickMs;
- std::atomic<vespalib::duration> _maxProcessingTimeSeenMs;
- std::atomic<vespalib::duration> _maxWaitTimeSeenMs;
+ std::atomic<vespalib::steady_time> _lastTick;
+ std::atomic<vespalib::duration> _maxProcessingTimeSeen;
+ std::atomic<vespalib::duration> _maxWaitTimeSeen;
// struct stores and loads are both data race free with relaxed
// memory semantics. This means it's possible to observe stale/partial
// state in a case with concurrent readers/writers.
@@ -55,8 +55,8 @@ class ThreadImpl : public Thread
void run();
public:
- ThreadImpl(ThreadPoolImpl&, Runnable&, vespalib::stringref id, vespalib::duration waitTimeMs,
- vespalib::duration maxProcessTimeMs, int ticksBeforeWait);
+ ThreadImpl(ThreadPoolImpl&, Runnable&, vespalib::stringref id, vespalib::duration waitTime,
+ vespalib::duration maxProcessTime, int ticksBeforeWait);
~ThreadImpl();
bool interrupted() const override;
diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadpoolimpl.cpp b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadpoolimpl.cpp
index e5698f0cbc2..8563881dbc8 100644
--- a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadpoolimpl.cpp
+++ b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadpoolimpl.cpp
@@ -46,14 +46,14 @@ ThreadPoolImpl::~ThreadPoolImpl()
}
Thread::UP
-ThreadPoolImpl::startThread(Runnable& runnable, vespalib::stringref id, vespalib::duration waitTimeMs,
+ThreadPoolImpl::startThread(Runnable& runnable, vespalib::stringref id, vespalib::duration waitTime,
vespalib::duration maxProcessTime, int ticksBeforeWait)
{
std::lock_guard lock(_threadVectorLock);
if (_stopping) {
throw IllegalStateException("Threadpool is stopping", VESPA_STRLOC);
}
- auto thread = std::make_unique<ThreadImpl>(*this, runnable, id, waitTimeMs, maxProcessTime, ticksBeforeWait);
+ auto thread = std::make_unique<ThreadImpl>(*this, runnable, id, waitTime, maxProcessTime, ticksBeforeWait);
_threads.push_back(thread.get());
return thread;
}
diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadpoolimpl.h b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadpoolimpl.h
index 5a025ac3ad3..47e07b1c06e 100644
--- a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadpoolimpl.h
+++ b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadpoolimpl.h
@@ -21,7 +21,7 @@ public:
ThreadPoolImpl(Clock&);
~ThreadPoolImpl() override;
- Thread::UP startThread(Runnable&, vespalib::stringref id, vespalib::duration waitTimeMs,
+ Thread::UP startThread(Runnable&, vespalib::stringref id, vespalib::duration waitTime,
vespalib::duration maxProcessTime, int ticksBeforeWait) override;
void visitThreads(ThreadVisitor&) const override;
diff --git a/storageframework/src/vespa/storageframework/generic/thread/threadpool.cpp b/storageframework/src/vespa/storageframework/generic/thread/threadpool.cpp
index 3c2ebba42f7..208c849234c 100644
--- a/storageframework/src/vespa/storageframework/generic/thread/threadpool.cpp
+++ b/storageframework/src/vespa/storageframework/generic/thread/threadpool.cpp
@@ -4,33 +4,33 @@
namespace storage::framework {
-ThreadProperties::ThreadProperties(vespalib::duration waitTimeMs,
- vespalib::duration maxProcessTimeMs,
+ThreadProperties::ThreadProperties(vespalib::duration waitTime,
+ vespalib::duration maxProcessTime,
int ticksBeforeWait)
{
- setWaitTime(waitTimeMs);
- setMaxProcessTime(maxProcessTimeMs);
+ setWaitTime(waitTime);
+ setMaxProcessTime(maxProcessTime);
setTicksBeforeWait(ticksBeforeWait);
}
vespalib::duration ThreadProperties::getMaxProcessTime() const {
- return _maxProcessTimeMs.load(std::memory_order_relaxed);
+ return _maxProcessTime.load(std::memory_order_relaxed);
}
vespalib::duration ThreadProperties::getWaitTime() const {
- return _waitTimeMs.load(std::memory_order_relaxed);
+ return _waitTime.load(std::memory_order_relaxed);
}
int ThreadProperties::getTicksBeforeWait() const {
return _ticksBeforeWait.load(std::memory_order_relaxed);
}
-void ThreadProperties::setMaxProcessTime(vespalib::duration maxProcessingTimeMs) {
- _maxProcessTimeMs.store(maxProcessingTimeMs);
+void ThreadProperties::setMaxProcessTime(vespalib::duration maxProcessingTime) {
+ _maxProcessTime.store(maxProcessingTime);
}
-void ThreadProperties::setWaitTime(vespalib::duration waitTimeMs) {
- _waitTimeMs.store(waitTimeMs);
+void ThreadProperties::setWaitTime(vespalib::duration waitTime) {
+ _waitTime.store(waitTime);
}
void ThreadProperties::setTicksBeforeWait(int ticksBeforeWait) {
diff --git a/storageframework/src/vespa/storageframework/generic/thread/threadpool.h b/storageframework/src/vespa/storageframework/generic/thread/threadpool.h
index 0ee800c43ff..c21e5c8b1b8 100644
--- a/storageframework/src/vespa/storageframework/generic/thread/threadpool.h
+++ b/storageframework/src/vespa/storageframework/generic/thread/threadpool.h
@@ -32,7 +32,7 @@ private:
* Time this thread should maximum use to process before a tick is
* registered. (Including wait time if wait time is not set)
*/
- std::atomic<vespalib::duration> _maxProcessTimeMs;
+ std::atomic<vespalib::duration> _maxProcessTime;
/**
* Time this thread will wait in a non-interrupted wait cycle.
* Used in cases where a wait cycle is registered. As long as no other
@@ -40,7 +40,7 @@ private:
* wait time here. The deadlock detector should add a configurable
* global time period before flagging deadlock anyways.
*/
- std::atomic<vespalib::duration> _waitTimeMs;
+ std::atomic<vespalib::duration> _waitTime;
/**
* Number of ticks to be done before a wait.
*/
@@ -48,7 +48,7 @@ private:
public:
ThreadProperties(vespalib::duration waitTime,
- vespalib::duration maxProcessTimeMs,
+ vespalib::duration maxProcessTime,
int ticksBeforeWait);
void setMaxProcessTime(vespalib::duration);
@@ -60,8 +60,8 @@ private:
int getTicksBeforeWait() const;
vespalib::duration getMaxCycleTime() const {
- return std::max(_maxProcessTimeMs.load(std::memory_order_relaxed),
- _waitTimeMs.load(std::memory_order_relaxed));
+ return std::max(_maxProcessTime.load(std::memory_order_relaxed),
+ _waitTime.load(std::memory_order_relaxed));
}
};
@@ -86,7 +86,7 @@ struct ThreadPool {
virtual Thread::UP startThread(Runnable&,
vespalib::stringref id,
- vespalib::duration waitTimeMs,
+ vespalib::duration waitTime,
vespalib::duration maxProcessTime,
int ticksBeforeWait) = 0;