Scheduler: ability to return the number of local workers
parent
eb7a6ff5ea
commit
07bc3a23fe
|
@ -400,6 +400,9 @@ public:
|
|||
/// Get the number of workers
|
||||
size_t getWorkerCount() const;
|
||||
|
||||
/// Get the number of local workers
|
||||
size_t getLocalWorkerCount() const;
|
||||
|
||||
/// Retrieve one of the workers by index
|
||||
Worker *getWorker(int index);
|
||||
|
||||
|
|
|
@ -99,6 +99,17 @@ size_t Scheduler::getWorkerCount() const {
|
|||
return count;
|
||||
}
|
||||
|
||||
size_t Scheduler::getLocalWorkerCount() const {
|
||||
size_t count = 0;
|
||||
m_mutex->lock();
|
||||
for (size_t i=0; i<m_workers.size(); ++i) {
|
||||
if (m_workers[i]->getClass() == LocalWorker::m_theClass)
|
||||
count++;
|
||||
}
|
||||
m_mutex->unlock();
|
||||
return count;
|
||||
}
|
||||
|
||||
bool Scheduler::isBusy() const {
|
||||
bool result;
|
||||
m_mutex->lock(); // make valgrind/helgrind happy
|
||||
|
|
Loading…
Reference in New Issue