summaryrefslogtreecommitdiff
path: root/Simulator/include/simulation/history
diff options
context:
space:
mode:
Diffstat (limited to 'Simulator/include/simulation/history')
-rw-r--r--Simulator/include/simulation/history/History.h43
-rw-r--r--Simulator/include/simulation/history/MachineSnapshot.h17
-rw-r--r--Simulator/include/simulation/history/SimulationHistory.h81
-rw-r--r--Simulator/include/simulation/history/WorkloadSnapshot.h14
4 files changed, 0 insertions, 155 deletions
diff --git a/Simulator/include/simulation/history/History.h b/Simulator/include/simulation/history/History.h
deleted file mode 100644
index f1d826eb..00000000
--- a/Simulator/include/simulation/history/History.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#pragma once
-#include <stdint.h>
-#include <map>
-
-namespace Simulation {
- template<typename Type>
- class History {
- public:
- void addSnapshotAtTick(uint32_t tick, Type snapshot)
- {
- history.insert(std::make_pair(tick, snapshot));
- }
-
- const auto& snapshotsAtTick(uint32_t tick)
- {
- return history.equal_range(tick);
- }
-
- typename std::unordered_map<uint32_t, Type>::const_iterator begin()
- {
- return history.begin();
- }
-
- typename std::unordered_map<uint32_t, Type>::const_iterator end()
- {
- return history.end();
- }
-
- void clear()
- {
- history.clear();
- }
-
- size_t size()
- {
- return history.size();
- }
-
- private:
- // Maps ticks to histories of workloads
- std::unordered_multimap<uint32_t, Type> history;
- };
-} \ No newline at end of file
diff --git a/Simulator/include/simulation/history/MachineSnapshot.h b/Simulator/include/simulation/history/MachineSnapshot.h
deleted file mode 100644
index 49ce1313..00000000
--- a/Simulator/include/simulation/history/MachineSnapshot.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#pragma once
-
-namespace Simulation {
- /*
- POD class that represents the state of a machine.
- */
- class MachineSnapshot {
- public:
- MachineSnapshot(int id, int currentWorkload, float temp, float load, uint32_t mem) : id(id), currentWorkload(currentWorkload), temperature(temp), loadFraction(load), usedMemory(mem) {}
-
- int id;
- int currentWorkload;
- float temperature;
- float loadFraction;
- uint32_t usedMemory;
- };
-} \ No newline at end of file
diff --git a/Simulator/include/simulation/history/SimulationHistory.h b/Simulator/include/simulation/history/SimulationHistory.h
deleted file mode 100644
index f43968b7..00000000
--- a/Simulator/include/simulation/history/SimulationHistory.h
+++ /dev/null
@@ -1,81 +0,0 @@
-#pragma once
-#include "History.h"
-#include "WorkloadSnapshot.h"
-#include "MachineSnapshot.h"
-
-#include <unordered_map>
-
-namespace Simulation
-{
- using WorkloadHistory = History<WorkloadSnapshot>;
- using MachineHistory = History<MachineSnapshot>;
- using HistoryRef = std::tuple<std::reference_wrapper<WorkloadHistory>, std::reference_wrapper<MachineHistory>>;
-
- class SimulationHistory
- {
- public:
- /*
- Adds the workload snapshot at the given tick.
- */
- void addSnapshot(uint32_t tick, WorkloadSnapshot snapshots)
- {
- workloadHistory.addSnapshotAtTick(tick, snapshots);
- }
-
- /*
- Adds the machine snapshot at the given tick.
- */
- void addSnapshot(uint32_t tick, MachineSnapshot snapshots)
- {
- machineHistory.addSnapshotAtTick(tick, snapshots);
- }
-
- /*
- Returns the equal_range of the workload snapshots at the given tick.
- */
- auto getWorkloadSnapshot(uint32_t tick)
- {
- return workloadHistory.snapshotsAtTick(tick);
- }
-
- /*
- Returns the equal_range of the machine snapshots at the given tick.
- */
- auto getMachineSnapshot(uint32_t tick)
- {
- return machineHistory.snapshotsAtTick(tick);
- }
-
- /*
- Returns a const tuple ref of the entire cached history of machines and workloads.
- */
- const HistoryRef getHistory()
- {
- return std::make_tuple(
- std::ref(workloadHistory),
- std::ref(machineHistory)
- );
- }
-
- /*
- Clears the cache of history.
- */
- void clearHistory()
- {
- workloadHistory.clear();
- machineHistory.clear();
- }
-
- /*
- Returns the number of snapshots that are in the history cache.
- */
- size_t historySize()
- {
- return workloadHistory.size();
- }
-
- private:
- WorkloadHistory workloadHistory;
- MachineHistory machineHistory;
- };
-} \ No newline at end of file
diff --git a/Simulator/include/simulation/history/WorkloadSnapshot.h b/Simulator/include/simulation/history/WorkloadSnapshot.h
deleted file mode 100644
index 30a93898..00000000
--- a/Simulator/include/simulation/history/WorkloadSnapshot.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#pragma once
-
-namespace Simulation
-{
- class WorkloadSnapshot
- {
- public:
- WorkloadSnapshot(uint32_t id, uint32_t flopsDone, uint32_t coresUsed) : flopsDone(flopsDone), id(id), coresUsed(coresUsed) {}
-
- uint32_t flopsDone;
- uint32_t id;
- uint32_t coresUsed;
- };
-} \ No newline at end of file