util: Add method to get thread count from dispatch queue (#324)

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 <ethanmoon@google.com>
This commit is contained in:
Ethan Mahintorabi 2025-12-12 15:49:22 -08:00 committed by GitHub
parent 3bda441305
commit 7ac4a47db1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -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.

View File

@ -49,6 +49,12 @@ DispatchQueue::setThreadCount(size_t thread_count)
}
}
size_t
DispatchQueue::getThreadCount() const
{
return threads_.size();
}
void
DispatchQueue::finishTasks()
{