DREAM::Task Class Reference

Real-time Task. More...

#include <Task.h>

Inheritance diagram for DREAM::Task:

DREAM::Node List of all members.

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.

Detailed Description

Real-time Task.

This class is the implementation of the Task in the DRE Semantic Domain.

Definition at line 856 of file Task.h.


Constructor & Destructor Documentation

DREAM::Task::Task ( const std::string &  id,
DREAM::Thread thread_ptr,
uint  wcet,
uint  deadline 
)

Constructor.

Parameters:
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.

Definition at line 1221 of file Task.cpp.

DREAM::Task::Task ( const std::string &  id,
DREAM::Thread thread_ptr,
uint  wcet,
uint  deadline,
uint  subpriority 
)

Constructor.

Parameters:
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.)

Definition at line 1239 of file Task.cpp.

DREAM::Task::Task ( const std::string &  id,
DREAM::Thread thread_ptr,
uint  wcet,
uint  bcet,
uint  deadline,
uint  subpriority 
)

Constructor.

Parameters:
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.)

Definition at line 1258 of file Task.cpp.

DREAM::Task::Task ( const DREAM::Task task  ) 

Copy constructor for Tasks.

Used in genetic algorithms.

Definition at line 1302 of file Task.cpp.

DREAM::Task::~Task (  )  [virtual]

Destructor.

Definition at line 1321 of file Task.cpp.

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.

Parameters:
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.

Definition at line 1280 of file Task.cpp.


Member Function Documentation

void DREAM::Task::operator= ( const DREAM::Task task  )  [virtual]

Operator overloading.

The Task will be copied except for the thread_ptr_.

Parameters:
task is the Task to be copied.

Definition at line 1325 of file Task.cpp.

References bcet_, clock_dl_, context_, deadline_, DREAM::Node::id_, next_et_, state_, subpriority_, and wcet_.

bool DREAM::Task::operator== ( const DREAM::Task task  )  [virtual]

Operator overloading.

Parameters:
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.

Returns:
the best case execution time bcet_.

Reimplemented from DREAM::Node.

Definition at line 1362 of file Task.cpp.

void DREAM::Task::bcet ( uint  bcet  )  [inline, virtual]

Sets the best case execution time of the task .

Parameters:
bcet is the best case execution time parameter of the Task.

Reimplemented from DREAM::Node.

Definition at line 1372 of file Task.cpp.

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.

Returns:
the context of the Timer.

Reimplemented from DREAM::Node.

Definition at line 1404 of file Task.cpp.

void DREAM::Task::context ( DREAM::Context  context  )  [inline, virtual]

Sets the Task to use the specified context (e.g.

in the simulation).

Parameters:
context is the context assumed.

Reimplemented from DREAM::Node.

Definition at line 1414 of file Task.cpp.

double DREAM::Task::clock_dl (  )  const [inline, virtual]

Returns the value of the deadline clock - clock_dl_.

Reimplemented from DREAM::Node.

Definition at line 1424 of file Task.cpp.

void DREAM::Task::clock_dl_reset (  )  [inline, virtual]

Resets deadline clock value - clock_dl_.

Definition at line 1430 of file Task.cpp.

References clock_dl_.

Referenced by reset().

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.

Parameters:
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.

Returns:
deadline of the clock deadline_.

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.

Parameters:
deadline is the deadline of the task.

Reimplemented from DREAM::Node.

Definition at line 1523 of file Task.cpp.

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.

Returns:
Time remaining till the next event generation.

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]

Sets the next execution time when the context is branchingpoint.

Reimplemented from DREAM::Node.

Definition at line 1593 of file Task.cpp.

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.

Parameters:
priority is the priority of the task.

Reimplemented from DREAM::Node.

Definition at line 1625 of file Task.cpp.

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.

Parameters:
subpriority is the subpriority of the task. Subpriorities can be used to model the queueing policies (FixedPriority, FIFO, MUF etc.)

Reimplemented from DREAM::Node.

Definition at line 1675 of file Task.cpp.

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.

Parameters:
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.

Definition at line 1747 of file Task.cpp.

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.

Parameters:
task_map stores the Task pointers.
channel_map stores the Channel pointers.
timer_map stores the Timer pointers.

Reimplemented from DREAM::Node.

Definition at line 1989 of file Task.cpp.

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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Definition at line 2027 of file Task.cpp.

uint DREAM::Task::wcet (  )  const [inline, virtual]

Returns the worst case execution time of the task.

Returns:
the worst case execution time wcet_.

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.

Parameters:
wcet is the worst case execution time parameter of the Task.

Reimplemented from DREAM::Node.

Definition at line 2084 of file Task.cpp.

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().


Member Data Documentation

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]

Deadline.

Definition at line 1204 of file Task.h.

Referenced by operator=().

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]

This variable is used to speed up the search whether all sources are zero-delay.

Definition at line 1231 of file Task.h.


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 18:30:04 2007 for DREAM by  doxygen 1.5.1