Scheduler: ability to return the number of local workers
parent
eb7a6ff5ea
commit
07bc3a23fe
|
@ -400,6 +400,9 @@ public:
|
||||||
/// Get the number of workers
|
/// Get the number of workers
|
||||||
size_t getWorkerCount() const;
|
size_t getWorkerCount() const;
|
||||||
|
|
||||||
|
/// Get the number of local workers
|
||||||
|
size_t getLocalWorkerCount() const;
|
||||||
|
|
||||||
/// Retrieve one of the workers by index
|
/// Retrieve one of the workers by index
|
||||||
Worker *getWorker(int index);
|
Worker *getWorker(int index);
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,17 @@ size_t Scheduler::getWorkerCount() const {
|
||||||
return count;
|
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 Scheduler::isBusy() const {
|
||||||
bool result;
|
bool result;
|
||||||
m_mutex->lock(); // make valgrind/helgrind happy
|
m_mutex->lock(); // make valgrind/helgrind happy
|
||||||
|
|
Loading…
Reference in New Issue