summaryrefslogtreecommitdiff
path: root/Simulator/include/modeling/machine/Machine.h
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2017-07-09 23:48:06 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2017-07-09 23:48:06 +0200
commitc94d0c347fdbd8acc774df4ac17617a3f63e4507 (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904 /Simulator/include/modeling/machine/Machine.h
parentbc4c41e21a64b444bdbab3b6d1d407fd5d919419 (diff)
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.
Diffstat (limited to 'Simulator/include/modeling/machine/Machine.h')
-rw-r--r--Simulator/include/modeling/machine/Machine.h117
1 files changed, 0 insertions, 117 deletions
diff --git a/Simulator/include/modeling/machine/Machine.h b/Simulator/include/modeling/machine/Machine.h
deleted file mode 100644
index f18f8352..00000000
--- a/Simulator/include/modeling/machine/Machine.h
+++ /dev/null
@@ -1,117 +0,0 @@
-#pragma once
-#include "simulation/workloads/Workload.h"
-#include "modeling/machine/CPU.h"
-#include "modeling/machine/GPU.h"
-
-#include <stdint.h>
-#include <vector>
-#include <memory>
-
-namespace Modeling
-{
- // Defines the initial temperature of machine
- constexpr float ROOM_TEMPERATURE_CELCIUS = 23.0f;
-
- // Defines the usage of memory by the kernel
- constexpr uint32_t KERNEL_MEMORY_USAGE_MB = 50;
-
- /*
- The Machine class models a physical machine in a rack. It has a speed, and can be given a workload on which it will work until finished or interrupted.
- */
- class Machine
- {
- public:
- /*
- Initializes the machine as idle with the given speed.
- */
- Machine(int id);
-
- /*
- Adds a cpu to the list of this machine.
- */
- void addCPU(CPU cpu);
-
- /*
- Adds a cpu to the list of this machine.
- */
- void addGPU(GPU gpu);
-
- /*
- Gives the task to this machine. If the machine is already busy this does nothing.
- */
- void giveTask(Simulation::Workload* workload);
-
- /*
- Returns true if the machine is busy.
- */
- bool isBusy() const;
-
- /*
- Does work on the given task and updates temperature and load appropriately.
- */
- void work();
-
- /*
- Returns the id of the current workload of this machine.
- */
- int getWorkloadId() const;
-
- /*
- Returns the id of this machine.
- */
- int getId() const;
-
- /*
- Returns the temperature of this machine.
- */
- float getTemperature() const;
-
- /*
- Returns the memory used by this machine.
- */
- int getMemory() const;
-
- /*
- Returns the load fraction on this machine.
- */
- float getLoad() const;
-
- /**
- * \return The number of cores in this machine.
- */
- uint32_t getNumberOfCores() const;
-
- private:
- // A list of cpus in this machine.
- std::vector<CPU> cpus;
-
- // A list of gpus in this machine.
- std::vector<GPU> gpus;
-
- // True if the machine is working on a task.
- bool busy = false;
-
- // The current workload the machine is working on.
- Simulation::Workload* currentWorkload;
-
- // Db id of this machine.
- int id;
-
- // Temperature of this machine.
- float temperature = ROOM_TEMPERATURE_CELCIUS;
- float maxTemperature = 80.0f;
- float minTemperature = 0.0f;
- float temperatureIncrease = 10.f;
-
- // Memory used by this machine.
- int memory = KERNEL_MEMORY_USAGE_MB;
-
- // The fraction of load on this machine.
- float load = 0.0f;
-
- /*
- Returns the speed of the machine.
- */
- uint32_t getSpeed();
- };
-}