diff options
author | wolff1 <wolff1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-04-08 17:01:40 +0000 |
---|---|---|
committer | wolff1 <wolff1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-04-08 17:01:40 +0000 |
commit | 7ab12cbca67cb48fcc0745bdc88279b8e4fbecd6 (patch) | |
tree | adc0653c756a3140ed3526fa296263b7e5164955 | |
parent | 04d7c3223b7f468eab12c37cfb826468864f0a1e (diff) | |
download | ATCD-7ab12cbca67cb48fcc0745bdc88279b8e4fbecd6.tar.gz |
fixed visibility issues in ctt algorithms
5 files changed, 76 insertions, 67 deletions
diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/CTT_Basic.cpp b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/CTT_Basic.cpp index 16dd93b6264..b8756748803 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/CTT_Basic.cpp +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/CTT_Basic.cpp @@ -43,43 +43,30 @@ CTT_Basic::operator () (const TASK_LIST & tasks) return wcrt; } -struct AddExecutionTimes : public std::binary_function <double, - Task, - double> +double CTT_Basic::AddExecutionTimes::operator () (double time, const Task & task) { - double operator () (double time, const Task & task) - { - return time + task.execution_time; - } -}; - -struct WCET_Heuristic_Step : public std::binary_function <double, - Task, - double> + return time + task.execution_time; +} + +CTT_Basic::WCET_Heuristic_Step::WCET_Heuristic_Step (double R) + : R_ (R) { - WCET_Heuristic_Step (double R) - : R_ (R) - { - } - - double operator () (double time, const Task & task) - { - return time + - ceil (R_ / task.period) * - task.execution_time; - } -private: - double R_; -}; +} +double +CTT_Basic::WCET_Heuristic_Step::operator () (double time, const Task & task) +{ + return time + + ceil (R_ / task.period) * + task.execution_time; +} double CTT_Basic::worst_case_response_time_check (const Task & task, const TASK_LIST & higher_prio_tasks) { - // std::cout << "WCRT for " << task - // << " and " << higher_prio_tasks - // << std::endl; + // TRACE ("WCRT for " << task + // << " and " << higher_prio_tasks); // R0 = C1 + C2 + ... + Cn double R = std::accumulate (higher_prio_tasks.begin (), @@ -93,13 +80,14 @@ CTT_Basic::worst_case_response_time_check (const Task & task, while (R <= task.period) { + WCET_Heuristic_Step wcet(R); R_copy = R; R = std::accumulate (higher_prio_tasks.begin (), higher_prio_tasks.end (), task.execution_time, - WCET_Heuristic_Step (R)); + wcet); - // std::cout << "R = " << R << std::endl; + // TRACE("R = " << R); if (equals (R_copy, R)) break; diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/CTT_Basic.h b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/CTT_Basic.h index c83cdc6541e..fb52ae0d947 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/CTT_Basic.h +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/CTT_Basic.h @@ -18,6 +18,25 @@ class CTT_Basic : public CTT_Algorithm { public: + struct AddExecutionTimes : public std::binary_function <double, + Task, + double> + { + double operator () (double time, const Task & task); + }; + + struct WCET_Heuristic_Step : public std::binary_function <double, + Task, + double> + { + WCET_Heuristic_Step (double R); + double operator () (double time, const Task & task); + + private: + double R_; + }; + + public: virtual ~CTT_Basic (); virtual double operator () (const TASK_LIST & tasks); diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/CTT_Enhanced.cpp b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/CTT_Enhanced.cpp index fb8b21b573f..2595d48cd1e 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/CTT_Enhanced.cpp +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/CTT_Enhanced.cpp @@ -74,7 +74,7 @@ CTT_Enhanced::worst_case_response_time_check ( } double -AddExecutionTimes::operator () (double time, const Task & task) +CTT_Enhanced::AddExecutionTimes::operator () (double time, const Task & task) { // determine execution time based on type of application double exec_time = (task.role == PRIMARY ? @@ -84,13 +84,13 @@ AddExecutionTimes::operator () (double time, const Task & task) return time + exec_time; } -WCET_Heuristic_Step::WCET_Heuristic_Step (double R) +CTT_Enhanced::WCET_Heuristic_Step::WCET_Heuristic_Step (double R) : R_ (R) { } double -WCET_Heuristic_Step::operator () (double time, const Task & task) +CTT_Enhanced::WCET_Heuristic_Step::operator () (double time, const Task & task) { // determine execution time based on type of application double exec_time = (task.role == PRIMARY ? diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/CTT_Enhanced.h b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/CTT_Enhanced.h index bb86e053d67..3c6986005e2 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/CTT_Enhanced.h +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/CTT_Enhanced.h @@ -26,6 +26,40 @@ */ class CTT_Enhanced : public CTT_Algorithm { +public: + /** + * @struct AddExecutionTimes + * + * @brief helper functor for adding task execution times + */ + struct AddExecutionTimes : public std::binary_function <double, + Task, + double> + { + /// simple sums up the task execution times + double operator () (double time, const Task & task); + }; + + /** + * @struct AddExecutionTimes + * + * @brief helper functor for calculating a step of the wcrt result + * with a heuristic. + */ + struct WCET_Heuristic_Step : public std::binary_function <double, + Task, + double> + { + WCET_Heuristic_Step (double R); + + /// adds the execution time for one task times its reoccurence in + /// one period R_ to the wcrt + double operator () (double time, const Task & task); + + private: + double R_; + }; + public: virtual ~CTT_Enhanced (); @@ -37,37 +71,5 @@ class CTT_Enhanced : public CTT_Algorithm const TASK_LIST & higher_prio_tasks); }; -/** - * @struct AddExecutionTimes - * - * @brief helper functor for adding task execution times - */ -struct AddExecutionTimes : public std::binary_function <double, - Task, - double> -{ - /// simple sums up the task execution times - double operator () (double time, const Task & task); -}; - -/** - * @struct AddExecutionTimes - * - * @brief helper functor for calculating a step of the wcrt result - * with a heuristic. - */ -struct WCET_Heuristic_Step : public std::binary_function <double, - Task, - double> -{ - WCET_Heuristic_Step (double R); - - /// adds the execution time for one task times its reoccurence in - /// one period R_ to the wcrt - double operator () (double time, const Task & task); - -private: - double R_; -}; #endif /* CTT_ENHANCED_H_ */ diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/DeCoRAM.mpc b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/DeCoRAM.mpc index 8a18584a193..b726cb88e25 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/DeCoRAM.mpc +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/DeCoRAM.mpc @@ -76,7 +76,7 @@ project (schedulability_check) : acelib { exename = scheck exeout = ../bin - macros += DO_DEBUG + macros += DO_DEBUG DO_TRACE Source_Files { Algorithms.cpp |