-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
89 lines (74 loc) · 3.21 KB
/
Copy pathmain.cpp
File metadata and controls
89 lines (74 loc) · 3.21 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <iostream>
#include <iomanip>
#include <vector>
#include <ctime>
#include <queue>
#include <cmath>
#include <list>
#include "constant_values.h"
#include "taskpool.h"
#include "rdq.h"
#include "dpdvfs.h"
#include "greedydvfs.h"
#include "nodvfs.h"
#include "utility_functions.h"
using namespace std;
int main(){
double t = 0.0;
double t_delta = 0.0001;
srand(time(NULL));
taskpool itaskpool;
itaskpool.gen(NUM_TOTAL_TASK);
//itaskpool.show();
rdq irdq;
showStateEfficiencies();
system("PAUSE");
while(irdq.isEmpty() == false || itaskpool.getCursor() < itaskpool.getPoolSize()){
t += t_delta;
while(itaskpool.getCursor() < itaskpool.getPoolSize() && t >= itaskpool.getCursorTaskArrivalTime()){
irdq.push(itaskpool.getCursorTask());
//cout << "At time: " << setw(8) << setprecision(7) <<t << ", pushed task id = " << itaskpool.getCursorTask()->id << " into RDQ." << endl;
itaskpool.incCursor();
}
// all tasks in the pool is now in the RDQ
if(irdq.getSize() == itaskpool.getPoolSize()){
double total_energy;
int total_miss;
double total_miss_time, miss_ratio;
vector<int> voltages_assigned;
cout << "DPDVFS: " << endl;
voltages_assigned = dpdvfs_schedule(irdq);
total_energy = getTotalEnergy(irdq, voltages_assigned);
cout << "Under this schedule the total energy is " << total_energy << endl;
total_miss = getTotalDeadlineMiss(irdq, voltages_assigned);
cout << "Under this schedule the total deadline miss is " << total_miss << endl;
total_miss_time = getTotalDeadlineMissLength(irdq, voltages_assigned);
cout << "Under this schedule the total deadline miss time is " << total_miss_time << endl;
miss_ratio = getTotalDeadlineMissRatio(irdq, voltages_assigned);
cout << "Under this schedule the total deadline miss time ratio is " << miss_ratio << endl;
cout << "GREEDYDVFS: " << endl;
voltages_assigned = greedydvfs_schedule(irdq);
total_energy = getTotalEnergy(irdq, voltages_assigned);
cout << "Under this schedule the total energy is " << total_energy << endl;
total_miss = getTotalDeadlineMiss(irdq, voltages_assigned);
cout << "Under this schedule the total deadline miss is " << total_miss << endl;
total_miss_time = getTotalDeadlineMissLength(irdq, voltages_assigned);
cout << "Under this schedule the total deadline miss time is " << total_miss_time << endl;
miss_ratio = getTotalDeadlineMissRatio(irdq, voltages_assigned);
cout << "Under this schedule the total deadline miss time ratio is " << miss_ratio << endl;
cout << "NODVFS: " << endl;
voltages_assigned = nodvfs_schedule(irdq);
total_energy = getTotalEnergy(irdq, voltages_assigned);
cout << "Under this schedule the total energy is " << total_energy << endl;
total_miss = getTotalDeadlineMiss(irdq, voltages_assigned);
cout << "Under this schedule the total deadline miss is " << total_miss << endl;
total_miss_time = getTotalDeadlineMissLength(irdq, voltages_assigned);
cout << "Under this schedule the total deadline miss time is " << total_miss_time << endl;
miss_ratio = getTotalDeadlineMissRatio(irdq, voltages_assigned);
cout << "Under this schedule the total deadline miss time ratio is " << miss_ratio << endl;
break;
}
}
//irdq.show();
return 0;
}