.
This commit is contained in:
@@ -35,28 +35,32 @@ void JustInTimeScheduler::_notifyWEPUpdate(SchedulerBase::WepMapEntry& wepe, std
|
||||
wfs::AtomicActivityImplementation* fastestImpl = nullptr;
|
||||
resource::ComputingResource* fastestRes = nullptr;
|
||||
prediction::ExecutionTimeResult fastestPred;
|
||||
double minEFT = -1;
|
||||
|
||||
for (auto restype : resourceTypes) {
|
||||
resource::ComputingResource* freeRes = nullptr;
|
||||
for (auto res : restype->getResources()) {
|
||||
if (res->getFreeSlotCount() > 0) {
|
||||
freeRes = res;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (freeRes) {
|
||||
auto& aat = ai.baseActivity.baseTemplate.as<wfs::AtomicActivityTemplate>();
|
||||
for (auto impl : aat.atomicActivityType->getImplementations()) {
|
||||
auto execPred = predictionManager.predictExecutionTime(ai, *impl, *restype);
|
||||
if (execPred.isValid()) {
|
||||
if (!fastestImpl || !fastestPred.isValid() || execPred.executionTime.getValue() < fastestPred.executionTime.getValue()) {
|
||||
fastestImpl = impl;
|
||||
fastestRes = freeRes;
|
||||
fastestPred = execPred;
|
||||
}
|
||||
wfs::AtomicActivityImplementation* bestImpl = nullptr;
|
||||
prediction::ExecutionTimeResult bestPred;
|
||||
auto& aat = ai.baseActivity.baseTemplate.as<wfs::AtomicActivityTemplate>();
|
||||
for (auto impl : aat.atomicActivityType->getImplementations()) {
|
||||
auto execPred = predictionManager.predictExecutionTime(ai, *impl, *restype);
|
||||
if (execPred.isValid()) {
|
||||
if (!bestImpl || !bestPred.isValid() || execPred.executionTime.getValue() < bestPred.executionTime.getValue()) {
|
||||
bestImpl = impl;
|
||||
bestPred = execPred;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto res : restype->getResources()) {
|
||||
auto eft = _getResourceEstimatedAvailableTime(res) + bestPred.executionTime.getValue();
|
||||
if (minEFT < 0 || eft < minEFT) {
|
||||
minEFT = eft;
|
||||
fastestImpl = bestImpl;
|
||||
fastestRes = res;
|
||||
fastestPred = bestPred;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fastestImpl) {
|
||||
auto reservation = resourceManager.reserveComputingResource(fastestRes, 1, false);
|
||||
auto sd = std::make_shared<SchedulingDecision>(&ai, fastestImpl, wepe.wep, reservation);
|
||||
|
||||
Reference in New Issue
Block a user