-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemulator.h
More file actions
46 lines (38 loc) · 910 Bytes
/
emulator.h
File metadata and controls
46 lines (38 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//void verifyTimestamps()
template<typename T>
std::vector<T> getFor(int timestamp, std::queue<T>& stream)
{
std::vector<T> result;
while (!stream.empty())
{
const T& t = stream.front();
if (t.timestamp != timestamp)
break;
result.push_back(t);
stream.pop();
}
return result;
}
struct Emulator
{
void start();
private:
void readData();
void execute();
void executeStep();
void collectStatistics();
void outStatistics();
void outSchedule();
int timestamp = 0;
std::queue<ResourceTuple> resourcesStream;
std::queue<JobTuple> jobsStream;
std::vector<JobTuple> scheduled;
Scheduler scheduler;
std::map<int, std::vector<JobTuple>> jobsSchedule;
TimedDistribution workDoneDistrib;
TimedDistribution workDoneLatencyDistrib;
TimedDistribution resourceAllocatedLatencyDistrib;
// nodes
std::map<int, TimedDistribution> nodesDistrib;
TimedDistribution totalNodesDistrib;
};