summaryrefslogtreecommitdiff
path: root/Simulator/include/simulation/schedulers/FirstInFirstOutScheduler.h
diff options
context:
space:
mode:
authorMatthijs Bijman <matthijs@bijman.org>2017-02-27 13:55:50 +0100
committerMatthijs Bijman <matthijs@bijman.org>2017-02-27 13:55:50 +0100
commitcc5c5a7eac0ebcf97c283e1e0dd1674c855a261a (patch)
tree841f95e14a00cb6d23d4e357c9e0cfcbdc3c9a2a /Simulator/include/simulation/schedulers/FirstInFirstOutScheduler.h
parent0709a81231b695caecb2269fe23d8dadeb764892 (diff)
Implement logging of cores_used in task_states
Diffstat (limited to 'Simulator/include/simulation/schedulers/FirstInFirstOutScheduler.h')
-rw-r--r--Simulator/include/simulation/schedulers/FirstInFirstOutScheduler.h25
1 files changed, 16 insertions, 9 deletions
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<std::reference_wrapper<Modeling::Machine>>& machines, std::vector<Workload*> 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<Modeling::Machine>& 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()
+ );
+ }
}
};
}