diff --git a/include/mitsuba/core/sched.h b/include/mitsuba/core/sched.h index a5c71327..dc350dea 100644 --- a/include/mitsuba/core/sched.h +++ b/include/mitsuba/core/sched.h @@ -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); diff --git a/src/libcore/sched.cpp b/src/libcore/sched.cpp index 2e8123e6..415cba48 100644 --- a/src/libcore/sched.cpp +++ b/src/libcore/sched.cpp @@ -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; igetClass() == LocalWorker::m_theClass) + count++; + } + m_mutex->unlock(); + return count; +} + bool Scheduler::isBusy() const { bool result; m_mutex->lock(); // make valgrind/helgrind happy