diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-10-22 11:14:35 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-10-22 11:14:35 +0000 |
commit | de33bea303b8c207a647551d6e7d575925a2b803 (patch) | |
tree | 098a89a599e8332745ae24939614f7168a92e519 /staging_vespalib | |
parent | 4060207695d6b8ebb22fee8274a83cfb78ec84fd (diff) |
properly set utilization
Diffstat (limited to 'staging_vespalib')
5 files changed, 10 insertions, 10 deletions
diff --git a/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.cpp b/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.cpp index a0f8c6382ea..099a958a00b 100644 --- a/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.cpp @@ -334,12 +334,11 @@ AdaptiveSequencedExecutor::getStats() { auto guard = std::lock_guard(_mutex); ExecutorStats stats = _stats; - stats.threadCount = _cfg.num_threads; steady_time now = steady_clock::now(); for (size_t i(0); i < _worker_stack.size(); i++) { _idleTracker.was_idle(_worker_stack.access(i)->idleTracker.reset(now)); } - _stats.absUtil = _idleTracker.reset(now, 1); + stats.setUtil(_cfg.num_threads, _idleTracker.reset(now, _cfg.num_threads)); _stats = ExecutorStats(); _stats.queueSize.add(_self.pending_tasks); return stats; diff --git a/staging_vespalib/src/vespa/vespalib/util/foreground_thread_executor.h b/staging_vespalib/src/vespa/vespalib/util/foreground_thread_executor.h index 15da8b90e3c..99a4ddffa22 100644 --- a/staging_vespalib/src/vespa/vespalib/util/foreground_thread_executor.h +++ b/staging_vespalib/src/vespa/vespalib/util/foreground_thread_executor.h @@ -23,7 +23,7 @@ public: } size_t getNumThreads() const override { return 0; } ExecutorStats getStats() override { - return ExecutorStats(1, ExecutorStats::QueueSizeT(), _accepted.load(std::memory_order_relaxed), 0, 1, 1.0); + return ExecutorStats(ExecutorStats::QueueSizeT(), _accepted.load(std::memory_order_relaxed), 0, 1); } void setTaskLimit(uint32_t taskLimit) override { (void) taskLimit; } uint32_t getTaskLimit() const override { return std::numeric_limits<uint32_t>::max(); } diff --git a/staging_vespalib/src/vespa/vespalib/util/foregroundtaskexecutor.cpp b/staging_vespalib/src/vespa/vespalib/util/foregroundtaskexecutor.cpp index b65f79e65cb..e756b608a3d 100644 --- a/staging_vespalib/src/vespa/vespalib/util/foregroundtaskexecutor.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/foregroundtaskexecutor.cpp @@ -19,7 +19,7 @@ ForegroundTaskExecutor::ForegroundTaskExecutor(uint32_t threads) ForegroundTaskExecutor::~ForegroundTaskExecutor() = default; void -ForegroundTaskExecutor::executeTask(ExecutorId id, vespalib::Executor::Task::UP task) +ForegroundTaskExecutor::executeTask(ExecutorId id, Executor::Task::UP task) { assert(id.getId() < getNumExecutors()); task->run(); @@ -35,8 +35,8 @@ void ForegroundTaskExecutor::setTaskLimit(uint32_t) { } -vespalib::ExecutorStats ForegroundTaskExecutor::getStats() { - return vespalib::ExecutorStats(1, vespalib::ExecutorStats::QueueSizeT(0) , _accepted.load(std::memory_order_relaxed), 0, 1, 1.0); +ExecutorStats ForegroundTaskExecutor::getStats() { + return ExecutorStats(ExecutorStats::QueueSizeT(0) , _accepted.load(std::memory_order_relaxed), 0, 1); } ISequencedTaskExecutor::ExecutorId @@ -44,4 +44,4 @@ ForegroundTaskExecutor::getExecutorId(uint64_t componentId) const { return ExecutorId(componentId%getNumExecutors()); } -} // namespace search +} diff --git a/staging_vespalib/src/vespa/vespalib/util/foregroundtaskexecutor.h b/staging_vespalib/src/vespa/vespalib/util/foregroundtaskexecutor.h index 7359de0ba66..9d351aca653 100644 --- a/staging_vespalib/src/vespa/vespalib/util/foregroundtaskexecutor.h +++ b/staging_vespalib/src/vespa/vespalib/util/foregroundtaskexecutor.h @@ -22,10 +22,10 @@ public: ~ForegroundTaskExecutor() override; ExecutorId getExecutorId(uint64_t componentId) const override; - void executeTask(ExecutorId id, vespalib::Executor::Task::UP task) override; + void executeTask(ExecutorId id, Executor::Task::UP task) override; void sync() override; void setTaskLimit(uint32_t taskLimit) override; - vespalib::ExecutorStats getStats() override; + ExecutorStats getStats() override; private: std::atomic<uint64_t> _accepted; }; diff --git a/staging_vespalib/src/vespa/vespalib/util/singleexecutor.cpp b/staging_vespalib/src/vespa/vespalib/util/singleexecutor.cpp index 2bb87350036..af95918ccab 100644 --- a/staging_vespalib/src/vespa/vespalib/util/singleexecutor.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/singleexecutor.cpp @@ -170,7 +170,8 @@ SingleExecutor::getStats() { uint64_t accepted = _wp.load(std::memory_order_relaxed); steady_time now = steady_clock::now(); _idleTracker.was_idle(_threadIdleTracker.reset(now)); - ExecutorStats stats(1, _queueSize, (accepted - _lastAccepted), 0, _wakeupCount, _idleTracker.reset(now, 1)); + ExecutorStats stats(_queueSize, (accepted - _lastAccepted), 0, _wakeupCount); + stats.setUtil(1, _idleTracker.reset(now, 1)); _wakeupCount = 0; _lastAccepted = accepted; _queueSize = ExecutorStats::QueueSizeT() ; |