diff options
author | wolff1 <wolff1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-04-30 20:44:51 +0000 |
---|---|---|
committer | wolff1 <wolff1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-04-30 20:44:51 +0000 |
commit | 7367a27a6a0c1d396c7bb95759925d8bee452b5a (patch) | |
tree | abef4b53ceefd8db2de79c90298bd6ac8a828e28 | |
parent | 1235da908c333fca27da41f4ac32d03100a0abc0 (diff) | |
download | ATCD-7367a27a6a0c1d396c7bb95759925d8bee452b5a.tar.gz |
added failure map data structure
8 files changed, 231 insertions, 64 deletions
diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Algorithms.cpp b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Algorithms.cpp index dae94e0ee65..3462fc5f810 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Algorithms.cpp +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Algorithms.cpp @@ -14,6 +14,24 @@ #include <sstream> #include "Algorithms.h" +unsigned int extract_rank (const Taskname & taskname) +{ + unsigned int rank = 0; + size_t first_underscore = taskname.find_first_of ("_"); + + if (first_underscore != std::string::npos) + { + std::string rankstring = taskname.substr (first_underscore + 1); + + if (!rankstring.empty ()) + { + rank = atoi (rankstring.c_str ()); + } + } + + return rank; +} + PROCESSOR_LIST create_processors (unsigned long count) { PROCESSOR_LIST procs; @@ -52,7 +70,7 @@ std::ostream & operator<< (std::ostream & ostr, const Task & t) << t.period << "," << t.sync_time -// << (t.role == PRIMARY ? ",p" : ",b") + << (t.role == PRIMARY ? ",p" : ",b") << ")"; return ostr; diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Algorithms.h b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Algorithms.h index 242e4c69bf9..a90235c425a 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Algorithms.h +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Algorithms.h @@ -57,6 +57,8 @@ struct Task unsigned int rank; }; +unsigned int extract_rank (const Taskname & taskname); + typedef std::vector <Task> TASK_LIST; class CTT_Algorithm : public std::unary_function <TASK_LIST, bool> diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/DeCoRAM.mpc b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/DeCoRAM.mpc index 01e51783f18..7905ceb1ad6 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/DeCoRAM.mpc +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/DeCoRAM.mpc @@ -178,7 +178,7 @@ project (forward_ranking_ftrmff) { exename = frftrmff exeout = ../bin - macros += DO_DEBUGu + macros += DO_DEBUG DO_TRACE Source_Files { Algorithms.cpp diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Forward_Ranking_Scheduler.cpp b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Forward_Ranking_Scheduler.cpp index 08e46b73165..40b64bcfba9 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Forward_Ranking_Scheduler.cpp +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Forward_Ranking_Scheduler.cpp @@ -13,6 +13,51 @@ #include <numeric> #include "Forward_Ranking_Scheduler.h" #include "Combination_T.h" +#include "CTT_Enhanced.h" + +ReplicaFinder::ReplicaFinder (const REPLICA_GROUPS & rep_groups) + : rep_groups_ (rep_groups) +{ +} + +PROCESSOR_SET +ReplicaFinder::operator () (const Task & task) +{ + PROCESSOR_SET result; + + REPLICA_GROUPS::const_iterator replicas = + rep_groups_.find (primary_name (task)); + + if (replicas != rep_groups_.end ()) + { + std::transform (replicas->second.begin (), + replicas->second.begin () + task.rank, + std::inserter (result, + result.begin ()), + processor_picker_); + } + + return result; +} + +FailureMapFinder::FailureMapFinder (const FAILURE_MAP & failure_map) + : failure_map_ (failure_map) +{ +} + +PROCESSOR_SET +FailureMapFinder::operator () (const Task & task) +{ + FAILURE_MAP::const_iterator it = + failure_map_.find (task.name); + + if (it != failure_map_.end ()) + return it->second; + else + TRACE ("OOPS(" << task << ")"); + + return PROCESSOR_SET (); +} Forward_Ranking_Scheduler::Forward_Ranking_Scheduler ( const PROCESSOR_LIST & processors, @@ -74,6 +119,39 @@ Forward_Ranking_Scheduler::schedule_task (const Task & task, return wcrt; } +void +Forward_Ranking_Scheduler::update_schedule (const Task & task, + const Processor & processor) +{ + this->Scheduler::update_schedule (task, processor); + + this->update_failure_map (task, processor); +} + +void +Forward_Ranking_Scheduler::update_failure_map (const Task & task, + const Processor & processor) +{ + PROCESSOR_SET proc_dependencies; + + REPLICA_GROUPS::iterator it = + replica_groups_.find (primary_name (task)); + + if (it != replica_groups_.end ()) + { + for (TASK_POSITIONS::iterator tp_it = it->second.begin (); + tp_it != it->second.begin () + task.rank; + ++tp_it) + { + proc_dependencies.insert (tp_it->first); + } + } + + failure_map_[task.name] = proc_dependencies; + + TRACE ("Failure Map: " << failure_map_); +} + bool Forward_Ranking_Scheduler::check_for_existing_replicas ( const Task & task, @@ -88,36 +166,6 @@ Forward_Ranking_Scheduler::check_for_existing_replicas ( ProcessorNameComparison (processor)); } -class ReplicaFinder : public std::unary_function <Task, - PROCESSOR_SET> -{ -public: - ReplicaFinder (const REPLICA_GROUPS & rep_groups) - : rep_groups_ (rep_groups) {} - - PROCESSOR_SET operator () (const Task & task) - { - PROCESSOR_SET result; - - REPLICA_GROUPS::const_iterator replicas = - rep_groups_.find (primary_name (task)); - - if (replicas != rep_groups_.end ()) - { - std::transform (replicas->second.begin (), - replicas->second.begin () + task.rank, - std::inserter (result, - result.begin ()), - ProcessorPicker ()); - } - - return result; - } - -private: - const REPLICA_GROUPS rep_groups_; -}; - PROCESSOR_SET Forward_Ranking_Scheduler::replica_processors (const Task & task) { @@ -236,9 +284,9 @@ class ActivateFailedTask : public std::unary_function <PROCESSOR_SET, public: ActivateFailedTask (const PROCESSOR_SET & failures, const REPLICA_GROUPS & rep_groups) - : failures_ (failures), + : failures_ (failures), rep_groups_ (rep_groups), - find_replicas_ (rep_groups_) {} + find_replicas_ (rep_groups) {} Task operator () (const Task & task) { @@ -265,7 +313,7 @@ public: private: const PROCESSOR_SET & failures_; - const REPLICA_GROUPS & rep_groups_; + const REPLICA_GROUPS & rep_groups_; PrimaryConversion convert_; ReplicaFinder find_replicas_; }; @@ -277,7 +325,7 @@ public: ActivateFailedTasks (const TASK_LIST & tasks, const REPLICA_GROUPS & rep_groups) : tasks_ (tasks), - rep_groups_ (rep_groups) {} + rep_groups_ (rep_groups){} TASK_LIST operator () (const PROCESSOR_SET & scenario) { @@ -350,31 +398,16 @@ Forward_Ranking_Scheduler::accumulate_wcrt (const TASK_SCENARIOS & scenarios) } std::ostream & operator<< (std::ostream & ostr, - const PROCESSOR_SETS & ps) + const FAILURE_MAP & fm) { ostr << "{"; - for (PROCESSOR_SETS::const_iterator it = ps.begin (); - it != ps.end (); + for (FAILURE_MAP::const_iterator it = fm.begin (); + it != fm.end (); ++it) { - ostr << *it << "| "; + ostr << it->first << ": " << it->second << ", "; } ostr << "}"; return ostr; } - -std::ostream & operator<< (std::ostream & ostr, - const TASK_SCENARIOS & ts) -{ - ostr << "{"; - for (TASK_SCENARIOS::const_iterator it = ts.begin (); - it != ts.end (); - ++it) - { - ostr << *it << "| "; - } - ostr << "}"; - - return ostr; -} diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Forward_Ranking_Scheduler.h b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Forward_Ranking_Scheduler.h index 6174361e835..911dd4acf08 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Forward_Ranking_Scheduler.h +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Forward_Ranking_Scheduler.h @@ -14,11 +14,47 @@ #define FORWARD_RANKING_SCHEDULER_H_ #include "Scheduler.h" -#include "CTT_Enhanced.h" -typedef std::list<PROCESSOR_SET> PROCESSOR_SETS; +typedef std::map <Taskname, PROCESSOR_SET> FAILURE_MAP; -typedef std::list<TASK_LIST> TASK_SCENARIOS; +/** + * @class ReplicaFinder + * + * @brief Functor that uses the replica group to determine the + * processors that need to fail in order for a given backup + * task to become active + */ +class ReplicaFinder : public std::unary_function <Task, + PROCESSOR_SET> +{ +public: + ReplicaFinder (const REPLICA_GROUPS & rep_groups); + + PROCESSOR_SET operator () (const Task & task); + +private: + const REPLICA_GROUPS rep_groups_; + ProcessorPicker processor_picker_; +}; + +/** + * @class FailureMapFinder + * + * @brief Functor that uses the replica group to determine the + * processors that need to fail in order for a given backup + * task to become active + */ +class FailureMapFinder : public std::unary_function <Task, + PROCESSOR_SET> +{ +public: + FailureMapFinder (const FAILURE_MAP & failure_map); + + PROCESSOR_SET operator () (const Task & task); + +private: + const FAILURE_MAP & failure_map_; +}; class Forward_Ranking_Scheduler : public Scheduler { @@ -29,7 +65,15 @@ public: virtual double schedule_task (const Task & task, const Processor & processor); + +protected: + virtual void update_schedule (const Task & task, + const Processor & processor); + private: + void update_failure_map (const Task & task, + const Processor & processor); + bool check_for_existing_replicas (const Task & task, const Processor & processor); @@ -48,14 +92,10 @@ private: double accumulate_wcrt (const TASK_SCENARIOS & scenarios); private: - CTT_Enhanced ctt_; + FAILURE_MAP failure_map_; }; -// streaming operators for data structures defined in this header -std::ostream & operator<< (std::ostream & ostr, - const PROCESSOR_SETS & ps); - std::ostream & operator<< (std::ostream & ostr, - const TASK_SCENARIOS & ts); + const FAILURE_MAP & fm); #endif /* FORWARD_RANKING_SCHEDULER_H_ */ diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Scheduler.cpp b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Scheduler.cpp index 6c7459d8aa1..124d849f263 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Scheduler.cpp +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Scheduler.cpp @@ -146,3 +146,34 @@ std::ostream & operator<< (std::ostream & ostr, return ostr; } + + +std::ostream & operator<< (std::ostream & ostr, + const PROCESSOR_SETS & ps) +{ + ostr << "{"; + for (PROCESSOR_SETS::const_iterator it = ps.begin (); + it != ps.end (); + ++it) + { + ostr << *it << "| "; + } + ostr << "}"; + + return ostr; +} + +std::ostream & operator<< (std::ostream & ostr, + const TASK_SCENARIOS & ts) +{ + ostr << "{"; + for (TASK_SCENARIOS::const_iterator it = ts.begin (); + it != ts.end (); + ++it) + { + ostr << *it << "| "; + } + ostr << "}"; + + return ostr; +} diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Scheduler.h b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Scheduler.h index ac4ede69472..10c9acbf6d6 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Scheduler.h +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/Scheduler.h @@ -19,6 +19,8 @@ typedef std::pair <Processor, Task> TASK_POSITION; typedef std::vector <TASK_POSITION> TASK_POSITIONS; typedef std::map <Taskname, TASK_POSITIONS> REPLICA_GROUPS; +typedef std::list<PROCESSOR_SET> PROCESSOR_SETS; +typedef std::list<TASK_LIST> TASK_SCENARIOS; class Scheduler : public std::unary_function <Task, ScheduleResult> @@ -99,4 +101,10 @@ std::ostream & operator<< (std::ostream & ostr, std::ostream & operator<< (std::ostream & ostr, const REPLICA_GROUPS & rg); +std::ostream & operator<< (std::ostream & ostr, + const PROCESSOR_SETS & ps); + +std::ostream & operator<< (std::ostream & ostr, + const TASK_SCENARIOS & ts); + #endif /* SCHEDULER_H_ */ diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/schedulability_check.cpp b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/schedulability_check.cpp index f0bac501c91..80e570dde1e 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/schedulability_check.cpp +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/DeCoRAM/src/schedulability_check.cpp @@ -23,6 +23,7 @@ std::string filename = "test.sd"; // filename of task list input bool counting_mode = false; bool average_mode = false; bool check_overbooking = false; +unsigned int consistency_level = 0; class ScheduleChecker : public std::binary_function <double, SCHEDULE::value_type, @@ -63,10 +64,44 @@ public: double operator () (double previous, const SCHEDULE::value_type & entry) { + PROCESSOR_SETS scenarios = + this->calculate_failure_scenarions (entry.first, + this->max_rank ()); + return .0; } private: + PROCESSOR_SETS calculate_failure_scenarions (const Processor & processor, + unsigned int consistency_level) + { + PROCESSOR_SETS result; + PROCESSOR_LIST all_processors = get_processors (schedule_, true); + + return result; + } + + unsigned int max_rank (void) + { + unsigned int max_rank = 0; + + for (SCHEDULE::const_iterator sched_it = schedule_.begin (); + sched_it != schedule_.end (); + ++sched_it) + { + for (TASK_LIST::const_iterator task_it = sched_it->second.begin (); + task_it != sched_it->second.end (); + ++task_it) + { + max_rank = std::max (max_rank, + extract_rank (task_it->name)); + } + } + + return max_rank; + } + +private: const SCHEDULE & schedule_; REPLICA_GROUPS replica_groups_; }; |