From cb6e1141f31eac6fac2a0d41744b2df5dbc98147 Mon Sep 17 00:00:00 2001 From: Ethan Mahintorabi Date: Tue, 4 Nov 2025 14:23:30 +0000 Subject: [PATCH] util: Add method to get thread count from dispatch queue I'm looking to try to have unified thread pool with OpenSTA and OpenROAD and having this method would make it easier to understand how much parallelism is available in the pool. Signed-off-by: Ethan Mahintorabi --- include/sta/DispatchQueue.hh | 1 + util/DispatchQueue.cc | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/sta/DispatchQueue.hh b/include/sta/DispatchQueue.hh index a8f6d60ef..f28d94c5e 100644 --- a/include/sta/DispatchQueue.hh +++ b/include/sta/DispatchQueue.hh @@ -24,6 +24,7 @@ public: DispatchQueue(size_t thread_cnt); ~DispatchQueue(); void setThreadCount(size_t thread_count); + size_t getThreadCount() const; // Dispatch and copy. void dispatch(const fp_t& op); // Dispatch and move. diff --git a/util/DispatchQueue.cc b/util/DispatchQueue.cc index c5f85e620..4e828c23a 100644 --- a/util/DispatchQueue.cc +++ b/util/DispatchQueue.cc @@ -49,6 +49,12 @@ DispatchQueue::setThreadCount(size_t thread_count) } } +size_t +DispatchQueue::getThreadCount() const +{ + return threads_.size(); +} + void DispatchQueue::finishTasks() {