From c94d0c347fdbd8acc774df4ac17617a3f63e4507 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Sun, 9 Jul 2017 23:48:06 +0200 Subject: Delete old codebase This change removes version 1 of the OpenDC simulator codebase as it will be replaced by a complete rewrite in the Kotlin language. --- .../schedulers/ShortestRemainingTimeScheduler.h | 64 ---------------------- 1 file changed, 64 deletions(-) delete mode 100644 Simulator/include/simulation/schedulers/ShortestRemainingTimeScheduler.h (limited to 'Simulator/include/simulation/schedulers/ShortestRemainingTimeScheduler.h') diff --git a/Simulator/include/simulation/schedulers/ShortestRemainingTimeScheduler.h b/Simulator/include/simulation/schedulers/ShortestRemainingTimeScheduler.h deleted file mode 100644 index a152c39b..00000000 --- a/Simulator/include/simulation/schedulers/ShortestRemainingTimeScheduler.h +++ /dev/null @@ -1,64 +0,0 @@ -#pragma once -#include "Scheduler.h" -#include - -namespace Simulation -{ - class ShortestRemainingTimeScheduler : public Scheduler - { - protected: - ~ShortestRemainingTimeScheduler() - { - } - - public: - /** - * \brief Distribute workloads according to the srtf principle. - */ - void schedule(std::vector>& machines, std::vector workloads) override - { - if (workloads.size() == 0) - return; - - std::remove_if(workloads.begin(), workloads.end(), [](Workload* workload) { - return !workload->dependencyFinished; - }); - - for (auto workload : workloads) - { - workload->setCoresUsed(0); - } - - std::sort( - workloads.begin(), - workloads.end(), - [](Workload* a, Workload* b) -> bool { - return a->getRemainingOperations() < b->getRemainingOperations(); - } - ); - - int taskIndex = 0; - for (auto machine : machines) - { - machine.get().giveTask(workloads.at(taskIndex)); - - workloads.at(taskIndex)->setCoresUsed( - workloads.at(taskIndex)->getCoresUsed() + machine.get().getNumberOfCores() - ); - - if (!workloads.at(taskIndex)->isParallelizable()) - { - workloads.erase(workloads.begin() + taskIndex); - if (workloads.size() == 0) - break; - - taskIndex %= workloads.size(); - } - else - { - taskIndex = (++taskIndex) % workloads.size(); - } - } - } - }; -} -- cgit v1.2.3