-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot.cpp
63 lines (53 loc) · 1.83 KB
/
plot.cpp
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
#include <iostream>
#include <fstream>
#include <vector>
#include "task.hpp"
#include "adj_list.hpp"
#include "schedule.hpp"
int main(int argc, const char *argv[]) {
if (argc <= 1) {
std::cout << "usage: plot_data [LIST OF TASKS]" << std::endl;
return 1;
}
std::ifstream task_data;
std::ofstream plot_data("energy-plot", std::ios::out);
for (int i = 1; i < argc; ++i) {
task_data.open(argv[i], std::ios::in);
if (! task_data.is_open()) {
std::cerr << "Could not open task file!" << std::endl;
continue;
}
std::cout << "Opened " << argv[i] << std::endl;
std::cout << "Reading File...";
std::vector<task> tasks = read_tasks(task_data);
std::vector<edge> edges = read_edges(task_data);
task_data.close();
adj_list graph = list_from_edges(edges, tasks.size());
std::cout << "done." << std::endl;
std::cout << "Generating LTF...";
schedule ltf = ltf_schedule(tasks, graph);
std::cout << "done." << std::endl;
std::cout << "Generating LTF (contingency)...";
schedule ltf_cs = contingency_schedule(ltf);
std::cout << "done." << std::endl;
std::cout << "Generating LTF-US...";
schedule ltf_us = uniform_scale(ltf, ltf_cs);
std::cout << "done." << std::endl;
std::cout << "Generating TBLS...";
schedule tbls = tbls_schedule(tasks, graph);
std::cout << "done." << std::endl;
std::cout << "Generating TBLS (contingency)...";
schedule tbls_cs = contingency_schedule(tbls);
std::cout << "done." << std::endl;
std::cout << "Generating LTF-US...";
schedule tbls_us = uniform_scale(tbls, tbls_cs);
std::cout << "done." << std::endl;
plot_data << ltf.utilization() << " " << ltf.energy() << " "
<< ltf_us.energy() << " "
<< tbls.energy() << " "
<< tbls_us.energy() << std::endl;
task_data.close();
}
plot_data.close();
return 0;
}