#include <Task.h>
Inheritance diagram for DREAM::Task:
Public Member Functions | |
Task (const std::string &id, DREAM::Thread *thread_ptr, uint wcet, uint deadline) | |
Constructor. | |
Task (const std::string &id, DREAM::Thread *thread_ptr, uint wcet, uint deadline, uint subpriority) | |
Constructor. | |
Task (const std::string &id, DREAM::Thread *thread_ptr, uint wcet, uint bcet, uint deadline, uint subpriority) | |
Constructor. | |
Task (const DREAM::Task &task) | |
Copy constructor for Tasks. | |
virtual | ~Task () |
Destructor. | |
virtual void | operator= (const DREAM::Task &task) |
Operator overloading. | |
virtual bool | operator== (const DREAM::Task &task) |
Operator overloading. | |
virtual uint | bcet () const |
Returns the best case execution time of the task. | |
virtual void | bcet (uint bcet) |
Sets the best case execution time of the task . | |
virtual void | branching_point () |
Sets the new execution time if branching points were found. | |
virtual DREAM::Context | context () const |
Returns whether the Task uses the best case or worst case time for the simulation. | |
virtual void | context (DREAM::Context context) |
Sets the Task to use the specified context (e.g. | |
virtual double | clock_dl () const |
Returns the value of the deadline clock - clock_dl_. | |
virtual void | clock_dl_reset () |
Resets deadline clock value - clock_dl_. | |
virtual void | clock_exec_reset () |
Resets execution clock value - clock_exec_. | |
virtual void | clock_step (double clock_step) |
Models the passing of time - increments local clock. | |
virtual void | consume () |
Consumes an event received from an event source. | |
virtual uint | deadline () const |
Returns the deadline of the task. | |
virtual void | deadline (uint deadline) |
Sets the deadline of the task. | |
virtual void | execute () |
Schedules the Task for execution. | |
virtual bool | isidle () const |
Returns true if the Task is idle (used by Channels). | |
virtual double | next_event () |
Tells when the Task will generate the next event. | |
virtual void | next_et (double next_et) |
Sets the next execution time when the context is branchingpoint. | |
virtual void | preempt () |
Models the preemption of the task. | |
virtual uint | priority () const |
Returns the priority of the Task - the priority of the Thread which executes it. | |
virtual void | priority (uint priority) |
Sets the priority of the Task. | |
virtual void | publish () |
Publishes an event to dependent tasks. | |
virtual void | reset () |
Resets task (after a frame overrun or when restarting the simulation). | |
virtual uint | subpriority () const |
Returns the sub-priority of the Task - subpriority_. | |
virtual void | subpriority (uint subpriority) |
Sets the subpriority of the Task. | |
virtual void | take_transitions () |
Takes state transitions. | |
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. | |
virtual uint | wcet () const |
Returns the worst case execution time of the task. | |
virtual void | wcet (uint wcet) |
Sets the worst case execution time of the task. | |
virtual bool | zero_delay_race_condition (DREAM::System *system_ptr) |
Returns true if all of the sources of the task are zero-delay channels. | |
Protected Member Functions | |
Task (const std::string &id, DREAM::Thread *thread_ptr, uint wcet, uint bcet, uint deadline, uint subpriority, DREAM::Context context, double et, DREAM::State state, double clock_dl) | |
Constructor. | |
Protected Attributes | |
uint | bcet_ |
Best case execution time. | |
DREAM::Context | context_ |
Specifies whether best case, worst case, or a random value is used for the execution time during the simulation. | |
double | clock_dl_ |
Deadline clock. | |
uint | deadline_ |
Deadline. | |
double | et_ |
The execution time. | |
double | next_et_ |
The next execution time when the context is branchingpoint. | |
DREAM::State | state_ |
State of the Task as specified by the DRE Semantic Domain. | |
uint | subpriority_ |
Sub-priority. | |
uint | wcet_ |
Worst case execution time. | |
uint | zero_delay_race_condition_ |
This variable is used to speed up the search whether all sources are zero-delay. |
This class is the implementation of the Task in the DRE Semantic Domain.
Definition at line 856 of file Task.h.
DREAM::Task::Task | ( | const std::string & | id, | |
DREAM::Thread * | thread_ptr, | |||
uint | wcet, | |||
uint | deadline | |||
) |
DREAM::Task::Task | ( | const std::string & | id, | |
DREAM::Thread * | thread_ptr, | |||
uint | wcet, | |||
uint | deadline, | |||
uint | subpriority | |||
) |
Constructor.
id | specifies the name of the Task. | |
thread_ptr | defines the mapping of the Task to a platform processor. | |
wcet | is the worst case execution time parameter of the Task. | |
deadline | is the deadline of the task - deadlines are counted from the time when the task becomes enabled. | |
subpriority | is the subpriority of the task. Subpriorities can be used to model the queueing policies (FIFO, MUF etc.) |
DREAM::Task::Task | ( | const std::string & | id, | |
DREAM::Thread * | thread_ptr, | |||
uint | wcet, | |||
uint | bcet, | |||
uint | deadline, | |||
uint | subpriority | |||
) |
Constructor.
id | specifies the name of the Task. | |
thread_ptr | defines the mapping of the Task to a platform processor. | |
bcet | is the best case execution time parameter of the Task. | |
wcet | is the worst case execution time parameter of the Task. | |
deadline | is the deadline of the task - deadlines are counted from the time when the task becomes enabled. | |
subpriority | is the subpriority of the task. Subpriorities can be used to model the queueing policies (FIFO, MUF etc.) |
DREAM::Task::Task | ( | const DREAM::Task & | task | ) |
DREAM::Task::Task | ( | const std::string & | id, | |
DREAM::Thread * | thread_ptr, | |||
uint | wcet, | |||
uint | bcet, | |||
uint | deadline, | |||
uint | subpriority, | |||
DREAM::Context | context, | |||
double | et, | |||
DREAM::State | state, | |||
double | clock_dl | |||
) | [protected] |
Constructor.
This contructor is only to be used by the copy constructors of derived classes.
id | specifies the name of the Task. | |
thread_ptr | defines the mapping of the Task to a platform processor. | |
bcet | is the best case execution time parameter of the Task. | |
wcet | is the worst case execution time parameter of the Task. | |
deadline | is the deadline of the task - deadlines are counted from the time when the task becomes enabled. | |
subpriority | is the subpriority of the task. Subpriorities can be used to model the queueing policies (FIFO, MUF etc.) | |
context | specifies the context of the Task. | |
et | specifies the actual execution time of the Task. | |
state | specifies the state of the Task. | |
clock_dl | specifies the deadline clock of the Task. |
void DREAM::Task::operator= | ( | const DREAM::Task & | task | ) | [virtual] |
bool DREAM::Task::operator== | ( | const DREAM::Task & | task | ) | [virtual] |
Operator overloading.
task | is the Task to be compared with this class. |
Definition at line 1342 of file Task.cpp.
References DREAM::Node::id_.
uint DREAM::Task::bcet | ( | ) | const [inline, virtual] |
Returns the best case execution time of the task.
Reimplemented from DREAM::Node.
void DREAM::Task::bcet | ( | uint | bcet | ) | [inline, virtual] |
Sets the best case execution time of the task .
bcet | is the best case execution time parameter of the Task. |
Reimplemented from DREAM::Node.
void DREAM::Task::branching_point | ( | ) | [inline, virtual] |
Sets the new execution time if branching points were found.
Reimplemented from DREAM::Node.
Definition at line 1383 of file Task.cpp.
References DREAM::bestcase, and DREAM::branchingpoint.
DREAM::Context DREAM::Task::context | ( | ) | const [inline, virtual] |
Returns whether the Task uses the best case or worst case time for the simulation.
Reimplemented from DREAM::Node.
void DREAM::Task::context | ( | DREAM::Context | context | ) | [inline, virtual] |
Sets the Task to use the specified context (e.g.
in the simulation).
context | is the context assumed. |
Reimplemented from DREAM::Node.
double DREAM::Task::clock_dl | ( | ) | const [inline, virtual] |
void DREAM::Task::clock_dl_reset | ( | ) | [inline, virtual] |
void DREAM::Task::clock_exec_reset | ( | ) | [inline, virtual] |
Resets execution clock value - clock_exec_.
Reimplemented from DREAM::Node.
Definition at line 1435 of file Task.cpp.
References bcet_, DREAM::bestcase, DREAM::Node::clock_exec_, context_, et_, DREAM::random(), DREAM::randomcase, wcet_, and DREAM::worstcase.
Referenced by reset().
void DREAM::Task::clock_step | ( | double | clock_step | ) | [inline, virtual] |
Models the passing of time - increments local clock.
clock_step | specifies by how much do we have to increment the time. |
Reimplemented from DREAM::Node.
Definition at line 1448 of file Task.cpp.
References bcet_, Option::branching_, DREAM::branchingpoint, clock_dl_, DREAM::Node::clock_exec_, context_, DREAM::enabled, et_, DREAM::executing, DREAM::Node::id_, next_et_, DREAM::preempted, DREAM::System::relevant_event(), DREAM::Node::remote_dep_, DREAM::Thread::scheduler(), state_, DREAM::Scheduler::system(), DREAM::Node::thread_ptr_, DREAM::Thread::trace(), wcet_, and DREAM::worstcase.
void DREAM::Task::consume | ( | ) | [inline, virtual] |
Consumes an event received from an event source.
This function is called by the publish () function of the event source and triggers state transitions. The take_transitions () function will take the enabled transitions.
Reimplemented from DREAM::Node.
Definition at line 1486 of file Task.cpp.
References DREAM::enabled, DREAM::error, DREAM::executing, and DREAM::idle.
uint DREAM::Task::deadline | ( | ) | const [inline, virtual] |
Returns the deadline of the task.
Reimplemented from DREAM::Node.
Definition at line 1513 of file Task.cpp.
Referenced by DREAM::Scheduler::add_error().
void DREAM::Task::deadline | ( | uint | deadline | ) | [inline, virtual] |
Sets the deadline of the task.
Deadlines are counted from the time when the task becomes enabled.
deadline | is the deadline of the task. |
Reimplemented from DREAM::Node.
void DREAM::Task::execute | ( | ) | [inline, virtual] |
Schedules the Task for execution.
This function will schedule the Task for execution.
Reimplemented from DREAM::Node.
Definition at line 1533 of file Task.cpp.
References DREAM::branchingpoint, DREAM::enabled, DREAM::executing, and DREAM::preempted.
Referenced by DREAM::FixedPriorityScheduler::schedule().
bool DREAM::Task::isidle | ( | ) | const [inline, virtual] |
Returns true if the Task is idle (used by Channels).
Reimplemented from DREAM::Node.
Definition at line 1575 of file Task.cpp.
References DREAM::idle.
double DREAM::Task::next_event | ( | ) | [inline, virtual] |
Tells when the Task will generate the next event.
Reimplemented from DREAM::Node.
Definition at line 1581 of file Task.cpp.
References DREAM::Node::clock_exec_, et_, DREAM::executing, and state_.
void DREAM::Task::next_et | ( | double | next_et | ) | [inline, virtual] |
void DREAM::Task::preempt | ( | ) | [inline, virtual] |
Models the preemption of the task.
This function will take the state transition to the preempted state as specified by the DRE Semantic Domain. It does not require calling the take_transition () function.
Reimplemented from DREAM::Node.
Definition at line 1604 of file Task.cpp.
References DREAM::executing, and DREAM::preempted.
uint DREAM::Task::priority | ( | ) | const [inline, virtual] |
Returns the priority of the Task - the priority of the Thread which executes it.
Reimplemented from DREAM::Node.
Definition at line 1615 of file Task.cpp.
Referenced by DREAM::Solution::fitness().
void DREAM::Task::priority | ( | uint | priority | ) | [inline, virtual] |
Sets the priority of the Task.
This function looks up whether there is a Thread with the requested priority on the actual CPU. If yes, it redeploys the Task to that Thread. If not, returns with an Exception. This function is used by the genetic algorithm when assigning priorities.
priority | is the priority of the task. |
Reimplemented from DREAM::Node.
void DREAM::Task::publish | ( | ) | [inline, virtual] |
Publishes an event to dependent tasks.
This function models synchronous event propagation by calling the consume () functions of all the dependent Nodes.
Reimplemented from DREAM::Node.
Definition at line 1635 of file Task.cpp.
References DREAM::executing, and DREAM::idle.
void DREAM::Task::reset | ( | ) | [inline, virtual] |
Resets task (after a frame overrun or when restarting the simulation).
Reimplemented from DREAM::Node.
Definition at line 1653 of file Task.cpp.
References clock_dl_reset(), clock_exec_reset(), DREAM::Node::executed(), DREAM::idle, and state_.
uint DREAM::Task::subpriority | ( | ) | const [inline, virtual] |
Returns the sub-priority of the Task - subpriority_.
Reimplemented from DREAM::Node.
Definition at line 1665 of file Task.cpp.
Referenced by DREAM::Scheduler::add_error(), DREAM::Solution::fitness(), and DREAM::FixedPriorityScheduler::schedule().
void DREAM::Task::subpriority | ( | uint | subpriority | ) | [inline, virtual] |
Sets the subpriority of the Task.
subpriority | is the subpriority of the task. Subpriorities can be used to model the queueing policies (FixedPriority, FIFO, MUF etc.) |
Reimplemented from DREAM::Node.
void DREAM::Task::take_transitions | ( | ) | [inline, virtual] |
Takes state transitions.
This function implements the state transitions of a Task as specified by the DRE Semantic Domain. Transitions can be triggered by events coming from other Tasks, Timers, event Channels or Schedulers.
Reimplemented from DREAM::Node.
Definition at line 1685 of file Task.cpp.
References DREAM::error, DREAM::executing, and Option::verbose1_.
void DREAM::Task::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. |
Reimplemented from DREAM::Node.
void DREAM::Task::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. |
Reimplemented from DREAM::Node.
void DREAM::Task::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. |
Reimplemented from DREAM::Node.
Definition at line 1997 of file Task.cpp.
References DREAM::AVLTree< key_type, item_type >::insert().
void DREAM::Task::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. |
Reimplemented from DREAM::Node.
Definition at line 2005 of file Task.cpp.
References DREAM::AVLTree< key_type, item_type >::begin(), and DREAM::AVLTree< key_type, item_type >::end().
void DREAM::Task::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. |
Reimplemented from DREAM::Node.
uint DREAM::Task::wcet | ( | ) | const [inline, virtual] |
Returns the worst case execution time of the task.
Reimplemented from DREAM::Node.
Definition at line 2074 of file Task.cpp.
Referenced by DREAM::Scheduler::add_error().
void DREAM::Task::wcet | ( | uint | wcet | ) | [inline, virtual] |
Sets the worst case execution time of the task.
wcet | is the worst case execution time parameter of the Task. |
Reimplemented from DREAM::Node.
bool DREAM::Task::zero_delay_race_condition | ( | DREAM::System * | system_ptr | ) | [virtual] |
Returns true if all of the sources of the task are zero-delay channels.
Definition at line 2091 of file Task.cpp.
References Option::race_condition_zero_, DREAM::Node::scheduler(), and DREAM::System::visitor_map().
uint DREAM::Task::bcet_ [protected] |
Best case execution time.
Definition at line 1195 of file Task.h.
Referenced by clock_exec_reset(), clock_step(), and operator=().
DREAM::Context DREAM::Task::context_ [protected] |
Specifies whether best case, worst case, or a random value is used for the execution time during the simulation.
Definition at line 1198 of file Task.h.
Referenced by clock_exec_reset(), clock_step(), and operator=().
double DREAM::Task::clock_dl_ [protected] |
Deadline clock.
Definition at line 1201 of file Task.h.
Referenced by clock_dl_reset(), clock_step(), and operator=().
uint DREAM::Task::deadline_ [protected] |
double DREAM::Task::et_ [protected] |
The execution time.
This value is from the interval [bcet, wcet] and is set according to the context.
Definition at line 1209 of file Task.h.
Referenced by clock_exec_reset(), clock_step(), and next_event().
double DREAM::Task::next_et_ [protected] |
The next execution time when the context is branchingpoint.
This value is from the interval [bcet, wcet].
Definition at line 1215 of file Task.h.
Referenced by clock_step(), and operator=().
DREAM::State DREAM::Task::state_ [protected] |
State of the Task as specified by the DRE Semantic Domain.
Definition at line 1219 of file Task.h.
Referenced by clock_step(), next_event(), operator=(), and reset().
uint DREAM::Task::subpriority_ [protected] |
Sub-priority.
Subpriorities can be used to model the queueing policies (FIFO, MUF etc.)
Definition at line 1224 of file Task.h.
Referenced by operator=().
uint DREAM::Task::wcet_ [protected] |
Worst case execution time.
Definition at line 1227 of file Task.h.
Referenced by clock_exec_reset(), clock_step(), and operator=().
uint DREAM::Task::zero_delay_race_condition_ [protected] |