Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/dagSched/evaluate.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ void evaluate(const std::string& genparams_path, const std::string& output_fig_p
sched_res["Fonseca2019"][test_idx] += GP_FP_FTP_Fonseca2019(task_set, m);
time_res["Fon2019"].push_back(timer.toc());

timer.tic();

sched_res["Nasri2019"][test_idx] += G_LP_FTP_Nasri2019_C(task_set, m);
time_res["Nas2019"].push_back(timer.toc());
time_res["Nas2019"].push_back(get_Nasri2019_runtime());

timer.tic();
sched_res["He2019"][test_idx] += GP_FP_FTP_He2019_C(task_set, m);
Expand Down
1 change: 1 addition & 0 deletions include/dagSched/tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ bool P_LP_FTP_Casini2018_C(Taskset taskset, const int m);
bool P_LP_FTP_Casini2018_C_withAssignment(Taskset taskset, const int m, const PartitioningCoresOrder_t c_order);

bool G_LP_FTP_Nasri2019_C(Taskset taskset, const int m);
double get_Nasri2019_runtime();

#ifdef ZAHAF2019
bool P_LP_EDF_Zahaf2019_C(const Taskset& taskset, const int m);
Expand Down
79 changes: 53 additions & 26 deletions src/tests/Nasri2019.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

namespace dagSched{

double nasri2019_runtime = 0;

bool test(std::istream &in,
std::istream &dag_in,
std::istream &aborts_in, const int m){
Expand All @@ -31,6 +33,9 @@ bool test(std::istream &in,
// Actually call the analysis engine
auto space = NP::Global::State_space<dtime_t>::explore(problem, opts);

// get CPU time of the analysis
nasri2019_runtime = space.get_cpu_time();

// Extract the analysis results
// auto graph = std::ostringstream();
// auto rta = std::ostringstream();
Expand All @@ -51,40 +56,57 @@ bool test(std::istream &in,
}

std::string convertTasksetToCsv(Taskset& taskset){

// get the hyperperiod
auto hp = taskset.getHyperPeriod();
std::string task_set = " Task ID, Job ID, Arrival min, Arrival max, Cost min, Cost max, Deadline, Priority\n";
for(int x=0; x<taskset.tasks.size();++x){
std::vector<SubTask*> V = taskset.tasks[x].getVertices();
// taskset.tasks[x].computeEFTs();
// taskset.tasks[x].computeLSTs();

for(int i=0; i<V.size(); ++i){
task_set += std::to_string(x) + //Task ID
", " + std::to_string(i) + //Job ID
", 0 " + //Release min
", 0 " + //Release max
", " + std::to_string((int)V[i]->c) + //Cost min
", " + std::to_string((int)V[i]->c) + //Cost max
", " + std::to_string((int)taskset.tasks[x].getDeadline()) + //Deadline
", " + std::to_string((int)taskset.tasks[x].getDeadline()) + "\n"; //Priority

}
}

// the task set should be unfolded to a job set in the hyperperiod
for(int x=0; x<taskset.tasks.size();++x) {
// generate jobs of each task in the hyperperiod
for (auto index = 0; index * taskset.tasks[x].getPeriod() < hp; ++index) {
// calculate the arrival min and max
auto arrival_min = long(index * taskset.tasks[x].getPeriod());
// for now, we consider that there is no jitter
auto arrival_max = long(index * taskset.tasks[x].getPeriod());

std::vector<SubTask *> V = taskset.tasks[x].getVertices();
for (int i = 0; i < V.size(); ++i) {
task_set += std::to_string(x) + //Task ID
", " + std::to_string(i + index) + //Job ID
", " + std::to_string(arrival_min) + //Release min
", " + std::to_string(arrival_max) + //Release max
", " + std::to_string(0) + //Cost min
", " + std::to_string((int) V[i]->c) + //Cost max
", " + std::to_string((int) (arrival_min + taskset.tasks[x].getDeadline())) +
//absolute Deadline
//", " + std::to_string((int) (arrival_min + taskset.tasks[x].getDeadline())) +
//"\n"; //Priority (EDF)
", " + std::to_string((int) (taskset.tasks[x].getPeriod())) + "\n"; //Priority (RM)
}
}
}

return task_set;

}

std::string convertDAGsToCsv(const Taskset& taskset){
// get the hyperperiod
auto hp = taskset.getHyperPeriod();
std::string prec = "Predecessor TID, Predecessor JID, Successor TID, Successor JID\n";
for(int x=0; x<taskset.tasks.size();++x){
std::vector<SubTask*> V = taskset.tasks[x].getVertices();
for(int i=0; i<V.size(); ++i){
for(int j=0; j<V[i]->succ.size(); ++j){
prec = prec + std::to_string(x) + ", " + std::to_string(i) + ", " + std::to_string(x) + ", " + std::to_string(V[i]->succ[j]->id) + "\n";
}
}
}
for (int x = 0; x < taskset.tasks.size(); ++x) {
// generate jobs of each task in the hyperperiod
for (auto index = 0; index * taskset.tasks[x].getPeriod() < hp; ++index) {
std::vector<SubTask *> V = taskset.tasks[x].getVertices();
for (int i = 0; i < V.size(); ++i) {
for (int j = 0; j < V[i]->succ.size(); ++j) {
prec = prec + std::to_string(x) + ", " + std::to_string(i + index) + ", " + std::to_string(x) +
", " + std::to_string(V[i]->succ[j]->id + index) + "\n";
}
}

}
}

return prec;
}
Expand Down Expand Up @@ -128,4 +150,9 @@ bool G_LP_FTP_Nasri2019_C(Taskset taskset, const int m){
return test(in, dag_in, aborts_in, m);
}

double get_Nasri2019_runtime(){
// convert from seconds to microseconds
return nasri2019_runtime * 1000000;
}

}