#include <System.h>
Public Member Functions | |
System () | |
Constructor. | |
virtual | ~System () |
Destructor. | |
void | add_scheduler (DREAM::Scheduler *scheduler_ptr) |
Adds a Scheduler into the overall model of computation. | |
void | destroy_priority_list () |
Clears the priority list and frees up memory. | |
uint | CPUs () const |
Returns the number of CPUs in the system. | |
DREAM::Task * | find_current (const DREAM::TASK_AVLTREE *task_avltree_ptr, DREAM::Task *task_ptr) const |
This function returns which Task to execute given the parameter AVL tree. | |
virtual bool | inversion () |
This function introduces a single priority inversion in the priority_list_ptr_. | |
virtual double | next_event (bool deterministic) const |
Returns the time of the next event. | |
virtual void | reset () |
Resets Schedulers (when restarting the simulation). | |
virtual bool | relevant_event () const |
Returns relevant_event_. | |
virtual void | relevant_event (bool value) |
Tasks call this function when publishing to signal that their event has to be considered for model checking. | |
virtual const DREAM::SCHEDULER_MAP * | scheduler_map () |
Returns the Scheduler map. | |
virtual void | simulate (bool verbose, bool deterministic, double *endtoend=NULL) |
Starts deterministic simulation. | |
virtual void | visitor_error_avltree (DREAM::TASK_AVLTREE *task_avltree) |
This function builds the error list. | |
virtual void | visitor_if (DREAM::NODE_MAP *task_map, DREAM::NODE_MAP *channel_map, DREAM::NODE_MAP *timer_map, std::ofstream &f_stream) |
This function is part of the IF system description generator. | |
virtual void | visitor_map (DREAM::NODE_MAP *task_map, DREAM::NODE_MAP *channel_map, DREAM::NODE_MAP *timer_map) |
This function fills the IDs (names) of tasks, channels and timers to the parameter lists. | |
virtual void | visitor_task_avltree (DREAM::TASK_AVLTREE *task_avltree) |
This function builds the task list for manipulation. | |
virtual void | visitor_update_task_avltree (DREAM::TASK_AVLTREE *task_avltree) |
This function updates task values in the system. | |
virtual void | visitor_uppaal (DREAM::NODE_MAP *task_map, DREAM::NODE_MAP *channel_map, DREAM::NODE_MAP *timer_map, std::ofstream &f_stream) |
This function is part of the Uppaal system description generator. | |
Private Attributes | |
bool | active_ |
Flag to signal end of event loop. | |
DREAM::SCHEDULER_MAP | scheduler_map_ |
List of all the Schedulers in the model of computation. | |
double | time_ |
Clock for the System. | |
DREAM::PriorityInversionList * | priority_list_ptr_ |
Queue that stores tasks that need to be checked for race conditions. | |
bool | relevant_event_ |
This variable is set to true if branching points have to be considered for the actual event. |
This class implements the DRE model of computation for analyzing the distributed real-time scheduling of embedded systems.
Definition at line 65 of file System.h.
DREAM::System::System | ( | ) |
DREAM::System::~System | ( | ) | [virtual] |
Destructor.
Definition at line 66 of file System.cpp.
References DREAM::for_each(), priority_list_ptr_, and scheduler_map_.
void DREAM::System::add_scheduler | ( | DREAM::Scheduler * | scheduler_ptr | ) |
Adds a Scheduler into the overall model of computation.
scheduler_ptr | specifies the Scheduler to be added. |
Definition at line 75 of file System.cpp.
References DREAM::Scheduler::id(), and scheduler_map_.
void DREAM::System::destroy_priority_list | ( | ) |
Clears the priority list and frees up memory.
Definition at line 81 of file System.cpp.
References DREAM::PriorityInversionList::destroy(), and priority_list_ptr_.
Referenced by DREAM::ModelCheck::branching_point().
uint DREAM::System::CPUs | ( | ) | const |
Returns the number of CPUs in the system.
Definition at line 87 of file System.cpp.
References scheduler_map_.
DREAM::Task * DREAM::System::find_current | ( | const DREAM::TASK_AVLTREE * | task_avltree_ptr, | |
DREAM::Task * | task_ptr | |||
) | const |
This function returns which Task to execute given the parameter AVL tree.
Definition at line 101 of file System.cpp.
Referenced by DREAM::FixedPriorityScheduler::schedule().
bool DREAM::System::inversion | ( | ) | [virtual] |
This function introduces a single priority inversion in the priority_list_ptr_.
The function returns false if all permutations of priority inversions have been checked.
Definition at line 109 of file System.cpp.
References DREAM::PriorityInversionList::inversion(), and priority_list_ptr_.
Referenced by DREAM::ModelCheck::branching_point().
double DREAM::System::next_event | ( | bool | deterministic | ) | const [virtual] |
void DREAM::System::reset | ( | ) | [virtual] |
Resets Schedulers (when restarting the simulation).
Definition at line 146 of file System.cpp.
References DREAM::for_each(), scheduler_map_, and time_.
Referenced by DREAM::GeneticOptimize::CPU_level(), DREAM::Solution::fitness(), DREAM::ModelCheck::random_testing(), DREAM::GeneticOptimize::thread_level(), and DREAM::ModelCheck::trace_based_model_check().
bool DREAM::System::relevant_event | ( | ) | const [inline, virtual] |
Returns relevant_event_.
Definition at line 136 of file System.cpp.
References relevant_event_.
Referenced by DREAM::Task::clock_step(), DREAM::Channel::clock_step(), DREAM::Timer::clock_step(), DREAM::Timer::publish(), and DREAM::Node::publish().
void DREAM::System::relevant_event | ( | bool | value | ) | [inline, virtual] |
Tasks call this function when publishing to signal that their event has to be considered for model checking.
Definition at line 141 of file System.cpp.
References relevant_event_.
const DREAM::SCHEDULER_MAP * DREAM::System::scheduler_map | ( | ) | [inline, virtual] |
Returns the Scheduler map.
Used in output generation.
Definition at line 152 of file System.cpp.
Referenced by DREAM::Solution::regenerate_priorities(), and DREAM::ModelCheck::trace_based_model_check().
void DREAM::System::simulate | ( | bool | verbose, | |
bool | deterministic, | |||
double * | endtoend = NULL | |||
) | [virtual] |
Starts deterministic simulation.
This simulation will simulate a deterministic trace of the system.
verbose | specifies whether messages will be generated. | |
deterministic | specifies whether deterministic schedule is assumed. | |
endtoend | updates the pointer's target with the end-to-end execution time of the model (unless the pointer is NULL). |
Definition at line 160 of file System.cpp.
References active_, DREAM::for_each(), relevant_event_, scheduler_map_, Option::simulation_time_, and time_.
Referenced by DREAM::Solution::fitness(), DREAM::ModelCheck::random_testing(), and DREAM::ModelCheck::trace_based_model_check().
void DREAM::System::visitor_error_avltree | ( | DREAM::TASK_AVLTREE * | task_avltree | ) | [virtual] |
This function builds the error list.
The function is used by genetic algorithms.
task_avltree | stores the list of Tasks from the Scheduler error list. |
Definition at line 218 of file System.cpp.
Referenced by DREAM::Solution::fitness().
void DREAM::System::visitor_if | ( | DREAM::NODE_MAP * | task_map, | |
DREAM::NODE_MAP * | channel_map, | |||
DREAM::NODE_MAP * | timer_map, | |||
std::ofstream & | f_stream | |||
) | [virtual] |
This function is part of the IF system description generator.
task_map | stores the Task pointers. | |
channel_map | stores the Channel pointers. | |
timer_map | stores the Timer pointers. | |
f_stream | is the output stream to be written to. |
Definition at line 231 of file System.cpp.
void DREAM::System::visitor_map | ( | DREAM::NODE_MAP * | task_map, | |
DREAM::NODE_MAP * | channel_map, | |||
DREAM::NODE_MAP * | timer_map | |||
) | [virtual] |
This function fills the IDs (names) of tasks, channels and timers to the parameter lists.
The function is used to generate output for model checkers.
task_map | stores the Task pointers. | |
channel_map | stores the Channel pointers. | |
timer_map | stores the Timer pointers. |
Definition at line 244 of file System.cpp.
Referenced by DREAM::ModelCheck::random_testing(), DREAM::ModelCheck::trace_based_model_check(), and DREAM::Task::zero_delay_race_condition().
void DREAM::System::visitor_task_avltree | ( | DREAM::TASK_AVLTREE * | task_avltree | ) | [virtual] |
This function builds the task list for manipulation.
The function is used by genetic algorithms.
task_avltree | stores the Task pointers. |
Definition at line 257 of file System.cpp.
Referenced by DREAM::Solution::Solution().
void DREAM::System::visitor_update_task_avltree | ( | DREAM::TASK_AVLTREE * | task_avltree | ) | [virtual] |
This function updates task values in the system.
The function is used by genetic algorithms.
task_avltree | stores the Task pointers. |
Definition at line 270 of file System.cpp.
Referenced by DREAM::GeneticOptimize::CPU_level(), DREAM::Solution::fitness(), and DREAM::GeneticOptimize::thread_level().
void DREAM::System::visitor_uppaal | ( | DREAM::NODE_MAP * | task_map, | |
DREAM::NODE_MAP * | channel_map, | |||
DREAM::NODE_MAP * | timer_map, | |||
std::ofstream & | f_stream | |||
) | [virtual] |
This function is part of the Uppaal system description generator.
task_map | stores the Task pointers. | |
channel_map | stores the Channel pointers. | |
timer_map | stores the Timer pointers. | |
f_stream | is the output stream to be written to. |
Definition at line 283 of file System.cpp.
bool DREAM::System::active_ [private] |
Flag to signal end of event loop.
Definition at line 204 of file System.h.
Referenced by simulate().
List of all the Schedulers in the model of computation.
Definition at line 207 of file System.h.
Referenced by add_scheduler(), CPUs(), reset(), simulate(), and ~System().
double DREAM::System::time_ [private] |
Clock for the System.
Definition at line 210 of file System.h.
Referenced by reset(), and simulate().
Queue that stores tasks that need to be checked for race conditions.
The model checker implements the checks by introducing artificial priority inversions at simulation time.
Definition at line 216 of file System.h.
Referenced by destroy_priority_list(), inversion(), System(), and ~System().
bool DREAM::System::relevant_event_ [private] |
This variable is set to true if branching points have to be considered for the actual event.
Definition at line 220 of file System.h.
Referenced by relevant_event(), and simulate().