From 47736fb1eaa4554585cd423f70b4f812796cf909 Mon Sep 17 00:00:00 2001 From: porya-gohary Date: Tue, 11 Mar 2025 11:32:19 +0100 Subject: [PATCH 1/4] Bug fixes in the unfolding task set to a job set --- src/tests/Nasri2019.cpp | 69 +++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/src/tests/Nasri2019.cpp b/src/tests/Nasri2019.cpp index c371919..5f824f7 100644 --- a/src/tests/Nasri2019.cpp +++ b/src/tests/Nasri2019.cpp @@ -51,40 +51,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 V = taskset.tasks[x].getVertices(); - // taskset.tasks[x].computeEFTs(); - // taskset.tasks[x].computeLSTs(); - - for(int i=0; ic) + //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 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((int) V[i]->c) + //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 V = taskset.tasks[x].getVertices(); - for(int i=0; isucc.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 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; } From b885523e2e9076c29eb6fc858a315a96905322e5 Mon Sep 17 00:00:00 2001 From: porya-gohary Date: Tue, 11 Mar 2025 11:38:30 +0100 Subject: [PATCH 2/4] Replacing wall clock time with actual cpu time of the analysis and excluding unfolding time --- include/dagSched/evaluate.h | 4 ++-- src/tests/Nasri2019.cpp | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/dagSched/evaluate.h b/include/dagSched/evaluate.h index 5da4b56..3f4b670 100644 --- a/include/dagSched/evaluate.h +++ b/include/dagSched/evaluate.h @@ -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(G_LP_FTP_Nasri2019_C.get_runtime()); timer.tic(); sched_res["He2019"][test_idx] += GP_FP_FTP_He2019_C(task_set, m); diff --git a/src/tests/Nasri2019.cpp b/src/tests/Nasri2019.cpp index 5f824f7..52c243a 100644 --- a/src/tests/Nasri2019.cpp +++ b/src/tests/Nasri2019.cpp @@ -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){ @@ -31,6 +33,9 @@ bool test(std::istream &in, // Actually call the analysis engine auto space = NP::Global::State_space::explore(problem, opts); + // get CPU time of the analysis + runtime = space.get_cpu_time(); + // Extract the analysis results // auto graph = std::ostringstream(); // auto rta = std::ostringstream(); @@ -145,4 +150,8 @@ bool G_LP_FTP_Nasri2019_C(Taskset taskset, const int m){ return test(in, dag_in, aborts_in, m); } +double get_runtime(){ + return nasri2019_runtime; +} + } \ No newline at end of file From c62b3cdd95ec3a2de8111764d201385575829afa Mon Sep 17 00:00:00 2001 From: porya-gohary Date: Tue, 11 Mar 2025 13:12:29 +0100 Subject: [PATCH 3/4] minor change --- include/dagSched/evaluate.h | 2 +- include/dagSched/tests.h | 1 + src/tests/Nasri2019.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/dagSched/evaluate.h b/include/dagSched/evaluate.h index 3f4b670..b02b25f 100644 --- a/include/dagSched/evaluate.h +++ b/include/dagSched/evaluate.h @@ -150,7 +150,7 @@ void evaluate(const std::string& genparams_path, const std::string& output_fig_p sched_res["Nasri2019"][test_idx] += G_LP_FTP_Nasri2019_C(task_set, m); - time_res["Nas2019"].push_back(G_LP_FTP_Nasri2019_C.get_runtime()); + time_res["Nas2019"].push_back(get_Nasri2019_runtime()); timer.tic(); sched_res["He2019"][test_idx] += GP_FP_FTP_He2019_C(task_set, m); diff --git a/include/dagSched/tests.h b/include/dagSched/tests.h index 717309c..8af0e00 100644 --- a/include/dagSched/tests.h +++ b/include/dagSched/tests.h @@ -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); diff --git a/src/tests/Nasri2019.cpp b/src/tests/Nasri2019.cpp index 52c243a..7c6f4e1 100644 --- a/src/tests/Nasri2019.cpp +++ b/src/tests/Nasri2019.cpp @@ -8,7 +8,7 @@ namespace dagSched{ - double nasri2019_runtime = 0; +double nasri2019_runtime = 0; bool test(std::istream &in, std::istream &dag_in, @@ -34,7 +34,7 @@ bool test(std::istream &in, auto space = NP::Global::State_space::explore(problem, opts); // get CPU time of the analysis - runtime = space.get_cpu_time(); + nasri2019_runtime = space.get_cpu_time(); // Extract the analysis results // auto graph = std::ostringstream(); @@ -75,7 +75,7 @@ std::string convertTasksetToCsv(Taskset& taskset){ ", " + std::to_string(i + index) + //Job ID ", " + std::to_string(arrival_min) + //Release min ", " + std::to_string(arrival_max) + //Release max - ", " + std::to_string((int) V[i]->c) + //Cost min + ", " + 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 @@ -150,7 +150,7 @@ bool G_LP_FTP_Nasri2019_C(Taskset taskset, const int m){ return test(in, dag_in, aborts_in, m); } -double get_runtime(){ +double get_Nasri2019_runtime(){ return nasri2019_runtime; } From 5f099867d9f964f8c5d40b81de3094d48573c343 Mon Sep 17 00:00:00 2001 From: porya-gohary Date: Tue, 11 Mar 2025 13:22:19 +0100 Subject: [PATCH 4/4] minor issue fixed in timescale --- src/tests/Nasri2019.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tests/Nasri2019.cpp b/src/tests/Nasri2019.cpp index 7c6f4e1..cc966a7 100644 --- a/src/tests/Nasri2019.cpp +++ b/src/tests/Nasri2019.cpp @@ -151,7 +151,8 @@ bool G_LP_FTP_Nasri2019_C(Taskset taskset, const int m){ } double get_Nasri2019_runtime(){ - return nasri2019_runtime; + // convert from seconds to microseconds + return nasri2019_runtime * 1000000; } } \ No newline at end of file