aboutsummaryrefslogtreecommitdiffstats
path: root/staging_vespalib
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2020-12-15 11:05:00 +0000
committerGeir Storli <geirst@verizonmedia.com>2020-12-15 11:06:47 +0000
commitf31f8dffef680bef44e56d2c5e22900533ab272f (patch)
treedc72fbe4de83f8fbc235bda85a24f244e80a1ea8 /staging_vespalib
parent6f479ad61a4a6d973ce6a985e25206e9adfdcfee (diff)
Add explorer for the ExecutorThreadingService used in a document database.
Diffstat (limited to 'staging_vespalib')
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.cpp7
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.h3
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/foreground_thread_executor.h1
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.cpp9
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.h2
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/singleexecutor.h4
6 files changed, 24 insertions, 2 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 407129199e3..e4b64b19739 100644
--- a/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.cpp
+++ b/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.cpp
@@ -334,4 +334,11 @@ AdaptiveSequencedExecutor::getStats()
return stats;
}
+AdaptiveSequencedExecutor::Config
+AdaptiveSequencedExecutor::get_config() const
+{
+ auto guard = std::lock_guard(_mutex);
+ return _cfg;
+}
+
}
diff --git a/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.h b/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.h
index c52b9b22245..ed2209d130a 100644
--- a/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.h
+++ b/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.h
@@ -123,7 +123,7 @@ private:
};
std::unique_ptr<ThreadTools> _thread_tools;
- std::mutex _mutex;
+ mutable std::mutex _mutex;
std::vector<Strand> _strands;
vespalib::ArrayQueue<Strand*> _wait_queue;
vespalib::ArrayQueue<Worker*> _worker_stack;
@@ -149,6 +149,7 @@ public:
void sync() override;
void setTaskLimit(uint32_t task_limit) override;
vespalib::ExecutorStats getStats() override;
+ Config get_config() const;
};
}
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 ff523b1e35d..1862de910ab 100644
--- a/staging_vespalib/src/vespa/vespalib/util/foreground_thread_executor.h
+++ b/staging_vespalib/src/vespa/vespalib/util/foreground_thread_executor.h
@@ -26,6 +26,7 @@ public:
return ExecutorStats(ExecutorStats::QueueSizeT(), _accepted.load(std::memory_order_relaxed), 0);
}
void setTaskLimit(uint32_t taskLimit) override { (void) taskLimit; }
+ uint32_t getTaskLimit() const override { return std::numeric_limits<uint32_t>::max(); }
void wakeup() override { }
};
diff --git a/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.cpp b/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.cpp
index d1c6b1aba53..b0c67e14c5b 100644
--- a/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.cpp
+++ b/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.cpp
@@ -123,4 +123,13 @@ SequencedTaskExecutor::getExecutorId(uint64_t componentId) const {
return ExecutorId(executorId);
}
+const vespalib::SyncableThreadExecutor*
+SequencedTaskExecutor::first_executor() const
+{
+ if (_executors->empty()) {
+ return nullptr;
+ }
+ return _executors->front().get();
+}
+
} // namespace search
diff --git a/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.h b/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.h
index 050b00ef011..496b183af8a 100644
--- a/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.h
+++ b/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.h
@@ -41,6 +41,8 @@ public:
*/
uint32_t getComponentHashSize() const { return _component2Id.size(); }
uint32_t getComponentEffectiveHashSize() const { return _nextId; }
+ const vespalib::SyncableThreadExecutor* first_executor() const;
+
private:
explicit SequencedTaskExecutor(std::unique_ptr<std::vector<std::unique_ptr<vespalib::SyncableThreadExecutor>>> executor);
diff --git a/staging_vespalib/src/vespa/vespalib/util/singleexecutor.h b/staging_vespalib/src/vespa/vespalib/util/singleexecutor.h
index 58cec52b2b0..721df3bf881 100644
--- a/staging_vespalib/src/vespa/vespalib/util/singleexecutor.h
+++ b/staging_vespalib/src/vespa/vespalib/util/singleexecutor.h
@@ -26,7 +26,9 @@ public:
SingleExecutor & sync() override;
void wakeup() override;
size_t getNumThreads() const override;
- uint32_t getTaskLimit() const { return _taskLimit.load(std::memory_order_relaxed); }
+ uint32_t getTaskLimit() const override { return _taskLimit.load(std::memory_order_relaxed); }
+ uint32_t get_watermark() const { return _watermark; }
+ duration get_reaction_time() const { return _reactionTime; }
Stats getStats() override;
SingleExecutor & shutdown() override;
private: