From cc5c5a7eac0ebcf97c283e1e0dd1674c855a261a Mon Sep 17 00:00:00 2001 From: Matthijs Bijman Date: Mon, 27 Feb 2017 13:55:50 +0100 Subject: Implement logging of cores_used in task_states --- .../schedulers/FirstInFirstOutScheduler.h | 25 ++++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'Simulator/include/simulation/schedulers/FirstInFirstOutScheduler.h') diff --git a/Simulator/include/simulation/schedulers/FirstInFirstOutScheduler.h b/Simulator/include/simulation/schedulers/FirstInFirstOutScheduler.h index 0cac0dfa..797eb489 100644 --- a/Simulator/include/simulation/schedulers/FirstInFirstOutScheduler.h +++ b/Simulator/include/simulation/schedulers/FirstInFirstOutScheduler.h @@ -12,8 +12,8 @@ namespace Simulation } public: - /* - Distribute workloads according to the FIFO principle + /** + * \brief Distribute workloads according to the FIFO principle. */ void schedule(std::vector>& machines, std::vector workloads) override { @@ -25,13 +25,20 @@ namespace Simulation while(!workloads.at(index)->dependencyFinished) index = (++index) % workloads.size(); - std::for_each( - machines.begin(), - machines.end(), - [index, &workloads](std::reference_wrapper& machine) { - machine.get().giveTask(workloads.at(index)); - } - ); + // Reset the number of cores used for each workload + for (auto workload : workloads) + { + workload->setCoresUsed(0); + } + + // Distribute tasks across machines and set cores used of workloads + for (auto machine : machines) + { + machine.get().giveTask(workloads.at(index)); + workloads.at(index)->setCoresUsed( + workloads.at(index)->getCoresUsed() + machine.get().getNumberOfCores() + ); + } } }; } -- cgit v1.2.3