36 const double threshold = 1.5;
37 size_t numProcesses = processQueue.size();
39 if (numProcesses == 0)
42 boost::chrono::nanoseconds maxElapsedTime = (*std::max_element(processQueue.begin(), processQueue.end(),
CompareElapsedTime))->GetElapsedTime();
48 boost::chrono::nanoseconds elapsedTime = process->
GetElapsedTime();
50 if (totalElapsedTime >= maxElapsedTime || totalElapsedTime + elapsedTime >= maxElapsedTime * threshold)
54 processQueue.erase(processQueue.begin());
55 processQueue.push_back(process);
boost::chrono::nanoseconds GetElapsedTime() const
~WeightedRoundRobinSchedulingAlgorithm()
static bool CompareElapsedTime(mitk::SchedulableProcess *lhs, mitk::SchedulableProcess *rhs)
void ResetTotalElapsedTime(boost::chrono::nanoseconds carryover=boost::chrono::nanoseconds::zero())
WeightedRoundRobinSchedulingAlgorithm()
SchedulableProcess * GetNextProcess(std::vector< SchedulableProcess * > &processQueue) override
boost::chrono::nanoseconds GetTotalElapsedTime() const