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. --- Simulator/src/simulation/workloads/Workload.cpp | 60 ------------------- .../src/simulation/workloads/WorkloadPool.cpp | 70 ---------------------- 2 files changed, 130 deletions(-) delete mode 100644 Simulator/src/simulation/workloads/Workload.cpp delete mode 100644 Simulator/src/simulation/workloads/WorkloadPool.cpp (limited to 'Simulator/src/simulation') diff --git a/Simulator/src/simulation/workloads/Workload.cpp b/Simulator/src/simulation/workloads/Workload.cpp deleted file mode 100644 index f8fe1444..00000000 --- a/Simulator/src/simulation/workloads/Workload.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "simulation/workloads/Workload.h" - -namespace Simulation -{ - Workload::Workload(int size, int startTick, int dbId, int traceId, int dependency, bool parallel) : dependencyId(dependency), remainingFlops(size), TOTAL_FLOPS(size), START_TICK(startTick), ID(dbId), TRACE_ID(traceId), isParallel(parallel) {} - - void Workload::doOperations(uint32_t opCount) - { - if (opCount < 0 || finished) return; - - if (remainingFlops <= opCount) - { - remainingFlops = 0; - finished = true; - } - else - { - remainingFlops -= opCount; - } - } - - uint32_t Workload::getRemainingOperations() const - { - return remainingFlops; - } - - uint32_t Workload::getTotalOperations() const - { - return TOTAL_FLOPS; - } - - bool Workload::isFinished() const - { - return this->finished; - } - uint32_t Workload::getId() const - { - return ID; - } - - int Workload::getDependencyId() const - { - return this->dependencyId; - } - - void Workload::setCoresUsed(uint32_t cores) - { - this->coresUsed = cores; - } - - uint32_t Workload::getCoresUsed() - { - return coresUsed; - } - - bool Workload::isParallelizable() - { - return isParallel; - } -} diff --git a/Simulator/src/simulation/workloads/WorkloadPool.cpp b/Simulator/src/simulation/workloads/WorkloadPool.cpp deleted file mode 100644 index 251dcb9a..00000000 --- a/Simulator/src/simulation/workloads/WorkloadPool.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "simulation/workloads/WorkloadPool.h" -#include "simulation/workloads/Workload.h" - -#include -#include - -namespace Simulation -{ - void WorkloadPool::addWorkload(Workload w) - { - workloads.push_back(w); - } - - std::vector WorkloadPool::getWorkloads(uint32_t currentTick) - { - std::vector filteredOnStarted; - for(Workload& w : workloads) - { - if(w.getStartTick() < currentTick) - filteredOnStarted.push_back(&w); - } - - return filteredOnStarted; - } - - Workload& WorkloadPool::getWorkload(int id) - { - auto it = std::find_if(workloads.begin(), workloads.end(), [id](Workload& w) { - return (id == w.getId()); - }); - - return *it; - } - - void WorkloadPool::clearFinishedWorkloads() - { - auto it = workloads.begin(); - while(it != workloads.end()) - { - if(it->isFinished()) - { - std::cout << "Finished workload " << it->getId() << std::endl; - int id = it->getId(); - setDependenciesFinished(id); - it = workloads.erase(it); - } - else - { - ++it; - } - } - } - - void WorkloadPool::setDependenciesFinished(int id) - { - for(auto& workload : workloads) - { - if(workload.getDependencyId() == id) - { - workload.dependencyFinished = true; - std::cout << "Finished dependency of " << workload.getId() << std::endl; - } - } - } - - bool WorkloadPool::isEmpty() - { - return this->workloads.size() == 0; - } -} -- cgit v1.2.3